原創哈,上個星期無意間發現了一個可以好東西
DC/OS
https://dcos.io 這個是官網哈
然后就痛苦的折磨了一個多星期;
基本是參照到https://dcos.io/docs/1.7/administration/installing/custom/advanced/ 這個來弄的,中間遇到不少坑
基本的docker 那些自行安裝哈,只寫一些細節上面的東西
mkdir /tmp/dcos && cd /tmp/dcos curl -O https://downloads.dcos.io/dcos/EarlyAccess/dcos_generate_config.sh #這個有點久哈 550M
然后創建對應的目錄:
├── dcos-genconf.14509fe1e7899f4395-3a2b7e03c45cd615da.tar
├── dcos_generate_config.sh
└── genconf
├── config.yaml
└── ip-detect
genconf 這個文件夾的內容我放在github上面了 https://github.com/jackluo2012/dcos-genconf
先看看config.yaml 中的內容:
--- bootstrap_url: http://192.168.1.58:8080 #這個是配置服務器的地址,等會要從這里面下載內容 cluster_name: 'DC/OS' #名稱 exhibitor_storage_backend: static #存儲方式 ip_detect_filename: /genconf/ip-detect #路由檢測,應該是哈 master_list: - 192.168.1.100 #主機地址 resolvers: - 192.168.1.254 #這個是dns - 119.6.6.6 #這個是 oauth_enabled: 'false' #這個是驗證,最好關閉,因為是內網,讀者可以開啟哈, telemetry_enabled: 'false'#這個也是驗證
ip-detect
#!/usr/bin/env bash set -o nounset -o errexit export PATH=/usr/sbin:/usr/bin:$PATH echo $(ip addr show enp0s8 | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1)
然后就是
bash dcos_generate_config.sh #放生全局的配置信息
docker run -d -p 8080:80 --name nginx -v $PWD/genconf/serve:/usr/share/nginx/html:ro index.alauda.cn/library/nginx #這個是放到容器里面了
########這個可以測試一下,可以問題了不,我映射的是8080端口,服務器的地址是 192.168.1.58:8080 這個是主服務器的配置地址
下面來配置 master:
$ ssh root@192.168.1.100 #連接到master上面 $ mkdir /tmp/dcos && cd /tmp/dcos #放到臨時目錄下面哈 $ curl -O http://192.168.1.58:8080/dcos_install.sh #下載剛才的文件
然后就是
[root@localhost dcos]# bash dcos_install.sh master Starting DC/OS Install Process Running preflight checks Checking if DC/OS is already installed: PASS (Not installed) PASS Is SELinux disabled? Checking if docker is installed and in PATH: PASS Checking docker version requirement (>= 1.6): PASS (1.9.1) Checking if curl is installed and in PATH: PASS Checking if bash is installed and in PATH: PASS Checking if ping is installed and in PATH: PASS Checking if tar is installed and in PATH: PASS Checking if xz is installed and in PATH: PASS Checking if unzip is installed and in PATH: PASS Checking if ipset is installed and in PATH: PASS Checking if systemd-notify is installed and in PATH: PASS Checking if systemd is installed and in PATH: PASS Checking systemd version requirement (>= 200): PASS (219) Checking if group 'nogroup' exists: PASS Checking if port 80 (required by mesos-ui) is in use: PASS Checking if port 53 (required by mesos-dns) is in use: PASS Checking if port 15055 (required by dcos-history) is in use: PASS Checking if port 5050 (required by mesos-master) is in use: PASS Checking if port 2181 (required by zookeeper) is in use: PASS Checking if port 8080 (required by marathon) is in use: PASS Checking if port 3888 (required by zookeeper) is in use: PASS Checking if port 8181 (required by exhibitor) is in use: PASS Checking if port 8123 (required by mesos-dns) is in use: PASS Checking Docker is configured with a production storage driver: FAIL (devicemapper, /dev/loop0) Docker is configured to use the devicemapper storage driver with a loopback device behind it. This is highly recommended against by Docker and the community at large for production use[0][1]. See the docker documentation on selecting an alternate storage driver, or use alternate storage than loopback for the devicemapper driver. [0] https://docs.docker.com/engine/userguide/storagedriver/device-mapper-driver/ [1] http://www.projectatomic.io/blog/2015/06/notes-on-fedora-centos-and-docker-storage-drivers/
#上面是做一些環境檢查,如果沒有自行安裝軟件,還有端口檢查,因為我是在虛擬機面裝的,注意上面有一個FAIL,怎么辦呢,動態改了一下shell腳本,把
那個==改成 != ,如果不知道怎么改,留言吧,
294 if [[ "${data_file}" != /dev/loop* ]]; then #在 294行哈
[root@localhost dcos]# bash dcos_install.sh master Starting DC/OS Install Process Running preflight checks Checking if DC/OS is already installed: PASS (Not installed) PASS Is SELinux disabled? Checking if docker is installed and in PATH: PASS Checking docker version requirement (>= 1.6): PASS (1.9.1) Checking if curl is installed and in PATH: PASS Checking if bash is installed and in PATH: PASS Checking if ping is installed and in PATH: PASS Checking if tar is installed and in PATH: PASS Checking if xz is installed and in PATH: PASS Checking if unzip is installed and in PATH: PASS Checking if ipset is installed and in PATH: PASS Checking if systemd-notify is installed and in PATH: PASS Checking if systemd is installed and in PATH: PASS Checking systemd version requirement (>= 200): PASS (219) Checking if group 'nogroup' exists: PASS Checking if port 80 (required by mesos-ui) is in use: PASS Checking if port 53 (required by mesos-dns) is in use: PASS Checking if port 15055 (required by dcos-history) is in use: PASS Checking if port 5050 (required by mesos-master) is in use: PASS Checking if port 2181 (required by zookeeper) is in use: PASS Checking if port 8080 (required by marathon) is in use: PASS Checking if port 3888 (required by zookeeper) is in use: PASS Checking if port 8181 (required by exhibitor) is in use: PASS Checking if port 8123 (required by mesos-dns) is in use: PASS Checking Docker is configured with a production storage driver: PASS (devicemapper /dev/loop0) Creating directories under /etc/mesosphere Creating role file for master Configuring DC/OS Setting and starting DC/OS
這樣應該就安裝好了,可以訪問 http://192.168.1.100/這個了
slave 的略了,唯一下載的時候,就用
sudo bash dcos_install.sh slave
如果有不明白的歡迎留言哈,
