Brief introduction
Mesosphere
Mesos
Marathon
Zookeeper
The Mesos/marathon configuration file for master, which ensures that Master is more lightweight.
Presumably for these concepts, to find here is basically to know what they are doing, here is no nonsense. Do not know can be self-repairing.
Environment:
Hostname
|
Function |
IP Address
|
Master1
|
Mesos Master |
172.18.2.94 |
Master2 |
Mesos Master |
172.18.2.95 |
Master3 |
Mesos Master |
172.18.2.96 |
Slave1 |
Mesos slave |
172.18.2.97 |
Slave2 |
Mesos slave |
172.18.2.98 |
Slave3 |
Mesos slave |
172.18.2.99 |
Slave4 |
Mesos slave |
172.18.2.100 |
Describe:
First of all, Master for 3 machines, do zookeeper cluster configuration management (Mesos/marathon/zookeeper), and then 3 master nodes do high-availability, marathon the same.
Work ahead
① turn SELinux off.
Setenforece 0 (configuration file self-modification)
② Turn off Firewalld.
Systemctl Disable Firewalld.service
③ emptying the firewall
Iptables-f
Master Nodes setuppackage Installation
In order to simply get up, you will use Yum to install, of course, you can compile your own, the same effect. There are other Docker warehouses directly installed, many ways to see your environment.
Setup repositories
RPM-UVH http://repos.mesosphere.io/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm
Install
Yum-y Install mesosphere-zookeeperyum-y install Mesos Marathon
Configurationzookeeper
①, first label each machine zookeeper:
Echo 1 >/etc/zookeeper/conf/myid
Note: Each machine in the myID is different and corresponds to the server in the following configuration file. $NUM
Append the following in the /etc/zookeeper/conf/zoo.cfg configuration file:
server.1=172.18.2.94:2888:3888server.2=172.18.2.95:2888:3888server.3=172.18.2.96:2888:3888
Explain the $ip behind this, $PORT 1, $PORT 2
IP does not explain $PORT1 because three for high availability, there must be a master, this port is master, $PORT 2 for them to check each other, see who when the master check.
Then you can restart the Zookeeper service (port 2181)
Systemctl Start Zookeeper
Mesoszookeeper
On each node, you need to configure the address of the zookeeper, as written in/etc/mesos/zk
Zk://172.18.2.94:2181,172.18.2.95:2181,172.18.2.96:2181/mesos
Quorum
I'm not sure if this is a bug, because this official request parameter, 3 master case, this configuration should be 2, but when you set to 2, 3 master will always go to scramble for leader, cause the slave node cannot register, so here we make it 1
Echo 1 >/etc/mesos-master/quorum
Hostname
In this case, we put the hostname master$num into the hosts parsing, and then the respective host name into the file
echo $master >/etc/marathon/conf/hostname
Then the Mesos configuration here is OK, but you have to pay attention to some of his own things to deal with
Systemctl Stop Mesos-slave.servicesystemctl Disable Mesos-slave.service
Then restart Mesos
Systemctl Restart Mesos-slave.service
Marathon
First, create the path to his profile (Yum does not create it for us)
Mkdir-p/etc/marathon/conf
Hostname
Just copy the Mesos directly.
Cp/etc/mesos-master/hostname/etc/marathon/conf
ZooKeeper
Here are 2 points: ① configuration Marathon own ZK, also need to connect Mesos own, because he wants to go to dispatch mission
cp/etc/mesos/zk/etc/marathon/conf/mastercp/etc/marathon/conf/master/etc/marathon/conf/zkvim/etc/marathon/conf/ ZK content: Zk://172.18.2.94:2181,172.18.2.95:2181,172.18.2.96:2181/marathon
Then restart Marathon
Systemctl Restart Marathon.service
Master is OK!
Mesos Access Address:
172.18.2.94:5050
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/5F/wKiom1V6UmXTpy8qAAGKoWKlxcw213.jpg "style=" float: none; "title=" Mesos.png "alt=" Wkiom1v6umxtpy8qaagkowklxcw213.jpg "/>
Marathon Access Address:
172.18.2.94:8080
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6E/5C/wKioL1V6VA3AYXDVAAClv2u2Vf4499.jpg "title=" Marathon.png "style=" Float:none; "alt=" wkiol1v6va3ayxdvaaclv2u2vf4499.jpg "/>
Slave Node setuppackage Installationsetup repositories
RPM-UVH http://repos.mesosphere.io/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm
Install from Package
Yum-y Install Mesos
Configurationmesos
First off, master.
Systemctl Stop Mesos-master.servicesystemctl Disable Mesos-master.service
ZooKeeper
Configure the address of the zookeeper because they said they would register with zookeeper and configure the same MASTER/ETC/MESOS/ZK
Zk://172.18.2.94:2181,172.18.2.95:2181,172.18.2.96:2181/mesos
Hostname
In the same vein, this is/etc/mesos-slave/hostname.
Start Services
Systemctl Restart Mesos-slave.service
Then, go to the Mesos management side to see how the slave is registered.
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6E/60/wKiom1V6U8aBVDdaAAGf9pnpmNU738.jpg "title=" Mesos-slave.png "alt=" Wkiom1v6u8abvddaaagf9pnpmnu738.jpg "/>
starting Services on Mesos and Marathon
Do not do complex demonstrations here, just do the simple.
WEB UI
master1:5050
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/5C/wKioL1V6WoXhZUqGAAD6cHsUyyA319.jpg "style=" float: none; "title=" Create.png "alt=" Wkiol1v6woxhzuqgaad6chsuyya319.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/60/wKiom1V6WN2i7UeBAABOmySsjHI927.jpg "style=" float: none; "title=" Create2.png "alt=" Wkiom1v6wn2i7uebaabomyssjhi927.jpg "/>
Starting a Service through the API
First prepare a JSON file (Hello2.json)
{"id": "Hello2", "cmd": "Echo hello; Sleep "," mem ": +," CPUs ": 0.1," instances ": 1," Disk ": 0.0," ports ": [0]}
Then call the API
Curl-i-H ' content-type:application/json ' [email protected] Master1:8080/v2/apps
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/6E/5C/wKioL1V6Wv2SG-qMAABdQSR9YTw197.jpg "title=" Ccc.png "alt=" Wkiol1v6wv2sg-qmaabdqsr9ytw197.jpg "/>
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/6E/60/wKiom1V6WXjRgILHAALUk1lcMuI281.jpg "title=" Ddd.png "alt=" Wkiom1v6wxjrgilhaaluk1lcmui281.jpg "/>
Here it is, too long has not written, can not find the feeling.
We'll take care of the details here.
This article is from the "Tofu Blog" blog, make sure to keep this source http://407711169.blog.51cto.com/6616996/1661185
Mesosphere Cluster on CentOS7 (Zookeeper+mesos+marathon)