Docker+Swarm实现负载均衡

修改/etc/hosts

IP地址                主机名
172.25.55.11    xiaozhuang1
172.25.55.12    xiaozhuang2
172.25.55.13    xiaozhuang3

配置ssh免密码登录

##ssh-keygen -t rsa    # 一路回车
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
ef:79:38:51:85:ec:01:6b:62:28:2d:82:01:11:dd:37 root@master
The key's randomart image is:
+--[ RSA 2048]----+
|*+ .      .o .   |
| o. ..E.   .+ .  |
|. . o.o.o o. o   |
|   . o . o  o    |
|        S  .     |
|         ..      |
|          .o     |
|         .o..    |
|          oo     |
+-----------------+
1) 直接使用命令复制公钥
[root@master ~]# ssh-copy-id -i .ssh/id_rsa.pub root@node01
[root@master ~]# ssh-copy-id -i .ssh/id_rsa.pub root@node02

2) 某些情况下需要手动复制,下面以node01节点的操作为例:
[root@xiaozhuang1 ~]# scp .ssh/id_rsa.pub root@node01:/tmp
[root@xiaozhuang1 ~]# mkdir .ssh && chmod 700 .ssh
[root@xiaozhuang1 ~]# cat /tmp/id_rsa.pub >> .ssh/authorized_keys [此文件权限必须为600] 

[root@master ~]# ssh node01
首次执行会提示yes/no确认  之后不再提示!

安装Docker

yum install -y docker-engine-17.03.1.ce-1.el7.centos.x86_64.rpm 
docker-engine-selinux-17.03.1.ce-1.el7.centos.noarch.rpm

systemctl start docker
systemctl restart docker

查看Docker是否安装成功

[root@xiaozhuang1 ~]# docker version
Client:
 Version:      17.03.1-ce
 API version:  1.27
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Fri Mar 24 00:36:45 2017
 OS/Arch:      linux/amd64

Server:
 Version:      17.03.1-ce
 API version:  1.27 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   c6d412e
 Built:        Fri Mar 24
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值