自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

如何搭建擁有服務(wù)發(fā)現(xiàn)能力的Mesosphere集群環(huán)境

云計(jì)算
有鑒于Docker集群技術(shù)如雨后春筍般不停涌現(xiàn),我來(lái)分享我自己在探索Mesosphere上的經(jīng)驗(yàn)和結(jié)果,我將告訴讀者如何在CentOS 7上基于Mesosphere搭建擁有服務(wù)發(fā)現(xiàn)能力的Docker集群。

有鑒于Docker集群技術(shù)如雨后春筍般不停涌現(xiàn),我來(lái)分享我自己在探索Mesosphere上的經(jīng)驗(yàn)和結(jié)果,我將告訴讀者如何在CentOS 7上基于Mesosphere搭建擁有服務(wù)發(fā)現(xiàn)能力的Docker集群。

我GitHub項(xiàng)目上的說(shuō)明:https://github.com/draculavlad/SetUpMesosphereOnCentos7WithServiceDiscovery

本人語(yǔ)死早,請(qǐng)諒解我的語(yǔ)言組織能力

搭建環(huán)境

CentOS 7

系統(tǒng)初始化

  1. yum update -y 
  2. yum install bash curl wget tar zip unzip bzip2 telnet net-tools git -y 
  3. yum groupinstall "Development Tools" –y 
  4. yum -y install ntp ntpdate 
  5. systemctl start ntpd 

如果需要的話關(guān)閉防火墻。

 

  1. setenforce Permissive 
  2. systemctl stop firewalld 
  3. systemctl disable firewalld 

 

添加yum源。

 

  1. rpm -Uvh 'http://repos.mesosphere.io/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm' 
  2. rpm -Uvh 'http://archive.cloudera.com/cdh4/one-click-install/redhat/6/x86_64/cloudera-c 

 

安裝

 

  1. yum -y install mesos marathon mesosphere-zookeeper 

啟動(dòng)haproxy

haproxy只有master節(jié)點(diǎn)才需要

 

  1. yum -y install haproxy && systemctl start haproxy 

安裝啟動(dòng)docker

 

  1. rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm 
  2. yum install -y docker 

 

預(yù)初始化

 

  1. systemctl disable mesos-master 
  2. systemctl disable mesos-slave 
  3. systemctl disable marathon 
  4. systemctl disable zookeeper 

 

ZooKeeper 配置和啟動(dòng)

只有master 節(jié)點(diǎn)需要如此操作。

設(shè)置文件[/var/lib/zookeeper/myid]為當(dāng)前mesos master節(jié)點(diǎn)的id,id必須為1-255之中的整數(shù),例如:1

添加所有的mesos master節(jié)點(diǎn)信息到文件[/etc/zookeeper/conf/zoo.cf],例如:

master_node_id為master節(jié)點(diǎn)id同該節(jié)點(diǎn)[/var/lib/zookeeper/myid]文件的配置,master_node_ip為master節(jié)點(diǎn)的ip地址:

 

  1. server.$master_node_id=$master_node_ip:2888:3888 

啟動(dòng)ZooKeeper:

 

  1. systemctl start zookeeper 

#p#

Mesos 配置和啟動(dòng)

master和slave節(jié)點(diǎn)都需要如此設(shè)置。添加所有的master節(jié)點(diǎn)到文件[/etc/mesos/zk],例如:

 

  1. zk://$first_master_node_ip:2181,$second_master_node_ip:2181,.../mesos 

Mesos master 和 marathon的配置和啟動(dòng)

只有master節(jié)點(diǎn)需要如此配置,marathon節(jié)點(diǎn)與master節(jié)點(diǎn)不同,目前我是把marathon安裝在master節(jié)點(diǎn)。

設(shè)置文件[/etc/mesos-master/quorum]內(nèi)容為一個(gè)大于master節(jié)點(diǎn)數(shù)除以2的整數(shù)。

設(shè)置文件[/etc/mesos-master/ip]內(nèi)容為當(dāng)前master節(jié)點(diǎn)的ip

設(shè)置文件[/etc/mesos-master/hostname]內(nèi)容為當(dāng)前master節(jié)點(diǎn)的域名(必須可被其他節(jié)點(diǎn)解析)

 

  1. mkdir -p /etc/marathon/conf 
  2. cp /etc/mesos/zk /etc/marathon/conf/master 
  3. cp /etc/marathon/conf/master /etc/marathon/conf/zk 
  4. sed –i 's|mesos|marathon|g' /etc/marathon/conf/zk 

 

添加Mesosphere的服務(wù)發(fā)現(xiàn)功能

安裝在master節(jié)點(diǎn)。因?yàn)楣俜酵扑]的腳本和Haproxy1.5不兼容所以請(qǐng)使用我的腳本

 

  1. wget 'https://github.com/draculavlad/SetUpMesosphereOnCentos7/blob/master/haproxy-marathon- 

設(shè)置文件[/etc/haproxy-marathon-bridge/marathons]:

 

  1. echo "$first_marathon_node_ip:8080" >> /etc/haproxy-marathon-bridge/marathons 
  2. echo "$second_marathon_node_ip:8080" >> /etc/haproxy-marathon-bridge/marathons 
  3. echo "$third_marathon_node_ip:8080" >> /etc/haproxy-marathon-bridge/marathons 

 

執(zhí)行安裝腳本:

 

  1. chmod +x haproxy-marathon-bridge 
  2. ./haproxy-marathon-bridge install_cronjob 

 

啟動(dòng)mesos master和marathon服務(wù)

 

  1. systemctl start mesos-master 
  2. systemctl start marathon 

 

mesos slave 節(jié)點(diǎn)配置和啟動(dòng)

設(shè)置文件[/etc/mesos-slave/ip]內(nèi)容為當(dāng)前slave節(jié)點(diǎn)的ip地址

設(shè)置文件[/etc/mesos-slave/hostname]內(nèi)容為當(dāng)前slave節(jié)點(diǎn)的域名(必須可被其他節(jié)點(diǎn)解析)

使slave節(jié)點(diǎn)支持Docker:

 

  1. echo 'docker,mesos' > /etc/mesos-slave/containerizers 
  2. echo '5mins' > /etc/mesos-slave/executor_registration_timeout 

 

啟動(dòng)mesos slave:

 

  1. systemctl start mesos-slave 

測(cè)試腳本

測(cè)試腳本來(lái)自于我參考的youtube視頻

 

  1. wget 'https://github.com/draculavlad/SetUpMesosphereOnCentos7WithServiceDiscovery/blob/master/launch.sh' 
  2. wget 'https://github.com/draculavlad/SetUpMesosphereOnCentos7WithServiceDiscovery/blob/master/nginx-bridge.json' 
  3. export marathon_node_ip=$your_marathon_node_ip 
  4. chmod +x launch.sh 
  5. ./launch.sh nginx-bridge.json 

原文鏈接:http://dockone.io/article/439
 

責(zé)任編輯:Ophira 來(lái)源: dockerone
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)