~
~
在节点一上生成密钥,使得两节点间检测心跳信息无须密码
[iyunv@stu21 .ssh]# ssh-keygen -P ''
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
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:
75:cc:d5:7e:f8:ae:d6:c7:7b:36:45:f6:22:a8:06:dc root@node1.stu21.com
The key's randomart image is:
+--[ RSA 2048]----+
| .. |
| o . .|
| . + o |
| . . . =|
| . .S . +o|
| o E . . . +|
| . . . =.|
| o ..B|
| . ..+=|
+-----------------+
[iyunv@stu21 .ssh]#
在 节点1 的 /etc/hosts 下增加 " uname -n " 所显示两个节点的内容
172.16.21.6 node1.stu21.com node1(别名)
172.16.21.10 node2.stu21.com node2(别名)
The authenticity of host 'node2 (172.16.21.10)' can't be established.
RSA key fingerprint is 6a:5a:71:de:61:ca:29:01:c2:7d:8d:6f:06:27:2b:b2.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node2' (RSA) to the list of known hosts.
root@node2's password:
Now try logging into the machine, with "ssh 'root@node2'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
[iyunv@stu21 ~]# cd .ssh/
[iyunv@stu21 .ssh]# ls
authorized_keys id_rsa id_rsa.pub known_hosts
[iyunv@stu21 .ssh]# ssh node2 'date';date
Wed Dec 31 21:38:29 CST 2014
Wed Dec 31 21:38:29 CST 2014
[iyunv@stu21 .ssh]#
[iyunv@stu21 ~]# ssh-keygen -t rsa -P ''
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
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:
fe:fe:67:a7:c2:da:23:a9:91:28:05:4b:06:ea:87:84 root@node2.stu21.com
The key's randomart image is:
+--[ RSA 2048]----+
| . |
|.. . |
|E. + |
|o .o o |
| o .. . S |
| . . o . |
| . . + o |
| . oo.+ o .|
| .o++o=.o |
+-----------------+
[iyunv@stu21 ~]#
The authenticity of host 'node1 (172.16.21.6)' can't be established.
RSA key fingerprint is 6a:5a:71:de:61:ca:29:01:c2:7d:8d:6f:06:27:2b:b2.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'node1,172.16.21.6' (RSA) to the list of known hosts.
root@node1's password:
Permission denied, please try again.
root@node1's password:
Now try logging into the machine, with "ssh 'root@node1'", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
验证下是否能检测对方时间
[iyunv@stu21 ~]# ssh node1 'date' ; date
Wed Dec 31 21:50:55 CST 2014
Wed Dec 31 21:50:55 CST 2014
[iyunv@stu21 ~]#
compression bz2
#
# Confiugre compression threshold
# This value determines the threshold to compress a message,
# e.g. if the threshold is 1, then any message with size greater than 1 KB
# will be compressed, the default is 2 (KB)
compression_threshold 2
---------------------------------------------------------------------------------------------------------------------------------
[iyunv@node1 ~]# openssl rand -hex 6
89b3938df5e8
[iyunv@node1 ~]#
[iyunv@stu21 ha.d]# ls
authkeys ha.cf harc haresources rc.d README.config resource.d shellfuncs
[iyunv@stu21 ha.d]# vim authkeys
[iyunv@stu21 ha.d]# vim haresources
#node1 10.0.0.170 Filesystem::/dev/sda1::/data1::ext2
#
# Regarding the node-names in this file:
#
# They must match the names of the nodes listed in ha.cf, which in turn
# must match the `uname -n` of some node in the cluster. So they aren't
#virtual in any sense of the word.
node1.stu21.com 172.16.21.35/16/eth0/172.16.255.255 httpd(只加这一句)