Mesos+marathon+zookeeper Docker Management cluster hands-on building examples (environment Centos6.8)

Source: Internet
Author: User
Tags zookeeper centos server

Resources: 3 centos6.8 virtual machines 4cpu 8G memory IP 10.19.54.111-113

1, System requirements and installation environment configuration and shutdown Firewall and SELinux

For full support of the process isolation under Linux A recent kernel >=3.10 is required.

Because I am using the centos6.8, I want to upgrade the kernel (http://www.cnblogs.com/zhangmingcheng/p/6046274.html)

Shutting down the firewall

Shutdown command: Service iptables stop
Permanently shut down the firewall: chkconfig iptables off

Two commands run at the same time, view firewall shutdown status after running complete service iptables status

Turn off SELinux

Redhat has applied selinux to strengthen peace, and the permanent closure measures are:

Modify the Selinux= "" in the/etc/selinux/config file to Disabled, and then restart.

Mesos runs on Linux (+ bit) and Mac OS X (. To build Mesos from source, GCC 4.8.1+ or Clang 3.5+ is required.

Configure according to the official document (http://mesos.apache.org/gettingstarted/)

Note: Each time SSH connects to the server, you need to enter:scl enable devtoolset-2 bash 暂时改变GCC版本

2, these CentOS server time synchronization (NTP time synchronization)

Blog address:http://www.cnblogs.com/zhangmingcheng/p/6047052.html

3. Set hostname to add mappings

Modify The/etc/sysconfig/network configuration file to modify the host name:

Restart machine Required: Shutdown-r now

Modify the/etc/hosts file to add host mappings within the LAN:

4, because to install Marathon, because the Mesos official document installed in the JDK is version 1.7, so we want to replace 1.8:sudo yum install -y java-1.8.0-openjdk-devel

5. Install and install zookeeper on these services

Installation:

wget Http://mirrors.cnnic.cn/apache/zookeeper/zookeeper-3.4.8/zookeeper-3.4.8.tar.gz-P/usr/local/src/tar ZXVF Zookeeper-3.4.8.tar.gz-c/optcd/opt && mv zookeeper-3.4.8 zookeepercd ZOOKEEPERCP conf/zoo_sample.cfg Conf/zoo . cfg

#把zookeeper加入到环境变量

Echo-e "# Append Zk_env\nexport path= $PATH:/opt/zookeeper/bin" >>/etc/profile

Zookeeper Cluster configuration:
Note: When building a zookeeper cluster, you must first stop the zookeeper node that has already been started.

#修改过后的配置文件zoo. CFG, as follows:

Cat Zoo.cfg

ticktime=2000
initlimit=10
Synclimit=5
Datadir=/opt/zookeeper/data
Datalogdir=/opt/zookeeper/logs
clientport=2181
autopurge.snapretaincount=500
Autopurge.purgeinterval=24
server.1=10.19.54.111:2888:3888
server.2=10.19.54.112:2888:3888
server.3=10.19.54.113:2888:3888

#创建相关目录, all three nodes need

Mkdir-p/opt/zookeeper/{logs,data}

#其余zookeeper节点安装完成之后, synchronize the configuration file zoo.cfg.

Create ServerID identity

In addition to modifying the Zoo.cfg configuration file, the Zookeeper cluster mode also configures a myID file, which needs to be placed in the DataDir directory.

One of the data in this file is the value of a (which is a in the server.a=b:c:d in the Zoo.cfg file), and the myID file is created in the DataDir path configured in the Zoo.cfg file.

Create the myID file on the #在110.19.54.111 server and set the value to 1, consistent with the Server.1 in the Zoo.cfg file, as follows

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

Create the myID file on the #在10.19.54.112 server and set the value to 1, consistent with the SERVER.2 in the Zoo.cfg file, as follows

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

Create the myID file on the #在10.19.54.113 server and set the value to 1, consistent with the SERVER.3 in the Zoo.cfg file, as follows

echo "3" >/opt/zookeeper/data/myid
In this connection, the configuration is complete

Start the Zookeeper node above each server
/opt/zookeeper/bin/zkserver.sh start

Ps:zookeeper some common commands:

After you have prepared the appropriate configuration, you can perform the service operation directly through the zkserver.sh script.

    • 1. Start ZK service: SH bin/zkserver.sh start
    • 2. View ZK Service Status: SH bin/zkserver.sh status
    • 3. Stop ZK service: SH bin/zkserver.sh stop
    • 4. Restart ZK Service: SH bin/zkserver.sh restart

The current 113 host is found to be leader through the SH bin/zkserver.sh status command.

6. Install Mesos on these servers

Download Mesos First

$ wget http://www.apache.org/dist/mesos/0.28.2/mesos-0.28.2.tar.gz $ tar -zxf mesos-0.28.2.tar.gz

我都安装在/opt/mesos底下

CD Mesos

mkdir Build

CD Build

.. /configure

Make compilation

Make Check compilation checks

Make install Installation

In the above steps, as long as the environment configuration is wrong (such as the lack of software, or the environment version is too low will lead to failure, such as the GCC version, according to the prompt to resolve the error), because these servers use the agent to connect the network, so I encountered a comparison pit, in make always prompt cannot download. Pom, It was later discovered that it was necessary to configure the settings.xml under/ROOT/.M2

<proxies>
<proxy>
<id>myProxy</id>
<active>true</active>
<protocol>http</protocol>
<port>8080</port>
<username>XXXXX</username>
<password>XXXXX</password>
<nonProxyHosts>*.XXX.com|XXX.org</nonProxyHosts>
</proxy>
</proxies>

Add the above code to the <settings> tag as follows:

1, proxies can configure multiple proxies, but the default first proxy takes effect.

2. True in active indicates that the agent is currently in effect state.

3, HTTP protocol, host address, Port is not repeat.

4, user name password on-demand configuration can be.

5. Nonproxyhost represents an address that does not require proxy access. The middle bar separates multiple addresses, where asterisks are used as wildcard symbols.

7, Configuration Mesos (Master and slave)

First turn on the cgconfig service and set it to start

Service Cgconfig Start
Chkcgconfig on

PS: View Linux-initiated services
Chkconfig--list queries out all currently running services
Chkconfig--list ATD Query The current state of the ATD service

Represents the start state of a service under each runlevel


Run Level 0: System down state
RunLevel 1: Single-User working status
RunLevel 2: Multi-User State (no NFS)
RunLevel 3: Full multiuser State (with NFS), enter console command line mode after login
Run Level 4: System not used, reserved
Run level 5:x11 console, login to GUI mode
Run Level 6: System shuts down and restarts
To view the status of a service: services Cgconfig Status

1, Add, modify the configuration file

After installing the Mesos on the node, the default configuration file is in the/usr/local/etc/mesos directory, only the mesos-deploy-env.sh.template in the first directory, Mesos-master-env.sh.template and mesos-slave-env.sh.template these three template files.  We need to create new masters and slaves files, copy out mesos-deploy-env.sh, mesos-master-env.sh (master copy only) and mesos-based on the original files slave-env.sh (slave copy only) of these three files.

1) Masters and Slaves

These two files are written to the host name or IP running master, and the hostname or IP of the slave run, one per line.

masters:10.19.54.111

slaves:10.19.54.112

10.19.54.113

2) mesos-master-env.sh

This file is related to the configuration of master. The single-point master cluster needs to configure the parameters are: Mesos_log_dir:log output directory, if not set, the default does not produce log, Mesos_worker_dir: The directory that holds the metadata.

3) mesos-slave-env.sh

The file is a slave-related configuration file. Mesos_log_dir:log output of the directory, if not set, the default does not produce Log;mesos_worker_dir: The directory path that holds the framework working directory (default:/tmp/mesos). Mesos_master This parameter is necessary, this is set as the host name of the master node: port.

4) mesos-deploy-env.sh

This file contains the environment variables that the deployment script runs. As long as you copy from the template file, you do not need to add additional parameters.

The relevant parameters of this configuration file are set up. These configuration files need to be copied to each node where the Mesos resides.

Background boot:

Mesos-daemon.sh Mesos-master


mesos-daemon.sh Mesos-slave--master=10.19.54.111:5050

Mesos+marathon+zookeeper Docker Management cluster hands-on building examples (environment Centos6.8)

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.