mesos 集群基础功能测试(8)


###############################################################

                                                    mesos 集群功能测试

###############################################################

1:首先准备一个json文件(hello.json)

{

    "id": "hello",

    "cmd": "echo hello; sleep 10",

    "mem": 16,

    "cpus": 0.1,

    "instances": 1,

    "disk": 0.0,

    "ports": [0]

 }

 

3:然后调用api,通过marathon启动一个应用

 

curl -i -H 'Content-Type: application/json' -d@hello.json 172.16.7.12:8080/v2/apps

然后登陆,marathon 即可看到进程已经启动。


5:完整json 样例

{

    "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:$PORT0/health" },

            "maxConsecutiveFailures": 3

        }

    ],

    "backoffSeconds": 1,

    "backoffFactor": 1.15,

    "maxLaunchDelaySeconds": 3600,

    "upgradeStrategy": {

        "minimumHealthCapacity": 0.5,

        "maximumOverCapacity": 0.2

    }

}



mesos 集群安装部署规划、准备(1)

mesos 集群安装部署zookeeper(2)

mesos 集群安装部署mesos-master(3)

mesos 集群安装部署marathon(4)

mesos 集群安装部署chronos(5)

mesos 集群安装部署mesos-slave(6)

mesos 集群安装部署mesos-dns(7)

mesos 集群基础功能测试(8)

mesos 集群清理(9)


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值