DC/OSOn-Premises下CLI怎么安装
这篇文章主要介绍了DC/OS On-Premises下CLI怎么安装,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。
让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:域名申请、网页空间、营销软件、网站建设、乌拉特前网站维护、网站推广。
###环境
OS:CentOS 7.2 64bit Kernel:4.3.3 IP: DCOSBootstrap 172.30.250.175 DCOSmaster1 172.30.250.210 DCOSmaster2 172.30.250.211 DCOSmaster3 172.30.250.178 DCOSnode1 172.30.250.18 DCOSnode2 172.30.250.181 DCOSnode3 172.30.250.182
本地平台只支持centos和coreos,其他操作系统不支持,我用的是centos7.2,自己升的4.3.3的内核,默认3.10的内核也可以,需要支持overlay模块的内核。 七台机器分为三种类型:
Bootstrap:用于DC/OS安装 master:运行DC/OS node:运行服务
安装有三种模式,GUI,CLI,高级模式,这里采用在虚拟机上使用CLI方式安装。
#开始安装
##第一步,配置引导节点ssh到所有节点免密码
1.所有节点生成ssh密钥
$ssh-genkey
2.引导节点上执行以下命令,实现可免密码ssh到远程节点
$ssh-copy-id -i ~/.ssh/id_rsa.pub $remote-host $ssh $remote-host
##第二步,引导节点安装docker
1.升级内核,关防火墙,安装依赖包,添加用户组
$sudo yum update $sudo systemctl stop firewalld && sudo systemctl disable firewalld $sudo yum install -y tar xz unzip curl ipset $sudo sed -i s/SELINUX=enforcing/SELINUX=permissive/g /etc/selinux/config $sudo groupadd nogroup
2.生成三个文件,分别是开启overlay,配置SYSTEMD,添加Docker仓库
$ sudo tee /etc/modules-load.d/overlay.conf <<-'EOF' overlay EOF
$ sudo mkdir -p /etc/systemd/system/docker.service.d && sudo tee /etc/systemd/system/docker.service.d/override.conf <<- EOF [Service] ExecStart= ExecStart=/usr/bin/docker daemon --storage-driver=overlay -H fd:// EOF
$ sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' [dockerrepo] name=Docker Repository baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/ enabled=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg EOF
3.重启,查看overlay模块是否已载,显示overlay表示已加载
$ reboot $ lsmod | grep overlay overlay
4.安装docker,启动docker,要确保所有节点上docker都是启动的
$ sudo yum install --assumeyes --tolerant docker-engine $ sudo systemctl start docker $ sudo systemctl enable docker
##第三步,配置引导节点
首先要确保docker是运行的
1.登陆到引导节点~目录下,下载安装文件,创建安装目录,复制密钥到安装目录
$ curl -O https://downloads.dcos.io/dcos/EarlyAccess/dcos_generate_config.sh $ mkdir -p genconf $ cp ~/.ssh/id_rsa genconf/ssh_key && chmod 0600 genconf/ssh_key
安装文件dcos_generate_config.sh
有500多M
2.在genconf目录下创建两个文件 ##genconf/config.yaml 这个文件里写明要安装的所有节点的信息,登陆的用户名密码等:
bootstrap_url: http://183.131.54.102:9001 cluster_name: dcoscluster-name exhibitor_storage_backend: static ip_detect_filename: /genconf/ip-detect master_list: - 172.30.250.211 - 172.30.250.210 - 172.30.250.178 resolvers: - 192.168.250.190 - 114.255.243.230 agent_list: - 172.30.250.181 - 172.30.250.182 - 172.30.250.18 ssh_port: 22 ssh_user: root superuser_password: superuser_username: chenaizhen@qiniu.com
官网的安装指导里resolvers写的是google的DNSservers地址8.8.8.8和8.8.4.4,我这里写的是自己公司的地址。
##genconf/ip-detect 官网的手册上提供了四种ip-detect的方式,下面这种要求主机只能有一个ip,这个文件表示通过节点指定的ip来发现,这个文件执行的结果就是本机的IP。
#!/usr/bin/env bash set -o nounset -o errexit export PATH=/usr/sbin:/usr/bin:$PATH echo $(ip addr show eth0 | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1)
3.定制DC/OS 下面这个命令会根据前面写在genconf里两个文件定制创建DC/OS
$ sudo bash dcos_generate_config.sh --genconf
结束后的文件目录:
4.为DC/OS的所有节点安装Docker,配置SELinux等。可以通过以下命令自动的准备所有节点:
$ sudo bash dcos_generate_config.sh --install-prereqs Running mesosphere/dcos-genconf docker with BUILD_DIR set to /root/genconf ====> EXECUTING INSTALL PREREQUISITES ====> START install_prereqs ====> STAGE install_prereqs ====> STAGE install_prereqs ====> STAGE install_prereqs ====> STAGE install_prereqs ====> STAGE install_prereqs ====> STAGE install_prereqs ====> OUTPUT FOR install_prereqs ====> END install_prereqs with returncode: 0 ====> SUMMARY FOR install_prereqs 6 out of 6 hosts successfully completed install_prereqs stage. ====> END OF SUMMARY FOR install_prereqs
以上命令可加-v参数显示安装过程,可以看到有如下信息:
#/bin/sh # setenforce is in this path PATH=$PATH:/sbin dist=$(cat /etc/*-release | sed -n 's@^ID="\(.*\)"$@\1@p') if ([ x$dist != 'xrhel' ] && [ x$dist != 'xcentos' ]); then echo "$dist is not supported. Only RHEL and CentOS are supported" >&2 exit 0 fi version=$(cat /etc/*-release | sed -n 's@^VERSION_ID="\(.*\)"$@\1@p') if [ $version -lt 7 ]; then echo "$version is not supported. Only >= 7 version is supported" >&2 exit 0 fi sudo setenforce 0 && sudo sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/sysconfig/selinux sudo tee /etc/yum.repos.d/docker.repo <<-'EOF' [dockerrepo] name=Docker Repository baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/ enabled=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg EOF sudo yum -y update sudo mkdir -p /etc/systemd/system/docker.service.d sudo tee /etc/systemd/system/docker.service.d/override.conf <<- EOF [Service] ExecStart= ExecStart=/usr/bin/docker daemon --storage-driver=overlay -H fd:// EOF sudo yum install -y docker-engine sudo systemctl start docker sudo systemctl enable docker sudo yum install -y wget sudo yum install -y git sudo yum install -y unzip sudo yum install -y curl sudo yum install -y xz sudo yum install -y ipset sudo getent group nogroup || sudo groupadd nogroup
5.安装前验证所有节点是可以安装的
$ sudo bash dcos_generate_config.sh --preflight ====> EXECUTING PREFLIGHT ====> START run_preflight ====> STAGE preflight ====> STAGE preflight ====> STAGE preflight ====> STAGE preflight ====> STAGE preflight ====> STAGE preflight_cleanup ====> STAGE preflight_cleanup ====> STAGE preflight_cleanup ====> STAGE preflight_cleanup ====> STAGE preflight_cleanup ====> STAGE preflight ====> STAGE preflight_cleanup ====> OUTPUT FOR run_preflight ====> END run_preflight with returncode: 0 ====> SUMMARY FOR run_preflight 6 out of 6 hosts successfully completed run_preflight stage. ====> END OF SUMMARY FOR run_preflight
6.安装DC/OS到所有节点
¥sudo bash dcos_generate_config.sh --deploy Running mesosphere/dcos-genconf docker with BUILD_DIR set to /root/genconf ====> EXECUTING DC/OS INSTALLATION ====> START install_dcos ====> STAGE deploy ====> STAGE deploy_cleanup ====> STAGE deploy ====> STAGE deploy ====> STAGE deploy_cleanup ====> STAGE deploy_cleanup ====> STAGE deploy ====> STAGE deploy_cleanup ====> STAGE deploy ====> STAGE deploy_cleanup ====> STAGE deploy ====> STAGE deploy_cleanup ====> OUTPUT FOR install_dcos ====> END install_dcos with returncode: 0 ====> SUMMARY FOR install_dcos 6 out of 6 hosts successfully completed install_dcos stage. ====> END OF SUMMARY FOR install_dcos
7.确认服务是否启动正常
Running mesosphere/dcos-genconf docker with BUILD_DIR set to /home/centos/genconf ====> dcos_installer.action_lib.prettyprint:: ====> EXECUTING POSTFLIGHT ====> dcos_installer.action_lib.prettyprint:: ====> START run_postflight ====> dcos_installer.action_lib.prettyprint:: ====> STAGE postflight ====> dcos_installer.action_lib.prettyprint:: ====> STAGE postflight ====> dcos_installer.action_lib.prettyprint:: ====> STAGE postflight_cleanup ====> dcos_installer.action_lib.prettyprint:: ====> STAGE postflight_cleanup ====> dcos_installer.action_lib.prettyprint:: ====> END run_postflight with returncode: 0 ====> dcos_installer.action_lib.prettyprint:: ====> SUMMARY ====> dcos_installer.action_lib.prettyprint:: 6 out of 6 hosts successfully completed run_postflight stage.
##最后,登陆 ###zookeeper的监控管理页面 任意选一个master节点的ip都可以登,地址:http://183.131.54.89:8181/exhibitor/v1/ui/index.html
###DC/OS的登陆页面 任意选一个master节点的ip,如http://183.131.54.89,用户名密码为config.yaml里配置的,登陆后的页面
Tip:183.131.54.89是节点172.30.250.177的外网ip ##端口说明:
port 80 mesos-ui port 53 mesos-dns port 15055 dcos-history port 5050 mesos-master port 2181 zookeeper port 8080 marathon port 3888 zookeeper port 8181 exhibitor port 8123 mesos-dns
感谢你能够认真阅读完这篇文章,希望小编分享的“DC/OS On-Premises下CLI怎么安装”这篇文章对大家有帮助,同时也希望大家多多支持创新互联,关注创新互联行业资讯频道,更多相关知识等着你来学习!
标题名称:DC/OSOn-Premises下CLI怎么安装
文章链接:http://azwzsj.com/article/pchode.html