centos7部署PaaS平台环境(mesos+marathon)
假如有5台主机可以使用,ip地址如下
规划(2master+3slave)
master:
192.168.248.205 ---master1
192.168.248.206 ---master2
slave:
192.168.248.207---slave1
192.168.248.208---slave2
192.168.248.209---slave3
配置master节点(master1,master2)
1、关闭防火墙与selinux
systemctl stop firewalld && systemctl disable firewalld
Redhat应用了SELinux去加强平安,永久封闭的举措为:
修改 /etc/selinux/config 文件中的 SELINUX=”” 为 disabled ,然后重启服务器。
2、安装配置jdk,ntp时间同步,hostname主机映射
yum install java-1.8.0-openjdk* -y
3、添加mesos的yum源
sudo rpm -Uvh http://repos.mesosphere.io/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm
4、安装mesos,marathon,zookeeper
yum -y install mesos marathon mesosphere-zookeeper
5、配置zookeeper
(1)#设置文件[/var/lib/zookeeper/myid]为当前mesos-master节点的id,id必须为1-255之中的整数,例如:
master1 #echo 1 > /var/lib/zookeeper/myid
master2 #echo 2 > /var/lib/zookeeper/myid
(2)配置zoo.cfg
#master_node_id为master节点id同该节点[/var/lib/zookeeper/myid]文件的配置,master_node_ip为master节点的ip地址:server.$master_node_id=$master_node_ip:2888:3888
其中第一个端口2888用来集群成员的信息交换,第二个端口3888是在leader挂掉时专门用来进行选举leader所用。
master1 master2
#vim /etc/zookeeper/conf/zoo.cfg
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/var/lib/zookeeper
clientPort=2181
autopurge.snapRetainCount=500
autopurge.purgeInterval=24
server.1=192.168.248.205:2888:3888
server.2=192.168.248.206:2888:3888
server.3=192.168.248.207:2888:3888
server.4=192.168.248.208:2888:3888
server.5=192.168.248.209:2888:3888
(3)修改/etc/mesos/zk文件
#vim /etc/mesos/zk
完全替换原来内容:
zk://192.168.248.205:2181,192.168.248.206:2181,192.168.248.207:2181,192.168.248.208:2181,192.168.248.209:2181/mesos
(4)设置文件[/etc/mesos-master/quorum]内容为一个大于(master节点数除以2)的整数。注意特例,当master节点数目为2时,quorum文件的值为1。
#echo 1 >/etc/mesos-master/quorum
6、配置mesos和marathon
master1
mkdir -p /etc/marathon/conf
echo 192.168.248.205 > /etc/mesos-master/hostname
echo 192.168.248.205 > /etc/marathon/conf/hostname
hostnamectl --static set-hostname paas205
master2
mkdir -p /etc/marathon/conf
echo 192.168.248.206 > /etc/mesos-master/hostname
echo 192.168.248.206 > /etc/marathon/conf/hostname
hostnamectl --static set-hostname paas206
master1 master2
cp /etc/mesos/zk /etc/marathon/conf/master
cp /etc/mesos/zk /etc/marathon/conf/zk
sed -i 's|mesos|marathon|g' /etc/marathon/conf/zk
7、启动mesos,marathon,zookeeper
systemctl start zookeeper && systemctl enable zookeeper && systemctl start mesos-master && systemctl enable mesos-master && systemctl start marathon && systemctl enable marathon && systemctl disable mesos-slave
配置slave节点(slave1 slave2 slave3)
1、关闭防火墙与selinux
systemctl stop firewalld && systemctl disable firewalld
Redhat应用了SELinux去加强平安,永久封闭的举措为:
修改 /etc/selinux/config 文件中的 SELINUX=”” 为 disabled ,然后重启。
2、安装配置jdk,ntp时间同步,hostname主机映射
3、添加mesos的yum源
sudo rpm -Uvh http://repos.mesosphere.io/el/7/noarch/RPMS/mesosphere-el-repo-7-1.noarch.rpm
4、安装mesos,mesosphere-zookeeper
#yum -y install mesos mesosphere-zookeeper
5、配置zookeeper,步骤参考mesos-master。
6、配置mesos-slave信息
slave1
echo 192.168.248.207 > /etc/mesos-slave/hostname
hostnamectl --static set-hostname paas207
slave2
echo 192.168.248.208 > /etc/mesos-slave/hostname
hostnamectl --static set-hostname paas208
slave3
echo 192.168.248.209 > /etc/mesos-slave/hostname
hostnamectl --static set-hostname paas209
7、#vim /etc/mesos/zk
zk://192.168.248.205:2181,192.168.248.206:2181,192.168.248.207:2181,192.168.248.208:2181,192.168.248.209:2181/mesos
8、 可用的容器实现机制
vim /etc/mesos-slave/containerizers
docker,mesos
PS:mesos配置项解析参http://blog.csdn.net/yeasy/article/details/46683297
常用:--work_dir=VALUE framework 的工作目录,默认为 /tmp/mesos
9、启动zookeeper,slave
#systemctl start zookeeper && systemctl enablezookeeper
#systemctl start mesos-slave && systemctl enable mesos-slave
#systemctl disable mesos-master
10、在slave上面安装docker
查看具体服务后台日志信息如mesos-slave:journalctl -f -u mesos-slave
11、mrathon-lb监控界面
ip:9090/haproxy?stats