全部博文(150)
分类: 系统运维
2017-03-27 17:17:49
3台 Dell R610 2*2.4G cpu、32G RAM raid10 500G disk
cobbler 安装 centos7.2 升级到7.3 192.168.1.171 swarm1 192.168.1.172 swarm2 192.168.1.173 swarm3
docker版本: 1.13 存储模式:overlay 本地数据挂载目录:/docker
采用ceph作为存储,所有docker node都挂载 cephfs,关于ceph的安装配置,另外介绍 统一挂载点 /mnt/cephfs
yum remove docker -y yum remove docker-selinux -y yum remove docker-common -y
yum install yum-utils -y
yum-config-manager --add-repo \ engine/installation/linux/repo_files/centos/docker.repo yum -y check-update yum -y install docker-engine
rpm --import vi /etc/yum.repos.d/saltstack.repo 保存下面配置内容 [saltstack-repo] name=SaltStack repo for RHEL/CentOS $releasever baseurl= enabled=1 gpgcheck=1 gpgkey=/SALTSTACK-GPG-KEY.pub yum clean expire-cache yum update yum install -y salt-master #只有master需要安装 yum install -y salt-minion systemctl enable salt-master.service #只有master需要 systemctl enable salt-minion.service systemctl start salt-master systemctl start slat-minion
默认配置
增加本地dns一条 salt的项目 192.168.1.171 salt
salt-key -A
salt '*' test.ping
ssh-keygen 生成公钥和秘钥; 三台id_rsa.pub 生成authorized_keys文件内容
ssm create -s 200g -n docker /docker --fstype xfs -p centos
vi /usr/lib/systemd/system/docker.service [Service] Type=notify 将 ExecStart=/usr/bin/dockerd 替换成 ExecStart=/usr/bin/dockerd --graph=/docker --storage-driver=overlay
systemctl stop docker systemctl daemon-reload systemctl start docker
[root@swarm1 .ssh]# docker swarm init --advertise-addr 192.168.1.171 Swarm initialized: current node (ntn0366tqmhz04214rmcc4896) is now a manager. To add a worker to this swarm, run the following command: docker swarm join \ --token SWMTKN-1-1q6hll9aryxj6cqqfl9xtfuosbk9w6myqb2jgvuyh5e6oxd291-21fuwop90otqxtyb2rb7gv0mr \ 192.168.1.171:2377 To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.
[root@swarm1 ~]# docker swarm join-token manager To add a manager to this swarm, run the following command: docker swarm join \ --token SWMTKN-1-1q6hll9aryxj6cqqfl9xtfuosbk9w6myqb2jgvuyh5e6oxd291-3m6r907ahq8afs4y4wop018je \ 192.168.1.171:2377
[root@swarm2 ~]# docker swarm join \ > --token SWMTKN-1-1q6hll9aryxj6cqqfl9xtfuosbk9w6myqb2jgvuyh5e6oxd291-3m6r907ahq8afs4y4wop018je \ > 192.168.1.171:2377 This node joined a swarm as a manager.
[root@swarm3 ~]# docker swarm join \ > --token SWMTKN-1-1q6hll9aryxj6cqqfl9xtfuosbk9w6myqb2jgvuyh5e6oxd291-3m6r907ahq8afs4y4wop018je \ > 192.168.1.171:2377 This node joined a swarm as a manager.
[root@swarm3 ~]# docker node ls ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS 2m1kjdmptp9lj2rd3wm7zsl8w swarm2 Ready Active Reachable 9l849vnfolhehp951j1c47sh5 * swarm3 Ready Active Reachable ntn0366tqmhz04214rmcc4896 swarm1 Ready Active Leader
docker node demote 0puoe15gsxgu70hrtv79iue07 ## 降级 docker node rm 0puoe15gsxgu70hrtv79iue07 ## 删除 docker swarm join-token manager ## 显示加入集群命令
docker swarm leave --force ## 强制离开集群 docker swarm join --token SWMTKN-1-5s26ikmhftoc15wx2lbo7nhyq0vk4pofyr5iehf453l8qtr5yb-7twhezpnslnhefl54eo68lk35 192.168.1.171:2377 ## 重新加入集群