生产环境实战spark (5)分布式集群 5台设备之间 ssh免密码登录
之前已经在master节点单台设备上配置ssh免密码的登录工作,现在要做的事情是在5台设备之间实现ssh免密码操作。我在整个大数据集群的安装中没有使用一些hadoop的第三方的安装包工具,这里使用笨办法,SSH配置也比较简单,就一台一台的手工安装部署:
1.关闭防火墙(单台设备检查)
2.hosts文件配置(集群节点按脚本分发)
3.ssh配置(单台设备配置)
4.ssh密钥分发(集群节点按脚本分发)
分布式集群 5台设备之间 ssh免密码登录部署步骤:
1.关闭防火墙(单台设备检查)依次检查4台worker
[root@worker01 ~]# service iptables status
Redirecting to /bin/systemctl status iptables.service
iptables.service - IPv4 firewall with iptables
Loaded: loaded (/usr/lib/systemd/system/iptables.service; disabled)
Active: inactive (dead)
2.hosts文件配置(集群节点按脚本分发)
2.1 先配置master节点的 hosts文件:
[root@master ~]# cat /etc/hosts
10.*.*.237 master
10.*.*.238 worker01
10.*.*.239 worker02
10.*.*.240 worker03
10.*.*.241 worker04
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost4.localdomain6
2.2 master节点建立新的目录/usr/local/rhzf_setup_scripts:
[root@master ~]# cd /usr/local
[root@master local]# ls
bin etc games include jdk1.8.0_121 lib lib64 libexec rhzf_spark_setupTools sbin share src
[root@master local]# mkdir rhzf_setup_scripts
[root@master local]# ls
bin etc games include jdk1.8.0_121 lib lib64 libexec rhzf_setup_scripts rhzf_spark_setupTools sbin share src
[root@master local]# cd rhzf_setup_scripts
[root@master rhzf_setup_scripts]# pwd
/usr/local/rhzf_setup_scripts
2.3 master节点建立复制hosts文件的分发脚本rhzf_hosts_scp.sh:
[root@master rhzf_setup_scripts]# vi rhzf_hosts_scp.sh
#!/bin/sh
for i in 238 239 240 241
do
scp -rq /etc/hosts root@10.*.*.$i:/etc/hosts
done
2.4 赋予执行权限,执行脚本rhzf_hosts_scp.sh:这里还没实现ssh免密码登录,因此每次登录都要输入密码
[root@master rhzf_setup_scripts]# ls
rhzf_hosts_scp.sh
[root@master rhzf_setup_scripts]# cat rhzf_hosts_scp.sh
#!/bin/sh
for i in 238 239 240 241
do
scp -rq /etc/hosts root@10.*.*.$i:/etc/hosts
done
[root@master rhzf_setup_scripts]# chmod u+x rhzf_hosts_scp.sh
[root@master rhzf_setup_scripts]# ls
rhzf_hosts_scp.sh
[root@master rhzf_setup_scripts]# ./rhzf_hosts_scp.sh
The authenticity of host '10.*.*.238 (10.*.*.238)' can't be established.
ECDSA key fingerprint is 32:29:30:56:c6:42:13:c6:a9:05:ef:b1:d3:f5:78:c1.
Are you sure you want to continue connecting (yes/no)? yes
root@10.*.*.238's password:
The authenticity of host '10.*.*.239 (10.*.*.239)' can't be established.
ECDSA key fingerprint is fd:b6:e9:0b:41:2f:89:54:d4:59:be:88:9e:3e:a4:a8.
Are you sure you want to continue connecting (yes/no)? yw^H
Please type 'yes' or 'no': yes
root@10.*.*.239's password:
The authenticity of host '10.*.*.240 (10.*.*.240)' can't be established.
ECDSA key fingerprint is 5e:98:23:47:3b:53:c3:05:cc:dd:10:2e:73:19:c0:b5.
Are you sure you want to continue connecting (yes/no)? u^H
Please type 'yes' or 'no': yes
root@10.*.*.240's password:
The authenticity of host '10.*.*.241 (10.*.*.241)' can't be established.
ECDSA key fingerprint is 2f:30:3a:5b:49:a4:9b:35:b8:40:fe:60:3c:7d:25:7f.
Are you sure you want to continue connecting (yes/no)? yes
root@10.*.*.241's password:
[root@master rhzf_setup_scripts]#
2.4 在worker节点上检查,hosts已经复制过去了
[root@worker04 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
[root@worker04 ~]# cat /etc/hosts
10.*.*.237 master
10.*.*.238 worker01
10.*.*.239 worker02
10.*.*.240 worker03
10.*.*.241 worker04
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost4.localdomain6
[root@worker03 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
[root@worker03 ~]# cat /etc/hosts
10.*.*.237 master
10.*.*.238 worker01
10.*.*.239 worker02
10.*.*.240 worker03
10.*.*.241 worker04
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost4.localdomain6
重启各节点
3.ssh配置(worker单台设备配置)
[root@worker01 ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
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:
74:bb:05:13:1e:39:f4:3f:d2:34:e0:83:06:20:6e:5e root@worker01
The key's randomart image is:
+--[ RSA 2048]----+
| . ....+.. |
| . . oo* . |
| o E . B.+ o |
| o . . o + = . |
| . S . o + |
| o . . |
| . |
| |
| |
+-----------------+
[root@worker01 ~]# ls -a
. .. anaconda-ks.cfg .bash_history .bash_logout .bash_profile .bashrc .cache .config .cshrc .dbus .ssh .tcshrc .xauthCbU6ii
[root@worker01 ~]# cd .ssh
[root@worker01 .ssh]# pwd
/root/.ssh
[root@worker01 .ssh]#
[root@worker02 ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
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:
31:c9:46:4c:2f:29:7f:41:87:70:59:42:f6:fc:94:26 root@worker02
The key's randomart image is:
+--[ RSA 2048]----+
| o+o*+o |
| o.Bo= . |
| . O o E + |
| + + . = |
| S . . |
| . |
| |
| |
| |
+-----------------+
[root@worker02 ~]#
[root@worker02 ~]#
[root@worker03 ~]#
[root@worker03 ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
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:
28:3d:4a:5a:0d:64:ab:99:cc:19:21:d4:a1:e7:14:78 root@worker03
The key's randomart image is:
+--[ RSA 2048]----+
|o.+o+ |
| o.E.. |
| .ooo |
| o+* + . |
| B.+ = S |
| + o . |
| . . |
| |
| |
+-----------------+
[root@worker03 ~]# ls -a
. .. anaconda-ks.cfg .bash_logout .bash_profile .bashrc .cache .config .cshrc .dbus .ssh .tcshrc
[root@worker03 ~]# cd .ssh
[root@worker03 .ssh]#
root@worker04 ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
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:
20:d2:ba:b9:77:e0:58:f6:1a:f7:ad:37:3e:26:38:2b root@worker04
The key's randomart image is:
+--[ RSA 2048]----+
| |
| . |
| . o . |
| o . . |
| . S |
| o+ |
| o=.o.. |
| ..Eo=...= |
| ...+.oo*oo |
+-----------------+
[root@worker04 ~]# ls -a
. .. anaconda-ks.cfg .bash_logout .bash_profile .bashrc .cache .config .cshrc .dbus .ssh .tcshrc
[root@worker04 ~]# cd .ssh
[root@worker04 .ssh]#
3.1 在四个wokrer节点上配置密钥,为区分各个节点的密钥,以IP地址的后3位作为ID标识
[root@worker01 ~]# cat /root/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDbL2nfxheZu2/4GHHt05jut8DUc6GHngZgYzw4A2GOXkkKfiPOqdTPN/ICkeFQwdX8LWZuNXyTWy/R2LX0GTkRQtekJSQaepGOVxXbm6R2OrywzqvXlMGk6/Fma3BklKonXJM+FpafFD3ALwFVSKasTPxNJdIySH6nF1s2AdEt1NNl+LrZ2HZ0x8dM9Dkw0isYUToT2SGMEE61SKBfAOr4R5dZhBSl3HJDvn4LfdeIMKpXhgxs4cEYppvss34zu/lNd2KvXI/SSm6zQM8xVf/0Wfn6Ps54w5RE6j6BpK6TT2Ef3+UewHGFaZMeMOlON2liSugC0n6EK44FDNIPy+AP root@worker01
[root@worker01 ~]# cd /root/.ssh
[root@worker01 .ssh]# ls
id_rsa id_rsa.pub
[root@worker01 .ssh]# cat /root/.ssh/id_rsa.pub >>/root/.ssh/authorized_keys.238
[root@worker01 .ssh]# ls
authorized_keys.238 id_rsa id_rsa.pub
[root@worker01 .ssh]# pwd
/root/.ssh
[root@worker01 .ssh]# cat /root/.ssh/authorized_keys.238
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDbL2nfxheZu2/4GHHt05jut8DUc6GHngZgYzw4A2GOXkkKfiPOqdTPN/ICkeFQwdX8LWZuNXyTWy/R2LX0GTkRQtekJSQaepGOVxXbm6R2OrywzqvXlMGk6/Fma3BklKonXJM+FpafFD3ALwFVSKasTPxNJdIySH6nF1s2AdEt1NNl+LrZ2HZ0x8dM9Dkw0isYUToT2SGMEE61SKBfAOr4R5dZhBSl3HJDvn4LfdeIMKpXhgxs4cEYppvss34zu/lNd2KvXI/SSm6zQM8xVf/0Wfn6Ps54w5RE6j6BpK6TT2Ef3+UewHGFaZMeMOlON2liSugC0n6EK44FDNIPy+AP root@worker01
[root@worker01 .ssh]#
第二个worker
[root@worker02 ~]# cat /root/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWoAub4GDSQ727GOmgmFfAC640mqBNiaA2+d99Ib3q2SzQM2yIuCTCAj+9ecw+Kb/p/z9g1tSTMlwxpC4zVh0I7QU3dwGy2ulpePi7kSOFz5n5xr7sHnEM7piGT/tZPj5zu3VW64mFbyk0bhkPPac35KmypFiMtt+Z47cU17dqcf4v3l4Xi7GkBCWFwuL0jTCQqBK5/7e4lYXM8Vidx/M3YIGSVjNeAEgepHKEV2gvPqXeG24QxSlSrfS7oCWbTOxjJs9J3IbOkgw1mGgm8CG6RqB3Ix0KqfogFGcIRYoXvjVyd4p8i24o1Pqfqnphu64LyNzQ5BET4DNyfKNqYO7H root@worker02
[root@worker02 ~]# cd /root/.ssh
[root@worker02 .ssh]# ls
id_rsa id_rsa.pub
[root@worker02 .ssh]# cat /root/.ssh/id_rsa.pub >>/root/.ssh/authorized_keys.239
[root@worker02 .ssh]# ls
authorized_keys.239 id_rsa id_rsa.pub
[root@worker02 .ssh]# cat /root/.ssh/authorized_keys.239
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDWoAub4GDSQ727GOmgmFfAC640mqBNiaA2+d99Ib3q2SzQM2yIuCTCAj+9ecw+Kb/p/z9g1tSTMlwxpC4zVh0I7QU3dwGy2ulpePi7kSOFz5n5xr7sHnEM7piGT/tZPj5zu3VW64mFbyk0bhkPPac35KmypFiMtt+Z47cU17dqcf4v3l4Xi7GkBCWFwuL0jTCQqBK5/7e4lYXM8Vidx/M3YIGSVjNeAEgepHKEV2gvPqXeG24QxSlSrfS7oCWbTOxjJs9J3IbOkgw1mGgm8CG6RqB3Ix0KqfogFGcIRYoXvjVyd4p8i24o1Pqfqnphu64LyNzQ5BET4DNyfKNqYO7H root@worker02
[root@worker02 .ssh]#
第三个
Last login: Tue Apr 18 09:42:36 2017 from 132.150.75.19
[root@worker03 ~]# cat /root/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDW97fhTjy7H9TLuZV8YxDeyghpDIoKW4QvwtJ9gHU3NSQV9HjwSW6me6iMvoAPEWKzPe0rjnhRfVte3nzRBANmc2t1bjP2bhgk9mhA3/nsu9tmVQPl74ttgQV/IPoGLVmfhC+bywFnN689J+R37RiLTXU+FKvZR6EZPdMqc/4Q2+SDN/4JakeaaMXParu8FFoGzreuK2LofYyT6rsv/847Og2lbM+1CN9F7L3+shCw8XT3mUG6YXEbMS68fPdTwh7xlBIUShfSomwhcotUG96T43l7Fo+KcC2d+hNIM+BTUrkIKr9qDjIIpsqZfJ75/dh5BskkpqOTSxgsHQG60YD root@worker03
[root@worker03 ~]# cd /root/.ssh
[root@worker03 .ssh]# ls
id_rsa id_rsa.pub
[root@worker03 .ssh]# cat /root/.ssh/id_rsa.pub >>/root/.ssh/authorized_keys.240
[root@worker03 .ssh]# ls
authorized_keys.240 id_rsa id_rsa.pub
[root@worker03 .ssh]# cat /root/.ssh/authorized_keys.240
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDW97fhTjy7H9TLuZV8YxDeyghpDIoKW4QvwtJ9gHU3NSQV9HjwSW6me6iMvoAPEWKzPe0rjnhRfVte3nzRBANmc2t1bjP2bhgk9mhA3/nsu9tmVQPl74ttgQV/IPoGLVmfhC+bywFnN689J+R37RiLTXU+FKvZR6EZPdMqc/4Q2+SDN/4JakeaaMXParu8FFoGzreuK2LofYyT6rsv/847Og2lbM+1CN9F7L3+shCw8XT3mUG6YXEbMS68fPdTwh7xlBIUShfSomwhcotUG96T43l7Fo+KcC2d+hNIM+BTUrkIKr9qDjIIpsqZfJ75/dh5BskkpqOTSxgsHQG60YD root@worker03
[root@worker03 .ssh]#
第四个
Last login: Tue Apr 18 09:42:54 2017 from 132.150.75.19
[root@worker04 ~]# cat /root/.ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDBl0+BSYYJLipWbGzvJ2EVtGqEdvA8U+xVo1qLnTreAyDpYdy2Os18AFHzvpkIdfu6kOv4btZifE95R0My1IYASuy3X2UkR42BJnhgXdesGokGIp8jLUX+CTXw51DDL+zHkYCLTtbvR5rBFeqmI/hHsJH5VRoNSzVmy4PORihKdH9rR9CJZu4VQwITR98USBoEejhqC4KVcty+Ksx+YkFAXXmX6FsvAxMT0bjWURenew3w/BgGiehdGfpBkBIfw+uLA9koKr0p0tBNAWXkPpIUWCINt/y/kRIz3Daa6NEO+0ykcR1O/ETdPpMcN1siGilE34iJMf2gyQkkbo8S6ALT root@worker04
[root@worker04 ~]# cd /root/.ssh
[root@worker04 .ssh]# ls
id_rsa id_rsa.pub
[root@worker04 .ssh]# cat /root/.ssh/id_rsa.pub >>/root/.ssh/authorized_keys.241
[root@worker04 .ssh]# ls
authorized_keys.241 id_rsa id_rsa.pub
[root@worker04 .ssh]# cat /root/.ssh/authorized_keys.241
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDBl0+BSYYJLipWbGzvJ2EVtGqEdvA8U+xVo1qLnTreAyDpYdy2Os18AFHzvpkIdfu6kOv4btZifE95R0My1IYASuy3X2UkR42BJnhgXdesGokGIp8jLUX+CTXw51DDL+zHkYCLTtbvR5rBFeqmI/hHsJH5VRoNSzVmy4PORihKdH9rR9CJZu4VQwITR98USBoEejhqC4KVcty+Ksx+YkFAXXmX6FsvAxMT0bjWURenew3w/BgGiehdGfpBkBIfw+uLA9koKr0p0tBNAWXkPpIUWCINt/y/kRIz3Daa6NEO+0ykcR1O/ETdPpMcN1siGilE34iJMf2gyQkkbo8S6ALT root@worker04
[root@worker04 .ssh]#
3.2 ,四个节点发送密钥给master ,在master节点上汇总密钥
[root@worker01 .ssh]# scp -rq /root/.ssh/authorized_keys.238
[email protected]:/root/.ssh/authorized_keys.238
The authenticity of host '10.100.100.237 (10.100.100.237)' can't be established.
ECDSA key fingerprint is 05:5b:98:b2:90:46:86:26:7f:9a:fa:0c:80:1d:27:df.
Are you sure you want to continue connecting (yes/no)? yes
[email protected]'s password:
[root@worker01 .ssh]#
[root@worker02 .ssh]#
[root@worker02 .ssh]# scp -rq /root/.ssh/authorized_keys.239
[email protected]:/root/.ssh/authorized_keys.239
The authenticity of host '10.100.100.237 (10.100.100.237)' can't be established.
ECDSA key fingerprint is 05:5b:98:b2:90:46:86:26:7f:9a:fa:0c:80:1d:27:df.
Are you sure you want to continue connecting (yes/no)? yes
[email protected]'s password:
[root@worker02 .ssh]#
[root@worker03 .ssh]#
[root@worker03 .ssh]# scp -rq /root/.ssh/authorized_keys.240
[email protected]:/root/.ssh/authorized_keys.240
The authenticity of host '10.100.100.237 (10.100.100.237)' can't be established.
ECDSA key fingerprint is 05:5b:98:b2:90:46:86:26:7f:9a:fa:0c:80:1d:27:df.
Are you sure you want to continue connecting (yes/no)? yes
[email protected]'s password:
[root@worker03 .ssh]#
[root@worker04 .ssh]#
[root@worker04 .ssh]# scp -rq /root/.ssh/authorized_keys.241
[email protected]:/root/.ssh/authorized_keys.241
The authenticity of host '10.100.100.237 (10.100.100.237)' can't be established.
ECDSA key fingerprint is 05:5b:98:b2:90:46:86:26:7f:9a:fa:0c:80:1d:27:df.
Are you sure you want to continue connecting (yes/no)? yes
[email protected]'s password:
[root@worker04 .ssh]#
在master节点上汇总密钥
[root@master ~]# cd .ssh
[root@master .ssh]# ls
authorized_keys authorized_keys.238 authorized_keys.239 authorized_keys.240 authorized_keys.241 id_rsa id_rsa.pub known_hosts
[root@master .ssh]# pwd
/root/.ssh
[root@master .ssh]# cat /root/.ssh/authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7sK4iOtORldghFrvPd/EeMhhmQCvwfXb/kzBNExc9M/bl+JED1KmEfWcq4/kzyiLXEm8PPgzjUvg08M5ogvI/oVQFU21UD/nqtVIVq9QWEfGDFiSuI4xNOBMpDxf9OqOkXyRy9114Rgqcy7l5Vola0aX32qCaiTTqCazcpQB6aw3HRLbgGQC76F7AVypIl3GjQ/Aj6oQkMrlFmXJ0ta6hfEGHq64G4VWawGrGVOUYjZWQNKFVPgoZNVL9w3VGd3kFbmxg8XpuxEoOSCgDt7lDsRTyvekEq4bpvKD+yioGcue85Q+hL8iyuQQCT8tiVy6SVucsBxMiNuiQ5R2CbQ+n root@master
[root@master .ssh]# cat /root/.ssh/id_rsa.pub >>authorized_keys
[root@master .ssh]# cat /root/.ssh/authorized_keys.238 >>authorized_keys
[root@master .ssh]# cat /root/.ssh/authorized_keys.239 >>authorized_keys
[root@master .ssh]# cat /root/.ssh/authorized_keys.240 >>authorized_keys
[root@master .ssh]# cat /root/.ssh/authorized_keys.241 >>authorized_keys
[root@master .ssh]# cat /root/.ssh/authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7sK4iOtORldghFrvPd/EeMhhmQCvwfXb/kzBNExc9M/bl+JED1KmEfWcq4/kzyiLXEm8PPgzjUvg08M5ogvI/oVQFU21UD/nqtVIVq9QWEfGDFiSuI4xNOBMpDxf9OqOkXyRy9114Rgqcy7l5Vola0aX32qCaiTTqCazcpQB6aw3HRLbgGQC76F7AVypIl3GjQ/Aj6oQkMrlFmXJ0ta6hfEGHq64G4VWawGrGVOUYjZWQNKFVPgoZNVL9w3VGd3kFbmxg8XpuxEoOSCgDt7lDsRTyvekEq4bpvKD+yioGcue85Q+hL8iyuQQCT8tiVy6SVucsBxMiNuiQ5R2CbQ+n root@master
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7sK4iOtORldghFrvPd/EeMhhmQCvwfXb/kzBNExc9M/bl+JED1KmEfWcq4/kzyiLXEm8PPgzjUvg08M5ogvI/oVQFU21UD/nqtVIVq9QWEfGDFiSuI4xNOBMpDxf9OqOkXyRy9114Rgqcy7l5Vola0aX32qCaiTTqCazcpQB6aw3HRLbgGQC76F7AVypIl3GjQ/Aj6oQkMrlFmXJ0ta6hfEGHq64G4VWawGrGVOUYjZWQNKFVPgoZNVL9w3VGd3kFbmxg8XpuxEoOSCgDt7lDsRTyvekEq4bpvKD+yioGcue85Q+hL8iyuQQCT8tiVy6SVucsBxMiNuiQ5R2CbQ+n root@master
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDbL2nfxheZu2/4GHHt05jut8DUc6GHngZgYzw4A2GOXkkKfiPOqdTPN/ICkeFQwdX8LWZuNXyTWy/R2LX0GTkRQtekJSQaepGOVxXbm6R2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xVo1qLnTreAyDpYdy2Os18AFHzvpkIdfu6kOv4btZifE95R0My1IYASuy3X2UkR42BJnhgXdesGokGIp8jLUX+CTXw51DDL+zHkYCLTtbvR5rBFeqmI/hHsJH5VRoNSzVmy4PORihKdH9rR9CJZu4VQwITR98USBoEejhqC4KVcty+Ksx+YkFAXXmX6FsvAxMT0bjWURenew3w/BgGiehdGfpBkBIfw+uLA9koKr0p0tBNAWXkPpIUWCINt/y/kRIz3Daa6NEO+0ykcR1O/ETdPpMcN1siGilE34iJMf2gyQkkbo8S6ALT root@worker04
[root@master .ssh]#
3.3 , 在master节点上汇总密钥,再分发给客户机,编写脚本来实现,这里ssh还需要输入几次密码
[root@master rhzf_setup_scripts]# chmod u+x rhzf_ssh.sh
[root@master rhzf_setup_scripts]# cat rhzf_ssh.sh
#!/bin/sh
for i in 238 239 240 241
do
scp -rq /root/.ssh/authorized_keys root@10.*.*.$i:/root/.ssh/authorized_keys
done
[root@master rhzf_setup_scripts]# ./rhzf_ssh.sh
root@10.*.*.238's password:
root@10.*.*.239's password:
root@10.*.*.240's password:
root@10.*.*.241's password:
[root@master rhzf_setup_scripts]#
3.4,在worker节点上检查一下密钥
[root@worker01 .ssh]# ls
authorized_keys authorized_keys.238 id_rsa id_rsa.pub known_hosts
[root@worker01 .ssh]# cat authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7sK4iOtORldghFrvPd/EeMhhmQCvwfXb/kzBNExc9M/bl+JED1KmEfWcq4/kzyiLXEm8PPgzjUvg08M5ogvI/oVQFU21UD/nqtVIVq9QWEfGDFiSuI4xNOBMpDxf9OqOkXyRy9114Rgqcy7l5Vola0aX32qCaiTTqCazcpQB6aw3HRLbgGQC76F7AVypIl3GjQ/Aj6oQkMrlFmXJ0ta6hfEGHq64G4VWawGrGVOUYjZWQNKFVPgoZNVL9w3VGd3kFbmxg8XpuxEoOSCgDt7lDsRTyvekEq4bpvKD+yioGcue85Q+hL8iyuQQCT8tiVy6SVucsBx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CWbTOxjJs9J3IbOkgw1mGgm8CG6RqB3Ix0KqfogFGcIRYoXvjVyd4p8i24o1Pqfqnphu64LyNzQ5BET4DNyfKNqYO7H root@worker02
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDW97fhTjy7H9TLuZV8YxDeyghpDIoKW4QvwtJ9gHU3NSQV9HjwSW6me6iMvoAPEWKzPe0rjnhRfVte3nzRBANmc2t1bjP2bhgk9mhA3/nsu9tmVQPl74ttgQV/IPoGLVmfhC+bywFnN689J+R37RiLTXU+FKvZR6EZPdMqc/4Q2+SDN/4JakeaaMXParu8FFoGzreuK2LofYyT6rsv/847Og2lbM+1CN9F7L3+shCw8XT3mUG6YXEbMS68fPdTwh7xlBIUShfSomwhcotUG96T43l7Fo+KcC2d+hNIM+BTUrkIKr9qDjIIpsqZfJ75/dh5BskkpqOTSxgsHQG60YD root@worker03
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDBl0+BSYYJLipWbGzvJ2EVtGqEdvA8U+xVo1qLnTreAyDpYdy2Os18AFHzvpkIdfu6kOv4btZifE95R0My1IYASuy3X2UkR42BJnhgXdesGokGIp8jLUX+CTXw51DDL+zHkYCLTtbvR5rBFeqmI/hHsJH5VRoNSzVmy4PORihKdH9rR9CJZu4VQwITR98USBoEejhqC4KVcty+Ksx+YkFAXXmX6FsvAxMT0bjWURenew3w/BgGiehdGfpBkBIfw+uLA9koKr0p0tBNAWXkPpIUWCINt/y/kRIz3Daa6NEO+0ykcR1O/ETdPpMcN1siGilE34iJMf2gyQkkbo8S6ALT root@worker04
[root@worker01 .ssh]#
[root@worker02 .ssh]# ls
authorized_keys authorized_keys.239 id_rsa id_rsa.pub known_hosts
[root@worker02 .ssh]# cat authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7sK4iOtORldghFrvPd/EeMhhmQCvwfXb/kzBNExc9M/bl+JED1KmEfWcq4/kzyiLXEm8PPgzjUvg08M5ogvI/oVQFU21UD/nqtVI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worker04
[root@worker02 .ssh]#
[root@worker03 .ssh]# cat authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7sK4iOtORldghFrvPd/EeMhhmQCvwfXb/kzBNExc9M/bl+JED1KmEfWcq4/kzyiLXEm8PPgzjUvg08M5ogvI/oVQFU21UD/nqtVIVq9QWEfGDFiSuI4xNOBMpDxf9OqOkXyRy9114Rgqcy7l5Vola0aX32qCaiTTqCazcpQB6aw3HRLbgGQC76F7AVypIl3GjQ/Aj6oQkMrlFmXJ0ta6hfEGHq64G4VWawGrGVOUYjZWQNKFVPgoZNVL9w3VGd3kFbmxg8XpuxEoOSCgDt7lDsRTyvekEq4bpvKD+yioGcue85Q+hL8iyuQQCT8tiVy6SVucsBxMiNuiQ5R2CbQ+n root@master
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7sK4iOtORldghFrvPd/EeMhhmQCvwfXb/kzBNExc9M/bl+JED1KmEfWcq4/kzyiLXEm8PPgzjUvg08M5ogvI/oVQFU21UD/nqtVIVq9QWEfGDFiSuI4xNOBMpDxf9OqOkXyRy9114Rgqcy7l5Vola0aX32qCaiTTqCazcpQB6aw3HRLbgGQC76F7AVypIl3GjQ/Aj6oQkMrlFmXJ0ta6hfEGHq64G4VWawGrGVOUYjZWQNKFVPgoZNVL9w3VGd3kFbmxg8XpuxEoOSCgDt7lDsRTyvekEq4bpvKD+yioGcue85Q+hL8iyuQQCT8tiVy6SVucsBxMiNuiQ5R2CbQ+n root@master
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDbL2nfxheZu2/4GHHt05jut8DUc6GHngZgYzw4A2GOXkkKfiPOqdTPN/ICkeFQwdX8LWZuNXyTWy/R2LX0GTkRQtekJSQaepGOVxXbm6R2OrywzqvXlMGk6/Fma3BklKonXJM+FpafFD3ALwFVSKasTPxNJdIySH6nF1s2AdEt1NNl+LrZ2HZ0x8dM9Dkw0isYUToT2SGMEE61SKBfAOr4R5dZhBSl3HJDvn4L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my4PORihKdH9rR9CJZu4VQwITR98USBoEejhqC4KVcty+Ksx+YkFAXXmX6FsvAxMT0bjWURenew3w/BgGiehdGfpBkBIfw+uLA9koKr0p0tBNAWXkPpIUWCINt/y/kRIz3Daa6NEO+0ykcR1O/ETdPpMcN1siGilE34iJMf2gyQkkbo8S6ALT root@worker04
[root@worker03 .ssh]#
[root@worker04 .ssh]# cat authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7sK4iOtORldghFrvPd/EeMhhmQCvwfXb/kzBNExc9M/bl+JED1KmEfWcq4/kzyiLXEm8PPgzjUvg08M5ogvI/oVQFU21UD/nqtVIVq9QWEfGDFiSuI4xNOBMpDxf9OqOkXyRy9114Rgqcy7l5Vola0aX32qCaiTTqCazcpQB6aw3HRLbgGQC76F7AVypIl3GjQ/Aj6oQkMrlFmXJ0ta6hfEGHq64G4VWawGrGVOUYjZWQNKFVPgoZNVL9w3VGd3kFbmxg8XpuxEoOSCgDt7lDsRTyvekEq4bpvKD+yioGcue85Q+hL8iyuQQCT8tiVy6SVucsBxMiNuiQ5R2CbQ+n root@master
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7sK4iOtORldghFrvPd/EeMhhmQCvwfXb/kzBNExc9M/bl+JED1KmEfWcq4/kzyiLXEm8PPgzjUvg08M5ogvI/oVQFU21UD/nqtVIVq9QWEfGDFiSuI4xNOBMpDxf9OqOkXyRy9114Rgqcy7l5Vola0aX32qCaiTTqCazcpQB6aw3HRLbgGQC76F7AVypIl3GjQ/Aj6oQkMrlFmXJ0ta6hfEGHq64G4VWawGrGVOUYjZWQNKFVPgoZNVL9w3VGd3kFbmxg8XpuxEoOSCgDt7lDsRTyvekEq4bpvKD+yioGcue85Q+hL8iyuQQCT8tiVy6SVucsBxMiNuiQ5R2CbQ+n root@master
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDbL2nfxheZu2/4GHHt05jut8DUc6GHngZgYzw4A2GOXkkKfiPOqdTP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C1yc2EAAAADAQABAAABAQDBl0+BSYYJLipWbGzvJ2EVtGqEdvA8U+xVo1qLnTreAyDpYdy2Os18AFHzvpkIdfu6kOv4btZifE95R0My1IYASuy3X2UkR42BJnhgXdesGokGIp8jLUX+CTXw51DDL+zHkYCLTtbvR5rBFeqmI/hHsJH5VRoNSzVmy4PORihKdH9rR9CJZu4VQwITR98USBoEejhqC4KVcty+Ksx+YkFAXXmX6FsvAxMT0bjWURenew3w/BgGiehdGfpBkBIfw+uLA9koKr0p0tBNAWXkPpIUWCINt/y/kRIz3Daa6NEO+0ykcR1O/ETdPpMcN1siGilE34iJMf2gyQkkbo8S6ALT root@worker04
[root@worker04 .ssh]#
3.5,在master ssh 其他worker节点,仍需密码。
[root@master rhzf_setup_scripts]# ssh worker01
The authenticity of host 'worker01 (10.100.100.238)' can't be established.
ECDSA key fingerprint is 32:29:30:56:c6:42:13:c6:a9:05:ef:b1:d3:f5:78:c1.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'worker01' (ECDSA) to the list of known hosts.
Last login: Tue Apr 18 12:08:50 2017 from 132.150.75.19
3.6,还需要改一个地方: StrictHostKeyChecking ask 改成 StrictHostKeyChecking no
[root@worker01 ~]# vi /etc/ssh/ssh_config
# $OpenBSD: ssh_config,v 1.27 2013/05/16 02:00:34 dtucker Exp $
# This is the ssh client system-wide configuration file. See
# ssh_config(5) for more information. This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.
# Configuration data is parsed as follows:
# 1. command line options
# 2. user-specific file
# 3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.
# Site-wide defaults for some commonly used options. For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.
# Host *
# ForwardAgent no
# ForwardX11 no
# RhostsRSAAuthentication no
# RSAAuthentication yes
# PasswordAuthentication yes
# HostbasedAuthentication no
# GSSAPIAuthentication no
# GSSAPIDelegateCredentials no
# GSSAPIKeyExchange no
# GSSAPITrustDNS no
# BatchMode no
# CheckHostIP yes
# AddressFamily any
# ConnectTimeout 0
StrictHostKeyChecking no
# IdentityFile ~/.ssh/identity
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# Port 22
# Protocol 2,1
# Cipher 3des
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
# MACs hmac-md5,hmac-sha1,
[email protected],hmac-ripemd160
# EscapeChar ~
# Tunnel no
# TunnelDevice any:any
# PermitLocalCommand no
# VisualHostKey no
# ProxyCommand ssh -q -W %h:%p gateway.example.com
# RekeyLimit 1G 1h
Host *
GSSAPIAuthentication yes
# If this option is set to yes then remote X11 clients will have full access
# to the original X11 display. As virtually no X11 client supports the untrusted
# mode correctly we set this to yes.
ForwardX11Trusted yes
# Send locale-related environment variables
SendEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
SendEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
SendEnv LC_IDENTIFICATION LC_ALL LANGUAGE
SendEnv XMODIFIERS
"/etc/ssh/ssh_config" 61L, 2125C written
[root@worker01 ~]#
3.7,在wokrer01分发到其他节点。
[root@worker01 ~]#
[root@worker01 ~]# scp -rq /etc/ssh/ssh_config
[email protected]:/etc/ssh/ssh_config
[root@worker01 ~]# scp -rq /etc/ssh/ssh_config
[email protected]:/etc/ssh/ssh_config
[root@worker01 ~]# scp -rq /etc/ssh/ssh_config
[email protected]:/etc/ssh/ssh_config
[root@worker01 ~]#
3.8,再次检查ssh ,sshok了 不用输入密码了
[root@worker04 .ssh]# ssh master
Warning: Permanently added 'master' (ECDSA) to the list of known hosts.
Last login: Tue Apr 18 12:46:03 2017 from worker03
[root@master ~]# ssh worker02
Warning: Permanently added 'worker02' (ECDSA) to the list of known hosts.
Last login: Tue Apr 18 12:00:57 2017 from 132.150.75.19
[root@worker02 ~]#
[root@worker03 .ssh]# ssh master
Warning: Permanently added 'master' (ECDSA) to the list of known hosts.
Last login: Tue Apr 18 12:44:58 2017 from worker01
[root@master ~]#
[root@worker01 ~]# ssh master
Warning: Permanently added 'master' (ECDSA) to the list of known hosts.
Last login: Tue Apr 18 12:08:03 2017 from 132.150.75.19
[root@master ~]# ssh worker03
Warning: Permanently added 'worker03' (ECDSA) to the li