您好,登錄后才能下訂單哦!
這篇文章主要介紹了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怎么安裝”這篇文章對大家有幫助,同時也希望大家多多支持億速云,關注億速云行業資訊頻道,更多相關知識等著你來學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。