###############################################################
Mesos Cluster function test
###############################################################
1: First prepare a JSON file (Hello.json)
{
"id": "Hello",
"cmd": "Echo hello; Sleep 10 ",
"Mem": 16,
"CPUs": 0.1,
"Instances": 1,
"Disk": 0.0,
"Ports": [0]
}
3: Then invoke API to launch an app via marathon
Curl-i-H ' content-type:application/json ' [email protected] 172.16.7.12:8080/v2/apps
Then log in and Marathon to see that the process has started.
5: Complete JSON sample
{
"id": "/product/service/myapp",
"cmd": "Env && sleep 300",
"Args": ["/bin/sh", "-C", "Env && sleep 300"]
"CPUs": 1.5,
"Mem": 256.0,
"Portdefinitions": [
{"Port": 8080, "protocol": "TCP", "name": "http", Labels: {"vip_0": "10.0.0.1:80"}},
{"Port": 9000, "protocol": "TCP", "Name": "Admin"}
],
"Requireports": false,
"Instances": 3,
"Executor": "",
"Container": {
"Type": "DOCKER",
"Docker": {
"Image": "Group/image",
"Network": "BRIDGE",
"Portmappings": [
{
"Containerport": 8080,
"Hostport": 0,
"Serviceport": 9000,
"Protocol": "TCP"
},
{
"Containerport": 161,
"Hostport": 0,
"Protocol": "UDP"
}
],
"Privileged": false,
"Parameters": [
{"Key": "A-docker-option", "value": "XXX"},
{"Key": "B-docker-option", "Value": "YYY"}
]
},
"Volumes": [
{
"Containerpath": "/etc/a",
"Hostpath": "/var/data/a",
"Mode": "RO"
},
{
"Containerpath": "/etc/b",
"Hostpath": "/var/data/b",
"Mode": "RW"
}
]
},
"env": {
"Ld_library_path": "/usr/local/lib/mylib"
},
"Constraints": [
["Attribute", "OPERATOR", "value"]
],
"Acceptedresourceroles": [/* Since 0.9.0 */
"Role1", "*"
],
"Labels": {
"Environment": "Staging"
},
"Fetch": [
{"uri": "Https://raw.github.com/mesosphere/marathon/master/README.md"},
{"uri": "Https://foo.com/archive.zip", "executable": false, "extract": True, "cache": true}
],
"Dependencies": ["/product/db/mongo", "/product/db", ".. /.. /db "],
"Healthchecks": [
{
"Protocol": "HTTP",
"Path": "/health",
"Graceperiodseconds": 3,
"Intervalseconds": 10,
"PortIndex": 0,
"Timeoutseconds": 10,
"Maxconsecutivefailures": 3
},
{
"Protocol": "HTTP",
"Path": "/machinehealth",
"Graceperiodseconds": 3,
"Intervalseconds": 10,
"Port": 3333,
"Timeoutseconds": 10,
"Maxconsecutivefailures": 3
},
{
"Protocol": "TCP",
"Graceperiodseconds": 3,
"Intervalseconds": 5,
"PortIndex": 1,
"Timeoutseconds": 5,
"Maxconsecutivefailures": 3
},
{
"Protocol": "COMMAND",
"Command": {"value": "Curl-f-X GET/http $HOST: $PORT 0/health"},
"Maxconsecutivefailures": 3
}
],
"Backoffseconds": 1,
"Backofffactor": 1.15,
"Maxlaunchdelayseconds": 3600,
"Upgradestrategy": {
"Minimumhealthcapacity": 0.5,
"Maximumovercapacity": 0.2
}
}
Mesos cluster installation Deployment planning, preparation (1)
Mesos cluster Installation Deployment Zookeeper (2)
Mesos cluster Installation Deployment Mesos-master (3)
Mesos cluster Installation Deployment Marathon (4)
Mesos cluster Installation Deployment Chronos (5)
Mesos cluster Installation Deployment Mesos-slave (6)
Mesos cluster Installation Deployment Mesos-dns (7)
Mesos cluster basic function test (8)
Mesos cluster Cleanup (9)
This article from "Kang Jianhua" blog, reproduced please contact the author!
Mesos cluster basic function test (8)