原创docker dcos 的安装

原创哈,上个星期无意间发现了一个可以好东西

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

如果有不明白的欢迎留言哈,

posted @ 2016-04-25 17:23 jackluo 阅读(...) 评论(...) 编辑 收藏