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

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

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

{
  "id": "my-first-app",
  "cmd": "python -m SimpleHTTPServer 8009",
  "cpus": 0.01,
  "mem": 20.0,
  "instances": 1,
  "acceptedResourceRoles": [
    "slave_public",
    "*"
  ],
  "ports": [8009],
  "requirePorts": true
}

docker容器部署(内置nginx)

{
  "id": "nginx-test",
  "container": {
    "docker": {
      "image": "nginx",
      "network": "BRIDGE",
      "portMappings": [{
        "containerPort": 80,
        "hostPort": 0,
        "servicePort": 80,
        "protocol": "tcp"
      }]
      },
      "type": "DOCKER",
      "volumes": []
    },
  "healthChecks": [{
    "protocol": "HTTP",
    "portIndex": 0,
    "path": "/",
    "gracePeriodSeconds": 5,
    "intervalSeconds": 20,
    "maxConsecutiveFailures": 3
  }],
"cpus": 0.2,
"mem": 32.0,
"instances": 1

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

/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从机:

/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:

/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

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

|           | LAN Slave     | Cloud Slave   |
|--------   |-----------    |-------------  |
| Python    | 'Waiting'     | 'Waiting'     |
| Docker    | 'RUNNING'     | 'Waiting'     |

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

/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中添加):

/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:

/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

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

|           | LAN Slave     | Cloud Slave   |
|--------   |-----------    |-------------  |
| Python    | 'Waiting'     | 'Waiting'     |
| Docker    | 'Waiting'     | 'Waiting'     |

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

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)
25600:  * Start(App(/nginx-test-n2, image="nginx")), instances=0)
25602:  * Scale(App(/nginx-test-n2, image="nginx")), instances=1)
25607:  * Start(App(/nginx-test-n2, image="nginx")), instances=0)
25609:  * Scale(App(/nginx-test-n2, image="nginx")), instances=1)
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)
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)
25613:[2016-12-13 15:26:52,417] INFO Starting app /nginx-test-n2 (mesosphere.marathon.SchedulerActions:marathon-akka.actor.default-dispatcher-1073)
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)
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)
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)
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)
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)
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)
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)
25634:  * Start(App(/nginx-test-n2, image="nginx")), instances=0)
25636:  * Scale(App(/nginx-test-n2, image="nginx")), instances=1)
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)
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)
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)
25661:[2016-12-13 15:27:02,457] INFO Offer [bd40f00f-ce2

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

31333:[2016-12-13 16:00:39,975] INFO [/nginx-test10]: new app detected (mesosphere.marathon.upgrade.GroupVersioningUtil$:marathon-akka.actor.default-dispatcher-1139)
31337:  * Start(App(/nginx-test10, image="nginx")), instances=0)
31339:  * Scale(App(/nginx-test10, image="nginx")), instances=1)
31344:  * Start(App(/nginx-test10, image="nginx")), instances=0)
31346:  * Scale(App(/nginx-test10, image="nginx")), instances=1)
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)
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)
31350:[2016-12-13 16:00:39,982] INFO Starting app /nginx-test10 (mesosphere.marathon.SchedulerActions:marathon-akka.actor.default-dispatcher-1141)
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)
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)
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)
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)
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)
31364:  * Start(App(/nginx-test10, image="nginx")), instances=0)
31366:  * Scale(App(/nginx-test10, image="nginx")), instances=1)

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

|         | CPUs | GPUs | Mem    | Disk    |
|---------|------|------|--------|---------|
| Total   | 1    | 0    | 244 MB | 43.6 GB |
| Used    | 0    | 0    | 0 B    | 0 B     |
| Offered | 0    | 0    | 0 B    | 0 B     |
| Idle    | 1    | 0    | 244 MB | 43.6 GB |

暂无答案!

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

相关问题