使用的基础镜像是centos7.2,安装的mesos版本为0.28.2。关于mesos的安装,可以参考之前的安装博客。
docker容器里不能直接用systemctl命令来启动mesos,所以使用mesos-slave的脚本命令来启动。但是在启动时,出现systemd的报错:
Failed to initialize systemd: Failed to locate systemd runtime directory: /run/systemd/system
在网上查找解决方案:在启动时加上如下选项
–no-systemd_enable_support
可以成功的启动命令类似如下:
mesos-slave --master=zk://192.168.0.101:2181,192.168.0.102:2181,192.168.0.103:2181/mesos \
--log_dir=/var/log/mesos \
--executor_registration_timeout=5mins \
--work_dir=/var/lib/mesos \
--launcher=posix \
--no-systemd_enable_support
注意,启动命令里不要跟–containerizers=docker选项,因为他会报如下错误:
Failed to create a containerizer: Could not create DockerContainerizer: Failed to create docker: Failed to find a mounted cgroups hierarchy for the ‘cpu’ subsystem; you probably need to mount cgroups manually