In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Three linux servers trust each other
[root@mydb1 ~] # hostname
Mydb1
1. Change the hostname from mydb1 to mydb100
Vi / etc/sysconfig/network
Change the value after HOSTNAME to the hostname you want to set
HOSTNAME=mydb100
2. Add the last three lines to each node
[root@mydb1 ~] # vi / etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.28.100 mydb100
192.168.28.101 mydb101
192.168.28.102 mydb102
3. Generate public and private keys, and each node executes
Execute the command to generate public and private keys under / root/.ssh, that is, the public and private keys are stored in this directory before they take effect.
Cd / root/.ssh
Ssh-keygen is the key generation command-t specifies the key type. The default is rsa, which can be omitted.-f specifies the key file storage file name.
[root@mydb102 .ssh] # ssh-keygen-t dsa-P'- f id_dsa
Generating public/private dsa key pair.
Your identification has been saved in id_dsa.
Your public key has been saved in id_dsa.pub.
The key fingerprint is:
36:77:57:c2:bf:2c:c1:5a:15:84:c4:d7:2f:91:86:00 root@mydb100
The key's randomart image is:
+-[DSA 1024]-+
| | E. ooookeeper. |
| |. + + .o |
|. + oo |
|. Oval. |
| S. . +. |
|. O .o.o. |
|. . O |
|. | |
| | |
+-+
[root@mydb100 .ssh] # ll
Total 16
-rw-r--r-- 1 root root 1806 Aug 10 17:46 authorized_keys
-rw- 1 root root 672 Aug 10 17:13 id_dsa
-rw-r--r-- 1 root root 602 Aug 10 17:13 id_dsa.pub
-rw-r--r-- 1 root root 1570 Aug 10 17:48 known_hosts
4. Add the public key to the authentication file
[root@mydb100 .ssh] # cat id_dsa.pub > > authorized_keys
# as long as it is executed on one node. This is executed on 192.168.28.100
Scp 192.168.28.101:/root/.ssh/id_dsa.pub. / id_dsa.pub.101
Scp 192.168.28.102:/root/.ssh/id_dsa.pub. / id_dsa.pub.102
Cat id_dsa.pub.101 > > / root/.ssh/authorized_keys
Cat id_dsa.pub.102 > > / root/.ssh/authorized_keys
5. Distribute the integrated files to other nodes
Scp authorized_keys 192.168.28.101:/root/.ssh
Scp authorized_keys 192.168.28.102:/root/.ssh
6. Test and verify mutual trust
When testing, you need to enter a password for the first time, and then you don't need to enter a password.
[root@mydb102 .ssh] # ssh mydb100
Last login: Fri Aug 10 17:48:26 2018 from mydb101
[root@mydb100 ~] # ssh mydb101
Last login: Fri Aug 10 17:48:51 2018 from mydb102
[root@mydb101 ~] # ssh mydb102
Last login: Fri Aug 10 17:48:49 2018 from mydb101
[root@mydb102 ~] # ssh 192.168.28.100
Last login: Fri Aug 10 17:48:57 2018 from mydb102
[root@mydb100] # ssh 192.168.28.102
Last login: Fri Aug 10 17:49:10 2018 from mydb101
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.