在marathon上部署mesos-dns服務(解決沒法啓動,部署失敗)

測試部署html

1) mesos-master  10.57.137.131 git

2) mesos-slave     10.57.137.131 github

3) marathon           10.57.137.131 json

如今須要在這個marathon上部署mesos-dns.centos

具體參考連接:app

https://mesosphere.github.io/mesos-dns/docs/configuration-parameters.htmldom

https://open.mesosphere.com/advanced-course/building-and-running-mesos-dns/curl

這個連接比較全面,測試

下載mesos-dns二進制包.ui

config的默認樣板以下:

{
  "zk": "zk://10.101.160.15:2181/mesos",
  "masters": ["10.101.160.15:5050", "10.101.160.16:5050", "10.101.160.17:5050"],
  "refreshSeconds": 60,
  "ttl": 60,
  "domain": "mesos",
  "port": 53,
  "resolvers": ["169.254.169.254"],
  "timeout": 5, 
  "httpon": true,
  "dnson": true,
  "httpport": 8123,
  "externalon": true,
  "listener": "10.101.160.16",
  "SOAMname": "ns1.mesos",
  "SOARname": "root.ns1.mesos",
  "SOARefresh": 60,
  "SOARetry":   600,
  "SOAExpire":  86400,
  "SOAMinttl": 60,
  "IPSources": ["netinfo", "mesos", "host"]
}

而後建立config.json文件

[root@centos7 mesos-dns]# cat config.json 
{
  "zk": "zk://10.57.137.131:2181/mesos",
  "masters": ["10.57.137.131:5050"],
  "refreshSeconds": 60,
  "ttl": 60,
  "domain": "mesos",
  "ns": "ns1",
  "port": 53,
  "resolvers": ["8.8.8.8"],
  "timeout": 5,
  "listener": "0.0.0.0",
  "SOAMname": "root.ns1.mesos",
  "SOARname": "ns1.mesos",
  "SOARefresh": 60,
  "SOARetry":   600,
  "SOAExpire":  86400,
  "SOAMinttl": 60,
  "dnson": true,
  "httpon": true,
  "httpport": 8123,
  "externalon": true,
  "recurseon": true
}

這個時候須要將mesos-dns使用marathon部署

這地方有坑,避免沒法啓動,須要注意

[root@centos7 mywork]# cat mesos-dns.json 
{
"id": "mesos-dns",
"cpus": 0.3, 
"mem": 120,
"instances": 1,
"constraints": [["hostname", "CLUSTER", "centos7_1"]],
"cmd": "/usr/local/mesos-dns/mesos-dns -v=1 -config=/usr/local/mesos-dns/config.json "
}

注意的地方:

1) 能夠修改id的名稱,佔用cpus,mem,instances,

2) 注意裏面的"hostname"字符串亂改,CLUSTER字符串亂改,

3) 裏面的centos7_1能夠修改,可是不能夠隨便修改,這個名字須要查看mesos-slave頁籤中的主機名稱.(這地方好坑,只怪本身英語很差.原版文檔看的太痛苦)

裏面的主機名使用圈住的,別亂改,否則你會死的很慘

4) 裏面的"cmd"後面的命令,他媽的死活不知道爲啥加上sudo就不行,(因此別加sudo)

"cmd": "sudo /usr/local/mesos-dns/mesos-dns -v=1 -config=/usr/local/mesos-dns/config.json "

把上面的sudo去掉.

接下來將mesos-dns部署到marathon中.

curl -X POST -H "Content-Type: application/json" http://10.57.137.131:8080/v2/apps -d@mesos-dns.json

最後終於搞定了.

相關文章
相關標籤/搜索