Mesos&PaaS系列文章之二——Master节点安装

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/tiger435/article/details/49421107

Mesos&Docker技术交流QQ群:491137983,一起学习,共同进步!

Master是整个系统的核心,负责管理接入mesos的各个Framework(由frameworks_manager管理)和slave(由slaves_manager管理),并将slave上的资源按照某种策略分配给Framework(由独立插拔模块Allocator管理)。在本环境中用于构建轻量级PaaS平台的Framework是Marathon,Master节点上主要包括以下功能组件:Mesos-master、Marathon、Zookeeper。

1.组件安装

yum -y install mesos marathon mesosphere-zookeeper

2.配置zookeeper

#master101
echo 1 > /var/lib/zookeeper/myid
#master102
echo 2 > /var/lib/zookeeper/myid
#master103
echo 3 > /var/lib/zookeeper/myid

编辑文件/etc/zookeeper/conf/zoo.cfg,追加以下内容

server.1=192.168.2.71:2888:3888
server.2=192.168.2.72:2888:3888
server.3=192.168.2.73:2888:3888

重启zookeeper服务

systemctl start zookeeper

3.配置mesos

配置mesos使用zookeeper

echo zk://192.168.2.71:2181,192.168.2.72:2181,192.168.2.73:2181/mesos > /etc/mesos/zk
echo 2 > /etc/mesos-master/quorum

配置mesos-master组件的hostname和ip参数
master01

#master101
echo 192.168.2.71 > /etc/mesos-master/hostname
echo 192.168.2.71 > /etc/mesos-master/ip
#master102
echo 192.168.2.72 > /etc/mesos-master/hostname
echo 192.168.2.72 > /etc/mesos-master/ip
#master103
echo 192.168.2.73 > /etc/mesos-master/hostname
echo 192.168.2.73 > /etc/mesos-master/ip

说明:hostname可以不配置,默认使用机器名

停用masrer节点上的mesos-slave服务

systemctl stop mesos-slave.service && systemctl disable mesos-slave.service

重启mesos-master服务

systemctl restart mesos-master.service

4.配置marathon

mkdir -p /etc/marathon/conf

直接复制mesos的hostname文件

cp /etc/mesos-master/hostname /etc/marathon/conf

5.配置marathon使用zookeeper(可选)

默认情况下marathon会自动获取本机的mesos的zk配置,并且会根据zookeeper的配置。为自己添加marathon的配置同步,手动添加以下配置文件是为了便于管理,同样,其他的marathon参数,都可以以参数名称命名一个文件,存放在/etc/marathon/conf目录下,然后在其中设置参数值的形式为marathon作进一步配置
提示:在本例中,默认的marathon启动命令为:

marathon: run_jar --hostname 192.168.2.71 --zk zk://192.168.2.71:2181,192.168.2.72:2181,192.168.2.73:2181/marathon --master zk://192.168.2.71:2181,192.168.2.72:2181,192.168.2.73:2181/mesos

第一步:连接mesos的zookeeper

cp /etc/mesos/zk /etc/marathon/conf/master

第二步:配置marathon使用的zookeeper

echo zk://192.168.2.71:2181,192.168.2.72:2181,192.168.2.73:2181/marathon /etc/marathon/conf/zk

6.启动服务及检测

重启marathon服务

systemctl restart marathon

检查端口监听情况

说明:如果没有lsof命令可以下载安装
yum install -y lsof

zookeeper端口:lsof -i :2181 -n

COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java      2893 root   23u  IPv6  23787      0t0  TCP *:eforward (LISTEN)
java      2893 root   27u  IPv6  25757      0t0  TCP 192.168.2.71:eforward->192.168.2.71:35808 (ESTABLISHED)
java      2893 root   30u  IPv6  24204      0t0  TCP 192.168.2.71:eforward->192.168.2.71:35812 (ESTABLISHED)
java      2893 root   31u  IPv6  25810      0t0  TCP 192.168.2.71:eforward->192.168.2.71:35852 (ESTABLISHED)
java      2893 root   32u  IPv6  25803      0t0  TCP 192.168.2.71:eforward->192.168.2.72:57387 (ESTABLISHED)
java      2957 root   15u  IPv4  25761      0t0  TCP 192.168.2.71:35812->192.168.2.71:eforward (ESTABLISHED)
java      2957 root   31u  IPv6  25157      0t0  TCP 192.168.2.71:35808->192.168.2.71:eforward (ESTABLISHED)
java      2957 root   37u  IPv6  25758      0t0  TCP 192.168.2.71:54372->192.168.2.72:eforward (ESTABLISHED)
mesos-mas 3342 root   17u  IPv4  25809      0t0  TCP 192.168.2.71:35852->192.168.2.71:eforward (ESTABLISHED)
mesos-mas 3342 root   18u  IPv4  26920      0t0  TCP 192.168.2.71:54419->192.168.2.72:eforward (ESTABLISHED)
mesos-mas 3342 root   22u  IPv4  25817      0t0  TCP 192.168.2.71:54420->192.168.2.72:eforward (ESTABLISHED)
mesos-mas 3342 root   23u  IPv4  25816      0t0  TCP 192.168.2.71:54418->192.168.2.72:eforward (ESTABLISHED)

mesos端口:lsof -i :5050 -n

java      2957 root   27u  IPv4  25326      0t0  TCP 192.168.2.71:52901->192.168.2.72:mmcc (ESTABLISHED)
mesos-mas 3342 root    5u  IPv4  24286      0t0  TCP 192.168.2.71:mmcc (LISTEN)
mesos-mas 3342 root   24u  IPv4  26921      0t0  TCP 192.168.2.71:52898->192.168.2.72:mmcc (ESTABLISHED)
mesos-mas 3342 root   25u  IPv4  26967      0t0  TCP 192.168.2.71:60935->192.168.2.73:mmcc (ESTABLISHED)
mesos-mas 3342 root   26u  IPv4  25818      0t0  TCP 192.168.2.71:mmcc->192.168.2.72:45845 (ESTABLISHED)
mesos-mas 3342 root   27u  IPv4  25823      0t0  TCP 192.168.2.71:mmcc->192.168.2.73:51978 (ESTABLISHED)

其他端口

mesos通信端口:lsof -i :2888 -n
mesos选举端口:lsof -i :3888 -n
marathon端口:lsof -i :8080 -n

服务重启命令

systemctl restart zookeeper
systemctl restart mesos-master
systemctl restart marathon

配置开机启动

chkconfig zookeeper on
chkconfig mesos-master on
chkconfig marathon on
展开阅读全文

没有更多推荐了,返回首页