久久精品人人爽,华人av在线,亚洲性视频网站,欧美专区一二三

怎么從marathon中使用docker啟動nginx

228次閱讀
沒有評論

共計 3640 個字符,預計需要花費 10 分鐘才能閱讀完成。

這篇文章主要介紹“怎么從 marathon 中使用 docker 啟動 nginx”,在日常操作中,相信很多人在怎么從 marathon 中使用 docker 啟動 nginx 問題上存在疑惑,丸趣 TV 小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”怎么從 marathon 中使用 docker 啟動 nginx”的疑惑有所幫助!接下來,請跟著丸趣 TV 小編一起來學習吧!

如果程序一直 deploy 說明一定有問題
mac 安裝

brew install mesos
brew upgrade mesos

啟動 zookeeper 啟動 master

HOST_IP=100.80.128.98
sudo /usr/local/Cellar/mesos/1.4.1/sbin/mesos-master --ip=${HOST_IP} \
 --log_dir=/Users/lifei/dockerproject/mesos/master/log --work_dir=/Users/lifei/dockerproject/mesos/master/work \
 --ZK=zk://${HOST_IP}:2181/mesos --quorum=1

啟動 slave(注意端口,如果 marathon 中用到 80 等端口,需要將 ports 范圍足夠大)

/usr/local/Cellar/mesos/1.4.1/sbin/mesos-slave --help  查看幫助
啟動第一個 slave
sudo /usr/local/Cellar/mesos/1.4.1/sbin/mesos-slave --master=${HOST_IP}:5050 \
--log_dir=/Users/lifei/dockerproject/mesos/slave/log --work_dir=/Users/lifei/dockerproject/mesos/slave/work \
--containerizers=docker,mesos --no-hostname_lookup --ip=${HOST_IP} --resources= ports:[1-32000];  
啟動第二個 slave
sudo /usr/local/Cellar/mesos/1.4.1/sbin/mesos-slave --master=${HOST_IP}:5050 \
--log_dir=/Users/lifei/dockerproject/mesos/slave/log2 --work_dir=/Users/lifei/dockerproject/mesos/slave/work2 \
--containerizers=docker,mesos --no-hostname_lookup --ip=${HOST_IP} --resources= ports:[1-32000];

測試 task

/usr/local/Cellar/mesos/1.4.1/bin/mesos-execute --master=localhost:5050 --name=hellomesos --command= echo  hello,mesos

啟動 marathon

sudo ./bin/start --http_port 8088 --master ${HOST_IP}:5050 --zk zk://${HOST_IP}:2181/marathon -h ${HOST_IP}

測試 marathon

Command
while [ true ] ; do echo  Hello Marathon  ; sleep 5 ; done

從 marathon 中使用 docker 啟動 nginx

{
  type :  DOCKER ,
  volumes : [],
  docker : {
  image :  library/nginx ,
  network :  BRIDGE ,
  portMappings : [
 {
  containerPort : 80,
  hostPort : 0,
  servicePort : 2000,
  protocol :  tcp ,
  labels : {}
 }
 ],
  privileged : false,
  parameters : [],
  forcePullImage : false
 }
使用 docker inspect containerid,查看動態分配的 hostport
ps: 在 container 里邊,  這個 web 服務運行的端口是 8080(containerPort 的值)。在 container 外,Marathon 會分配一個隨機端口(hostPort 設置是 0)

marathon-lb 安裝

 采用 bridge 方式,host 方式失敗,不明白問題在哪兒 **********
  id :  /marathon-lb ,
  cmd : null,
  cpus : 1,
  mem : 128,
  disk : 0,
  instances : 1,
  constraints : [
 [
  hostname ,
  UNIQUE 
 ]
 ],
  container : {
  type :  DOCKER ,
  volumes : [
 {
  containerPath :  /var ,
  hostPath :  /Users/lifei/dockerproject/marathon/marathon-lb-var ,
  mode :  RW 
 },
 {
  containerPath :  /tmp ,
  hostPath :  /Users/lifei/dockerproject/marathon/marathon-lb-tmp ,
  mode :  RW 
 }
 ],
  docker : {
  image :  docker.io/mesosphere/marathon-lb ,
  network :  BRIDGE ,
  portMappings : [
 {
  containerPort : 80,
  hostPort : 80,
  servicePort : 10001,
  protocol :  tcp ,
  labels : {}
 },
 {
  containerPort : 9090,
  hostPort : 9090,
  servicePort : 10002,
  protocol :  tcp ,
  labels : {}
 }
 ],
  privileged : true,
  parameters : [],
  forcePullImage : false
 }
 },
  portDefinitions : [
 {
  port : 10001,
  protocol :  tcp ,
  labels : {}
 },
 {
  port : 10002,
  protocol :  tcp ,
  labels : {}
 }
 ],
  args : [
  sse ,
  -m ,
  http://100.80.128.98:8088 ,
  --group ,
  external 
 ]
}

測試 marathon-lb

{
  id :  /test-lb-nginx ,
  cmd : null,
  cpus : 0.2,
  mem : 20,
  disk : 0,
  instances : 2,
  container : {
  type :  DOCKER ,
  volumes : [],
  docker : {
  image :  docker.io/nginx ,
  network :  BRIDGE ,
  portMappings : [
 {
  containerPort : 80,
  hostPort : 0,
  servicePort : 80,
  protocol :  tcp ,
  labels : {}
 }
 ],
  privileged : false,
  parameters : [],
  forcePullImage : false
 }
 },
  healthChecks : [
 {
  path :  / ,
  protocol :  HTTP ,
  portIndex : 0,
  gracePeriodSeconds : 300,
  intervalSeconds : 60,
  timeoutSeconds : 20,
  maxConsecutiveFailures : 3,
  ignoreHttp1xx : false
 }
 ],
  labels : {
  HAPROXY_GROUP :  external ,
  HAPROXY_0_VHOST :  nginx.marathon.mesos 
 },
  portDefinitions : [
 {
  port : 80,
  protocol :  tcp ,
  labels : {}
 }
 ]
}

測試 url

http://100.80.128.98:9090/haproxy?stats
http://100.80.128.98

到此,關于“怎么從 marathon 中使用 docker 啟動 nginx”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續學習更多相關知識,請繼續關注丸趣 TV 網站,丸趣 TV 小編會繼續努力為大家帶來更多實用的文章!

正文完
 
丸趣
版權聲明:本站原創文章,由 丸趣 2023-08-16發表,共計3640字。
轉載說明:除特殊說明外本站除技術相關以外文章皆由網絡搜集發布,轉載請注明出處。
評論(沒有評論)
主站蜘蛛池模板: 莱阳市| 远安县| 璧山县| 新野县| 长宁县| 达州市| 贡山| 榆林市| 莱芜市| 黎城县| 聂拉木县| 宜兴市| 克什克腾旗| 湖州市| 南木林县| 农安县| 吉安市| 六枝特区| 磐石市| 宿迁市| 鄂州市| 临清市| 新竹县| 绥滨县| 大宁县| 芜湖县| 珲春市| 蕉岭县| 娄底市| 威海市| 如东县| 东山县| 阿巴嘎旗| 安新县| 咸阳市| 漯河市| 阿合奇县| 定安县| 海盐县| 德格县| 潜江市|