不能在marathon上部署python命令,只能部署docker容器

yks3o0rb  于 2021-06-26  发布在  Mesos
关注(0)|答案(0)|浏览(300)

我有一个mesos主人和两个mesos奴隶,
两个从机位于:
1在我的局域网(mesos slave on lan)
公共云中的1(广域网上的mesos slave)
可以联系到master:
局域网上:10.1.10.175
安湾电话:94.141.153.57
我可以看到两个在迈索斯登记的迈索斯奴隶。
我尝试执行两种类型的虚拟任务:
一个简单的python命令

  1. {
  2. "id": "my-first-app",
  3. "cmd": "python -m SimpleHTTPServer 8009",
  4. "cpus": 0.01,
  5. "mem": 20.0,
  6. "instances": 1,
  7. "acceptedResourceRoles": [
  8. "slave_public",
  9. "*"
  10. ],
  11. "ports": [8009],
  12. "requirePorts": true
  13. }

docker容器部署(内置nginx)

  1. {
  2. "id": "nginx-test",
  3. "container": {
  4. "docker": {
  5. "image": "nginx",
  6. "network": "BRIDGE",
  7. "portMappings": [{
  8. "containerPort": 80,
  9. "hostPort": 0,
  10. "servicePort": 80,
  11. "protocol": "tcp"
  12. }]
  13. },
  14. "type": "DOCKER",
  15. "volumes": []
  16. },
  17. "healthChecks": [{
  18. "protocol": "HTTP",
  19. "portIndex": 0,
  20. "path": "/",
  21. "gracePeriodSeconds": 5,
  22. "intervalSeconds": 20,
  23. "maxConsecutiveFailures": 3
  24. }],
  25. "cpus": 0.2,
  26. "mem": 32.0,
  27. "instances": 1

}
案例1:mesos master发布lan ip:
mesos大师:

  1. /usr/sbin/mesos-master --work_dir=/var/lib/mesos --zk=zk://mesos_machine:2181/mesos --quorum=1 --log_dir=/var/log/mesos --external_log_file=/dev/stdout --advertise_ip=10.1.10.175

局域网上的mesos从机:

  1. /usr/sbin/mesos-slave --master=10.1.10.175:5050 --work_dir=/var/lib/mesos/agent --containerizers=docker,mesos --executor_registration_timeout=3mins --log_dir=/var/log/mesos

广域网上的mesos slave:

  1. /usr/sbin/mesos-slave --master=94.141.153.57:5050 --work_dir=/var/lib/mesos/agent --containerizers=docker,mesos --executor_registration_timeout=3mins --log_dir=/var/log/mesos

当我运行上述配置并成功停止其中一个从机时,我得到这个矩阵:

  1. | | LAN Slave | Cloud Slave |
  2. |-------- |----------- |------------- |
  3. | Python | 'Waiting' | 'Waiting' |
  4. | Docker | 'RUNNING' | 'Waiting' |

在这里,nginx应用程序已经通过marathon部署在mesos slave-on-lan上
案例2:mesos master广域网ip广告:
mesos大师:

  1. /usr/sbin/mesos-master --work_dir=/var/lib/mesos --zk=zk://mesos_machine:2181/mesos --quorum=1 --log_dir=/var/log/mesos --external_log_file=/dev/stdout --advertise_ip=94.141.153.57

mesos-slave-on-lan(使用主lan-ip,否则不在mesos中添加):

  1. /usr/sbin/mesos-slave --master=10.1.10.175:5050 --work_dir=/var/lib/mesos/agent --containerizers=docker,mesos --executor_registration_timeout=3mins --log_dir=/var/log/mesos --advertise_ip=10.1.10.20

广域网上的mesos slave:

  1. /usr/sbin/mesos-slave --master=94.141.153.57:5050 --work_dir=/var/lib/mesos/agent --containerizers=docker,mesos --executor_registration_timeout=3mins --log_dir=/var/log/mesos

当我运行上述配置并成功停止其中一个从机时,我得到这个矩阵:

  1. | | LAN Slave | Cloud Slave |
  2. |-------- |----------- |------------- |
  3. | Python | 'Waiting' | 'Waiting' |
  4. | Docker | 'Waiting' | 'Waiting' |

在这里,nginx应用程序还没有被marathon部署到mesos slave on lan上
但是,在mesos webui中,这两个从机是作为资源可见的。
如何在局域网和广域网从属服务器中部署“python”和“docker”容器?
马拉松比赛记录如下:

  1. 25596:[2016-12-13 15:26:52,393] INFO [/nginx-test-n2]: new app detected (mesosphere.marathon.upgrade.GroupVersioningUtil$:marathon-akka.actor.default-dispatcher-1064)
  2. 25600: * Start(App(/nginx-test-n2, image="nginx")), instances=0)
  3. 25602: * Scale(App(/nginx-test-n2, image="nginx")), instances=1)
  4. 25607: * Start(App(/nginx-test-n2, image="nginx")), instances=0)
  5. 25609: * Scale(App(/nginx-test-n2, image="nginx")), instances=1)
  6. 25611:[2016-12-13 15:26:52,400] INFO [/nginx-test-n2] storing new app version 2016-12-13T14:26:52.388Z (mesosphere.marathon.core.group.impl.GroupManagerActor:marathon-akka.actor.default-dispatcher-1028)
  7. 25612:[2016-12-13 15:26:52,417] INFO Adding health check for app [/nginx-test-n2] and version [2016-12-13T14:26:52.388Z]: [HealthCheck(Some(/),HTTP,Some(0),None,5 seconds,20 seconds,20 seconds,3,false,None)] (mesosphere.marathon.core.health.impl.MarathonHealthCheckManager:marathon-akka.actor.default-dispatcher-1073)
  8. 25613:[2016-12-13 15:26:52,417] INFO Starting app /nginx-test-n2 (mesosphere.marathon.SchedulerActions:marathon-akka.actor.default-dispatcher-1073)
  9. 25614:[2016-12-13 15:26:52,417] INFO Starting health check actor for app [/nginx-test-n2] version [2016-12-13T14:26:52.388Z] and healthCheck [HealthCheck(Some(/),HTTP,Some(0),None,5 seconds,20 seconds,20 seconds,3,false,None)] (mesosphere.marathon.core.health.impl.HealthCheckActor:marathon-akka.actor.default-dispatcher-1075)
  10. 25615:[2016-12-13 15:26:52,417] INFO Already running 0 instances of /nginx-test-n2. Not scaling. (mesosphere.marathon.SchedulerActions:marathon-akka.actor.default-dispatcher-1073)
  11. 25616:[2016-12-13 15:26:52,418] INFO Successfully started 0 instances of /nginx-test-n2 (mesosphere.marathon.upgrade.AppStartActor:marathon-akka.actor.default-dispatcher-1073)
  12. 25617:[2016-12-13 15:26:52,418] INFO Started taskLaunchActor for /nginx-test-n2 version 2016-12-13T14:26:52.388Z with initial count 1 (mesosphere.marathon.core.launchqueue.impl.TaskLauncherActor:marathon-akka.actor.default-dispatcher-1028)
  13. 25618:[2016-12-13 15:26:52,419] INFO activating matcher ActorOfferMatcher(Actor[akka://marathon/user/launchQueue/5/6-nginx-test-n2#-69306758]). (mesosphere.marathon.core.matcher.manager.impl.OfferMatcherManagerActor:marathon-akka.actor.default-dispatcher-1071)
  14. 25627:[2016-12-13 15:26:52,425] INFO Offer [bd40f00f-ce24-4014-b1b1-82db64e68c10-O91]. Considering resources with roles {*} without resident reservation labels. Insufficient ports in offer for run spec [/nginx-test-n2] (mesosphere.marathon.tasks.PortsMatcher:marathon-akka.actor.default-dispatcher-1073)
  15. 25628:[2016-12-13 15:26:52,425] INFO Offer [bd40f00f-ce24-4014-b1b1-82db64e68c10-O91]. Insufficient resources for [/nginx-test-n2] (need cpus=0.2, mem=32.0, disk=0.0, gpus=0, ports=(), available in offer: [id { value: "bd40f00f-ce24-4014-b1b1-82db64e68c10-O91" } framework_id { value: "40aadcc7-8e0f-4634-af46-29d9c33bc03e-0000" } slave_id { value: "bd40f00f-ce24-4014-b1b1-82db64e68c10-S1" } hostname: "myproj-slave-vm-1" resources { name: "disk" type: SCALAR scalar { value: 3985.0 } role: "*" } resources { name: "cpus" type: SCALAR scalar { value: 0.6 } role: "*" } resources { name: "mem" type: SCALAR scalar { value: 6478.0 } role: "*" } url { scheme: "http" address { hostname: "myproj-slave-vm-1" ip: "10.1.10.20" port: 5051 } path: "/slave(1)" }] (mesosphere.mesos.TaskBuilder$:marathon-akka.actor.default-dispatcher-1073)
  16. 25634: * Start(App(/nginx-test-n2, image="nginx")), instances=0)
  17. 25636: * Scale(App(/nginx-test-n2, image="nginx")), instances=1)
  18. 25646:[2016-12-13 15:26:57,440] INFO Offer [bd40f00f-ce24-4014-b1b1-82db64e68c10-O92]. Considering resources with roles {*} without resident reservation labels. Insufficient ports in offer for run spec [/nginx-test-n2] (mesosphere.marathon.tasks.PortsMatcher:marathon-akka.actor.default-dispatcher-1073)
  19. 25647:[2016-12-13 15:26:57,440] INFO Offer [bd40f00f-ce24-4014-b1b1-82db64e68c10-O92]. Insufficient resources for [/nginx-test-n2] (need cpus=0.2, mem=32.0, disk=0.0, gpus=0, ports=(), available in offer: [id { value: "bd40f00f-ce24-4014-b1b1-82db64e68c10-O92" } framework_id { value: "40aadcc7-8e0f-4634-af46-29d9c33bc03e-0000" } slave_id { value: "bd40f00f-ce24-4014-b1b1-82db64e68c10-S1" } hostname: "myproj-slave-vm-1" resources { name: "disk" type: SCALAR scalar { value: 3985.0 } role: "*" } resources { name: "cpus" type: SCALAR scalar { value: 0.6 } role: "*" } resources { name: "mem" type: SCALAR scalar { value: 6478.0 } role: "*" } url { scheme: "http" address { hostname: "myproj-slave-vm-1" ip: "10.1.10.20" port: 5051 } path: "/slave(1)" }] (mesosphere.mesos.TaskBuilder$:marathon-akka.actor.default-dispatcher-1073)
  20. 25660:[2016-12-13 15:27:02,457] INFO Offer [bd40f00f-ce24-4014-b1b1-82db64e68c10-O93]. Considering resources with roles {*} without resident reservation labels. Insufficient ports in offer for run spec [/nginx-test-n2] (mesosphere.marathon.tasks.PortsMatcher:marathon-akka.actor.default-dispatcher-1028)
  21. 25661:[2016-12-13 15:27:02,457] INFO Offer [bd40f00f-ce2

我也有这样的日志,没有部署,也没有错误:

  1. 31333:[2016-12-13 16:00:39,975] INFO [/nginx-test10]: new app detected (mesosphere.marathon.upgrade.GroupVersioningUtil$:marathon-akka.actor.default-dispatcher-1139)
  2. 31337: * Start(App(/nginx-test10, image="nginx")), instances=0)
  3. 31339: * Scale(App(/nginx-test10, image="nginx")), instances=1)
  4. 31344: * Start(App(/nginx-test10, image="nginx")), instances=0)
  5. 31346: * Scale(App(/nginx-test10, image="nginx")), instances=1)
  6. 31348:[2016-12-13 16:00:39,979] INFO [/nginx-test10] storing new app version 2016-12-13T15:00:39.974Z (mesosphere.marathon.core.group.impl.GroupManagerActor:marathon-akka.actor.default-dispatcher-1101)
  7. 31349:[2016-12-13 16:00:39,981] INFO Adding health check for app [/nginx-test10] and version [2016-12-13T15:00:39.974Z]: [HealthCheck(Some(/),HTTP,Some(0),None,5 seconds,20 seconds,20 seconds,3,false,None)] (mesosphere.marathon.core.health.impl.MarathonHealthCheckManager:marathon-akka.actor.default-dispatcher-1141)
  8. 31350:[2016-12-13 16:00:39,982] INFO Starting app /nginx-test10 (mesosphere.marathon.SchedulerActions:marathon-akka.actor.default-dispatcher-1141)
  9. 31351:[2016-12-13 16:00:39,982] INFO Starting health check actor for app [/nginx-test10] version [2016-12-13T15:00:39.974Z] and healthCheck [HealthCheck(Some(/),HTTP,Some(0),None,5 seconds,20 seconds,20 seconds,3,false,None)] (mesosphere.marathon.core.health.impl.HealthCheckActor:marathon-akka.actor.default-dispatcher-1139)
  10. 31352:[2016-12-13 16:00:39,982] INFO Already running 0 instances of /nginx-test10. Not scaling. (mesosphere.marathon.SchedulerActions:marathon-akka.actor.default-dispatcher-1141)
  11. 31353:[2016-12-13 16:00:39,982] INFO Successfully started 0 instances of /nginx-test10 (mesosphere.marathon.upgrade.AppStartActor:marathon-akka.actor.default-dispatcher-1141)
  12. 31354:[2016-12-13 16:00:39,983] INFO Started taskLaunchActor for /nginx-test10 version 2016-12-13T15:00:39.974Z with initial count 1 (mesosphere.marathon.core.launchqueue.impl.TaskLauncherActor:marathon-akka.actor.default-dispatcher-1110)
  13. 31355:[2016-12-13 16:00:39,983] INFO activating matcher ActorOfferMatcher(Actor[akka://marathon/user/launchQueue/6/2-nginx-test10#1135134700]). (mesosphere.marathon.core.matcher.manager.impl.OfferMatcherManagerActor:marathon-akka.actor.default-dispatcher-1140)
  14. 31364: * Start(App(/nginx-test10, image="nginx")), instances=0)
  15. 31366: * Scale(App(/nginx-test10, image="nginx")), instances=1)

mesos中的资源是这样出现的(只有wan slave出现,lan slave没有出现,我不明白为什么):

  1. | | CPUs | GPUs | Mem | Disk |
  2. |---------|------|------|--------|---------|
  3. | Total | 1 | 0 | 244 MB | 43.6 GB |
  4. | Used | 0 | 0 | 0 B | 0 B |
  5. | Offered | 0 | 0 | 0 B | 0 B |
  6. | Idle | 1 | 0 | 244 MB | 43.6 GB |

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题