Zookeeper+mesos+docker+swarm

Source: Internet
Author: User
Tags mesosphere docker run

Zookeeper cluster installation

1. Download

wget http://mirrors.cnnic.cn/apache/zookeeper/stable/zookeeper-3.4.8.tar.gz


2. Decompression

Mkdir/usr/local/zookeeper && tar zxvf zookeeper-3.4.8.tar.gz && mv zookeeper-3.4.8/*/usr/local/ Zookeeper * * RM-RF zookeeper-3.4.8


3. Create a configuration file

Zookeeper file Configuration Detailed

DataDir: Data Catalog

Datalogdir: Log Directory

ClientPort: Client Connection port

The time interval between Ticktime:zookeeper servers or between the client and server to maintain a heartbeat, that is, each ticktime time sends a heartbeat.

The Initlimit:zookeeper leader accepts the maximum number of heartbeat intervals that the client (Follower) can tolerate when initializing a connection. The client connection failed when the Zookeeper server has not received the return information of the client after 5 heartbeats (that is, ticktime) length. The total length of time is 5*2000=10 seconds.

Synclimit: Represents the length of the request and response time between Leader and Follower, and the maximum length of time to be over how many ticktime, the total length of time is 2*2000=4 seconds.

Server. A=B:C:D:

A is a number that indicates this is the first server;

B is the IP address of this server;

C represents the port where the server exchanges information with the Leader server in the cluster;

D means that in case the Leader server in the cluster is hung up, a port is needed to re-elect the new Leader, which is the port that the server communicates with when the election is executed.



Cd/usr/local/zookeeper/conf


Vim/usr/local/zookeeper/conf/zk1.cfg


ticktime=2000

initlimit=10

Synclimit=5

Datadir=/data/zookeeper/zk1/data

Datalogdir=/data/zookeeper/zk1/logs

clientport=2181

server.1=10.10.16.194:3181:4181

server.2=10.10.16.194:3182:4182

server.3=10.10.16.194:3183:4183


echo "1" >/data/zookeeper/zk1/data/myid




Vim/usr/local/zookeeper/conf/zk2.cfg


ticktime=2000

initlimit=10

Synclimit=5

Datadir=/data/zookeeper/zk2/data

Datalogdir=/data/zookeeper/zk2/logs

clientport=2182

server.1=10.10.16.194:3181:4181

server.2=10.10.16.194:3182:4182

server.3=10.10.16.194:3183:4183


echo "2" >/data/zookeeper/zk2/data/myid




Vim/usr/local/zookeeper/conf/zk3.cfg


ticktime=2000

initlimit=10

Synclimit=5

Datadir=/data/zookeeper/zk3/data

Datalogdir=/data/zookeeper/zk3/logs

clientport=2183

server.1=10.10.16.194:3181:4181

server.2=10.10.16.194:3182:4182

server.3=10.10.16.194:3183:4183


echo "3" >/data/zookeeper/zk3/data/myid



4. Start Zookeeper

/usr/local/zookeeper/bin/zkserver.sh start/usr/local/zookeeper/conf/zk1.cfg

/usr/local/zookeeper/bin/zkserver.sh start/usr/local/zookeeper/conf/zk2.cfg

/usr/local/zookeeper/bin/zkserver.sh start/usr/local/zookeeper/conf/zk3.cfg


5. View Zookeeper Status

/usr/local/zookeeper/bin/zkserver.sh status/usr/local/zookeeper/conf/zk1.cfg

/usr/local/zookeeper/bin/zkserver.sh status/usr/local/zookeeper/conf/zk2.cfg

/usr/local/zookeeper/bin/zkserver.sh status/usr/local/zookeeper/conf/zk3.cfg





Mesos Cluster deployment

1, install Mesosphere warehouse to Local

RPM-UVH http://repos.mesosphere.com/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm


2. Mesos Master Deployment

Yum-y Install Mesos


Configuring the Mesos Connection Zookeeper file

Vim/etc/mesos/zk

Zk://10.10.16.194:2181,10.10.16.194:2182,10.10.16.194:2183/mesos

Systemctl Start Mesos-master Mesos-slave



3. Mesos Slave deployment

Yum-y Install Mesos


echo 10.10.16.193 >/etc/mesos-slave/hostname

echo "Mesos,docker" >/etc/mesos-slave/containerizers


Vim/etc/mesos/zk

Zk://10.10.16.194:2181,10.10.16.194:2182,10.10.16.194:2183/mesos


Systemctl Start Mesos-slave

Unable to start the problem after modifying/etc/mesos-slave/hostname, remove rm-rf/var/lib/mesos/meta/* and restart




Dokcer Swarm Deployment

1. Download swarm

Docker Pull Swarm

2. Start swarm

Docker run-d--net=host swarm--debug manage-c mesos-experimental--cluster-opt mesos.address=10.10.16.194--cluster-op T mesos.tasktimeout=100s--cluster-opt mesos.user=root--cluster-opt mesos.offertimeout=10m--cluster-opt mesos.port= 3375--cluster-opt mesos.enablerevocable=true--host=0.0.0.0:4375 zk:// 10.10.16.194:2181,10.10.16.194:2182,10.10.16.194:2183/mesos

3. Running the container

Docker-h 10.10.16.194:4375 run-d-M 512m-e constraint:res-type==~regular docker.16qian.cn/niu-ding-feng/ product-service-web_prd_1.0.1



Consul installation

1. Download Consul and Web UI

Https://www.consul.io/downloads.html


2. Start the service after decompression

To execute a start command on the server server

./consul Agent-server-bootstrap-expect 2-DATA-DIR/TMP/CONSUL-NODE=N1-BIND=10.10.16.194-UI-DIR/ROOT/WEB_UI-DC=DC1 &

./consul Agent-server-bootstrap-expect 2-DATA-DIR/TMP/CONSUL-NODE=N1-BIND=10.10.16.193-UI-DIR-DC=DC1 &

Execute the following command on the 10.10.16.193 server

./consul Join 10.10.16.194


Execute the following command on the Clent server

./consul AGENT-DATA-DIR/TMP/CONSUL-NODE=N3-BIND=10.10.16.190-DC=DC1 &

./consul Join 10.10.16.194


3. View information

./consul Members

./consul Info







This article is from the "My Ops Time" blog, so be sure to keep this source http://aaronsa.blog.51cto.com/5157083/1832184

Zookeeper+mesos+docker+swarm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.