# yum install mesos Python-mesos zookeeper marathon
配置 Mesos 主节点。编辑 /etc/sysconfig/mesos-master 文件并添加以下信息:
1
2
3
MESOS_ip=MESOS_MASTER_IP
MESOS_ZK=zk://localhost:2181/mesos
MESOS_QUORUM=1
如果 mesos-master 的 IP 地址为 192.168.122.31,完整的配置文件如以下代码所示:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# This file contains environment variables that are passed to mesos-master.
# To get a description of all options run mesos-master --help; any option
# supported as a command-line option is also supported as an environment
# variable.
# Some options you're likely to want to set:
MESOS_log_dir=/var/log/mesos
MESOS_work_dir=/var/run/mesos
MESOS_port=5050
# For isolated sandbox testing
#MESOS_ip=127.0.0.1
MESOS_ip=192.168.122.31
MESOS_ZK=zk://localhost:2181/mesos
MESOS_QUORUM=1
运行以下命令来重新启动 ZooKeeper 和 mesos-master 服务:
1
2
# service zookeeper start
# service mesos-master start
打开网络端口。默认情况下,mesos-master 在端口 5050 上通信。在下一节中,将了解如何部署才能不被本地防火墙拦截。如果使用了防火墙,可以运行以下命令来打开一个针对公共区域的 TCP 端口:
1
2
# firewall-cmd --zone=public --add-port=5050/tcp --permanent
# firewall-cmd –reload
在系统上运行 Mesos 集群来配置 Marathon。
1
2
3
4
5
6
7
# cat >/etc/sysconfig/marathon<<EOF
MARATHON_MASTER=zk://localhost:2181/mesos
MARATHON_ZK=zk://localhost:2181/marathon
MARATHON_TASK_LAUNCH_TIMEOUT=600000
MESOS_NATIVE_JAVA_LIBRARY=/usr/lib64/libmesos.so.22
MESOS_NATIVE_LIBRARY=/usr/lib64/libmesos.so.22
EOF
运行以下命令来启动 marathon 服务:
1
# service marathon start
安装和设置 Mesos 从属节点
确保所有 Mesos 从属节点都配置了 Docker 设置。有关在 RHEL LE 上安装和配置 Docker 的更多信息,请参阅 用于 Linux on Power Systems 的 Docker。
运行以下命令来安装需要的包:# yum install mesos python-mesos
配置 Mesos 从属节点。编辑 /etc/sysconfig/mesos-slave 中的 HOSTNAME 变量来指向 Mesos 主节点 IP,然后设置 MESOS_EXECUTOR_REGISTRATION_TIMEOUT 和 MESOS_IP 变量。
例如,如果 mesos-master 的 IP 地址为 192.168.122.31,mesos-slave 的 IP 地址为 192.168.122.48,则配置文件类似于:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# This file contains environment variables that are passed to mesos-slave.
# To get a description of all options run mesos-slave --help; any option
# supported as a command-line option is also supported as an environment
# variable.
# The mesos master URL to contact. Should be host:port for
# non-ZooKeeper based masters, otherwise a zk:// or file:// URL.
MESOS_master=192.168.122.31:5050
MESOS_EXECUTOR_REGISTRATION_TIMEOUT=10mins
MESOS_IP=192.168.122.48
# For isolated sandbox testing
#MESOS_master=127.0.0.1:5050
# For a complete listing of options execute 'mesos-slave --help'
MESOS_log_dir=/var/log/mesos
MESOS_work_dir=/var/run/mesos
MESOS_containerizers=docker,mesos
# systemd cgroup integration
MESOS_isolation='cgroups/cpu,cgroups/mem'
MESOS_cgroups_root='system.slice/mesos-slave.service'
MESOS_cgroups_hierarchy=/sys/fs/cgroup
运行以下命令来重新启动 mesos-slave 服务:
# service mesos-slave restart