千家信息网

DC/OS On-Premises下CLI怎么安装

发表于:2024-11-28 作者:千家信息网编辑
千家信息网最后更新 2024年11月28日,这篇文章主要介绍了DC/OS On-Premises下CLI怎么安装,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。###环境OS:Ce
千家信息网最后更新 2024年11月28日DC/OS On-Premises下CLI怎么安装

这篇文章主要介绍了DC/OS On-Premises下CLI怎么安装,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

###环境

OS:CentOS 7.2 64bit         Kernel:4.3.3IP:     DCOSBootstrap           172.30.250.175  DCOSmaster1                     172.30.250.210  DCOSmaster2                     172.30.250.211  DCOSmaster3                     172.30.250.178DCOSnode1                       172.30.250.18   DCOSnode2                       172.30.250.181DCOSnode3                       172.30.250.182

本地平台只支持centos和coreos,其他操作系统不支持,我用的是centos7.2,自己升的4.3.3的内核,默认3.10的内核也可以,需要支持overlay模块的内核。 七台机器分为三种类型:

Bootstrap:用于DC/OS安装master:运行DC/OSnode:运行服务

安装有三种模式,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'overlayEOF
$ 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 Repositorybaseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/enabled=1gpgcheck=1gpgkey=https://yum.dockerproject.org/gpgEOF

3.重启,查看overlay模块是否已载,显示overlay表示已加载

$ reboot$ lsmod | grep overlayoverlay

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:9001cluster_name: dcoscluster-nameexhibitor_storage_backend: staticip_detect_filename: /genconf/ip-detectmaster_list:- 172.30.250.211- 172.30.250.210- 172.30.250.178resolvers:- 192.168.250.190- 114.255.243.230agent_list:- 172.30.250.181- 172.30.250.182- 172.30.250.18ssh_port: 22ssh_user: rootsuperuser_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 bashset -o nounset -o errexitexport PATH=/usr/sbin:/usr/bin:$PATHecho $(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-prereqsRunning 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_prereqs6 out of 6 hosts successfully completed install_prereqs stage.====> END OF SUMMARY FOR install_prereqs

以上命令可加-v参数显示安装过程,可以看到有如下信息:

#/bin/sh# setenforce is in this pathPATH=$PATH:/sbindist=$(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 0fiversion=$(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 0fisudo setenforce 0 && sudo sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/sysconfig/selinuxsudo tee /etc/yum.repos.d/docker.repo <<-'EOF'[dockerrepo]name=Docker Repositorybaseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/enabled=1gpgcheck=1gpgkey=https://yum.dockerproject.org/gpgEOFsudo yum -y updatesudo mkdir -p /etc/systemd/system/docker.service.dsudo tee /etc/systemd/system/docker.service.d/override.conf <<- EOF[Service]ExecStart=ExecStart=/usr/bin/docker daemon --storage-driver=overlay -H fd://EOFsudo yum install -y docker-enginesudo systemctl start dockersudo systemctl enable dockersudo yum install -y wgetsudo yum install -y gitsudo yum install -y unzipsudo yum install -y curlsudo yum install -y xzsudo yum install -y ipsetsudo 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_preflight6 out of 6 hosts successfully completed run_preflight stage.====> END OF SUMMARY FOR run_preflight

6.安装DC/OS到所有节点

¥sudo bash dcos_generate_config.sh --deployRunning 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_dcos6 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-uiport 53  mesos-dnsport 15055 dcos-historyport 5050 mesos-master port 2181 zookeeperport 8080 marathonport 3888 zookeeper port 8181 exhibitorport 8123 mesos-dns

感谢你能够认真阅读完这篇文章,希望小编分享的"DC/OS On-Premises下CLI怎么安装"这篇文章对大家有帮助,同时也希望大家多多支持,关注行业资讯频道,更多相关知识等着你来学习!

0