1. 程式人生 > >DC/OS安裝

DC/OS安裝

marathon welcom list 出現 backend live 2.3 sos linux 7

dc/os: https://dcos.io/

  • 安裝文檔-docker:https://docs.mesosphere.com/1.11/installing/oss/custom/system-requirements/install-docker-centos/
  • 安裝文檔-命令行:https://docs.mesosphere.com/1.11/installing/oss/custom/cli/

坑:

  • 網上介紹的GUI-web方式安裝,在最新版裏已經棄用了,也就是沒有這個參數了。。。只能命令行來裝
  • 阿裏雲centos 7.2以上OS默認安裝的docker不是xfs底層存儲,需要單獨處理(大坑)

其他都很順利

先說下安裝順序,官網上寫的不清楚(這裏以阿裏雲上的ec節點為例):

  1. 確定bootstrap, master, agent這3個角色的機器分別是多少
  2. 去阿裏雲申請機器時,每個節點都多申請一個本地磁盤(後面要把這個本地磁盤掛載為xfs文件系統,並且讓docker使用)
  3. 各個節點全部升級到最新的內核
  4. 格式化以及掛載本地磁盤到/storage下,並且建立軟連接:/var/lib/docker,需要鏈接到/storage
  5. 按照dc/os安裝文檔中一步步安裝

先確定bootstrap, master, agent分別多少節點數

  • bootstrap就1個,不多不少,就1個
  • master:至少1個
  • agent:至少1個

我這阿裏雲的配置:

  • bootstrap
    • 172.31.91.117
  • masters
    • 172.31.91.125
  • agents
    • 172.31.91.124
    • 172.31.91.123

各個節點全部升級到最新的內核:

  按照這個文檔照做,目前只做第一步到第七部,千萬不要做第八步!

  https://docs.mesosphere.com/1.11/installing/oss/custom/system-requirements/install-docker-centos/

格式化以及掛載本地磁盤到/storage下,並且建立軟連接:/var/lib/docker,需要鏈接到/storage:

  執行命令fdisk -l查看當前磁盤設備  

Disk /dev/vda: 42.9 GB, 42949672960 bytes, 83886080 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x0008d73a

   Device Boot      Start         End      Blocks   Id  System
/dev/vda1   *        2048    83884031    41940992   83  Linux

Disk /dev/vdb: 21.5 GB, 21474836480 bytes, 41943040 sectors

  /dev/vda是系統盤,/dev/vdb 才是我們多申請的那個本地磁盤設備,現在要對它進行分區+xfs格式化

[root@izm5e7dqv477rmbrojabgrz ~]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): 

  輸入p:查看主分區列表,剛開始時應該是沒有的

  輸入n:新增分區,都選默認值就好

  完成後,輸入w:寫入磁盤(前面都是內存操作,不會實際影響,直到w為止)

[root@izm5e7dqv477rmbrojabgrz ~]# fdisk /dev/vdb
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p

Disk /dev/vdb: 21.5 GB, 21474836480 bytes, 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x90e789fd

   Device Boot      Start         End      Blocks   Id  System
/dev/vdb1            2048    41943039    20970496   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.

  然後就是用xfs格式化這個分區

mkfs -t xfs -n ftype=1 /dev/vdb1

  然後就是偉大的那步了-掛載/dev/vdb1到/storage:

mkdir /storage
mount /dev/vdb1 /storage

  然後,需要把docker的默認存儲文件路徑變成/storage,一種實現方式就是給/var/lib/docker建立軟鏈接到/storage

ln -sv  /storage/ /var/lib/docker

  技術分享圖片

OK,關鍵一步完成了,剩下的就是回到官方安裝教程,開始安裝docker

https://docs.mesosphere.com/1.11/installing/oss/custom/system-requirements/install-docker-centos/

從第八步開始安裝,安裝完後驗證方式:

[root@izm5e7dqv477rmbrojabgrz lib]# docker info
Containers: 20
 Running: 0
 Paused: 0
 Stopped: 20
Images: 2
Server Version: 1.13.1
Storage Driver: overlay
 Backing Filesystem: xfs
 Supports d_type: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1
runc version: 9df8b306d01f59d3a8029be411de015b7304dd8f
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 3.10.0-862.3.3.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 7.639 GiB
Name: izm5e7dqv477rmbrojabgrz
ID: LA6Q:RHIV:BZCN:4T5S:QXW7:3OWY:ITSQ:GJ23:UA6C:E6CN:X2J4:7X7Y
Docker Root Dir: /storage
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

出現這些字符就代表docker部分完成了,然後安裝(都在bootstrap機器上執行)

https://docs.mesosphere.com/1.11/installing/oss/custom/cli/

我把我這的文件目錄和內容貼出來:

[root@izm5e44dzsuwalzsalz2rkz ~]# tree genconf/
genconf/
├── config.yaml
├── ip-detect
├── ssh_key

 

[root@izm5e44dzsuwalzsalz2rkz genconf]# cat config.yaml 
agent_list:
- 172.31.91.124
- 172.31.91.123
# Use this bootstrap_url value unless you have moved the DC/OS installer assets.
bootstrap_url: file:///opt/dcos_install_tmp
cluster_name: ‘McKayDCOS‘
exhibitor_storage_backend: static
master_discovery: static
ip_detect_filename: genconf/ip-detect
master_list:
- 172.31.91.125
resolvers:
- 8.8.4.4
- 8.8.8.8
ssh_port: 22
ssh_user: root
[root@izm5e44dzsuwalzsalz2rkz genconf]# cat ip-detect 
#!/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)

這裏還要配置下ssh免密登錄(因為bootstrp節點安裝的時候會ssh連接到master, agent節點)  

ssh-keygen -t rsa   會出現讓你輸入密碼,千萬不能寫密碼,都為空
cp ~/.ssh/id_rsa genconf/ssh_key && chmod 0600 genconf/ssh_key         把ssh私鑰key拷貝到安裝目錄下
ssh-copy-id -i 172.31.91.125    傳播公鑰到對方節點,期間會要求輸入root密碼
ssh-copy-id -i 172.31.91.124
ssh-copy-id -i 172.31.91.123

剩下根據安裝文檔進行安裝:

https://docs.mesosphere.com/1.11/installing/oss/custom/cli/  

裝完後,有幾個url:

http://47.104.244.204:8181/exhibitor/v1/ui/index.html zookeeper監控

http://47.104.244.204/#/dashboard?_k=37kze5 marathon界面

http://47.104.244.204/mesos/#/   mesos集群界面

  

  

DC/OS安裝