Centos7 install Mesos

The official documentation of Apache Mesos only provides the source installation method. However, I tried several times and always reported an error at some stage. And other methods found through search engines will also encounter some inexplicable errors. So according to the results of my own attempts, I have compiled a simple method.

1. Add yum repository

rpm -Uvh http://repos.mesosphere.io/el/7/noarch/RPMS/mesosphere-el-repo-7-3.noarch.rpm

2. Install zookeeper

yum -y install mesosphere-zookeeper

If there is a ready-made zookeeper, you can use it directly, or you can download the zookeeper from apache yourself.

3. Install mesos

yum -y install mesos

4,docker

yum -y install docker

If you don't use docker as a container, you can not install docker.

5. Start zookeeper

systemctl start zookeeper

Zookeeper installed through yum comes with a default configuration file that can be started directly.

6. Configure the zookeeper address

echo "zk://127.0.0.1:2181/mesos" > /etc/mesos/zk

Used for master to achieve high availability and master-slave interaction

7. Configure the master startup parameters

//master工作路径,存储集群持久化信息的。如果不配,启动会报错。
//安装后已经自动配置为/var/lib/mesos
echo /var/lib/mesos/master > /etc/mesos-master/work_dir
//master集群保持高可用的最少实例数。通常设置为大于master实例数量的大多数且为基数,当前只有一个实例,所以配置为1。
//如果参数registry设置为in_memory,表示集群持久化信息存储在内存中,即standalone模式时,可以不配置,否则无法启动。
//安装后已经自动配置为1
echo 1 > /etc/mesos-master/quorum
//master监听地址,必须配置,否则其他机器无法连通
echo 172.18.21.192 > /etc/mesos-master/ip

8. Start mesos-master

systemctl start mesos-master

9. The browser opens the master address http://192.168.2.151:5050, and you can see the mesos web page

10. Configure slave startup parameters

//slave支持的容器类型,可选mesos(基于LXC实现的资源隔离)和docker(需安装docker),默认mesos
echo docker,mesos > /etc/mesos-slave/containerizers
//slave的工作目录,用于executor保存sandboxe和故障转移检查点    
//安装后已经自动配置为/var/lib/mesos                                                            
echo /var/lib/mesos > /etc/mesos-slave/work_dir 

11. Start mesos-slave

systemctl start  mesos-slave 

12. At this point, you can click Agents on the mesos web page, and you can see that mesos has discovered the slave. The name of the new version has been changed from slave to agent, but the command name has not changed, I don't know why.

The installation is complete.

A few additions:

1. If docker container support is configured, dokcer must be installed, otherwise slave startup will report an error.

2. If zookeeper is a cluster, you need to configure the zk address as:

echo "zk://192.168.2.151:2181,192.168.2.152:2181,192.168.2.153:2181/mesos" > /etc/mesos/zk

3. To build a master cluster, you only need to configure each master node with the same zookeeper address, and set the quorum to the corresponding value. If there are three master nodes, you need to execute on each machine:

echo 2 > /etc/mesos-master/quorum

4. I have encountered that the master keeps reporting that the slave is lost. It is guessed that it may be related to the mesos version or the network configuration of the operating system. Configure the slave listening address to solve the problem:

echo 192.168.2.151 > /etc/mesos-master/ip 

5. In some operating systems, using systemctl to start the slave may report an error, you can use the command to start it directly. Parameters can be viewed by executing mesos-slave --help, and the same is true for master:

mesos-slave --master=zk://127.0.0.1:5050/mesos  --log_dir=/var/log/mesos --containerizers=docker,mesos --work_dir=/etc/mesos-slave/work_dir

6. In fact, the systemctl command is used to start the service, which is to read the configuration file through the /usr/bin/mesos-init-wrapper script, and finally call the mesos-master or mesos-slave command to start. For details, you can view the content of the script.

7. If the slave cannot be started, you can try to execute rm -f /var/lib/mesos/meta/slaves/latest to solve it.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325463865&siteId=291194637