Cloudera Hadoop-大數據集群系統環境配置


            Cloudera Hadoop-大數據集群系統環境配置              

                                      作者:尹正傑

版權聲明:原創作品,謝絕轉載!否則將追究法律責任。

 

 

 

一.CentOS 7.6最小化安裝(系統盤和數據盤分離安裝)

    博主推薦閱讀:
    https://www.cnblogs.com/yinzhengjie/p/10366167.html

 

二.Centos 7.6 雙網卡綁定實現高可用

    博主推薦閱讀:
    https://www.cnblogs.com/yinzhengjie/p/10334705.html

 

三.大數據集群Linux CentOS 7.6 系統調優篇

    博主推薦閱讀:
    https://www.cnblogs.com/yinzhengjie/p/10367447.html
    https://www.cnblogs.com/yinzhengjie2020/articles/12215822.html

 

四.SSH免密碼登錄

 1>.生成秘鑰並配置與本機的免密登錄

[root@node101.yinzhengjie.org.cn ~]# ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
Generating public/private rsa key pair.
Created directory '/root/.ssh'.
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:
SHA256:xeBV/SrCuYaEGpwEkOIIDaS8nRbwJmKLrS8Z1gIFK5E root@node101.yinzhengjie.org.cn
The key's randomart image is:
+---[RSA 2048]----+
|*X      . ....   |
|Eo*    . +    .  |
|X= =    . o    . |
|Bo* +    .      .|
|ooo* . .S. .   . |
|.+..+ . . + . .  |
|oo.  o . . o .   |
|o.  .   . o      |
| ..      .       |
+----[SHA256]-----+
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa

2>.配置node101.yinzhengjie.org.cn節點到其他節點免密登陸

[root@node101.yinzhengjie.org.cn ~]# ssh-copy-id root@node102.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'node102.yinzhengjie.org.cn (172.30.1.102)' can't be established.
ECDSA key fingerprint is SHA256:27/AmYOfma2zzj55dBOv2a3HtynE5iLqEVwNbcUz6CI.
ECDSA key fingerprint is MD5:b2:0f:5c:51:ea:72:64:bd:ba:29:99:48:66:0b:94:2a.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@node102.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@node102.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ssh node102.yinzhengjie.org.cn
Last login: Sun Jun  9 17:47:06 2019
[root@node102.yinzhengjie.org.cn ~]# 
[root@node102.yinzhengjie.org.cn ~]# who
root     pts/0        2019-06-09 18:09 (172.30.1.101)
[root@node102.yinzhengjie.org.cn ~]# 
[root@node102.yinzhengjie.org.cn ~]# logout
Connection to node102.yinzhengjie.org.cn closed.
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ssh-copy-id root@node102.yinzhengjie.org.cn
[root@node101.yinzhengjie.org.cn ~]# ssh-copy-id root@node103.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'node103.yinzhengjie.org.cn (172.30.1.103)' can't be established.
ECDSA key fingerprint is SHA256:27/AmYOfma2zzj55dBOv2a3HtynE5iLqEVwNbcUz6CI.
ECDSA key fingerprint is MD5:b2:0f:5c:51:ea:72:64:bd:ba:29:99:48:66:0b:94:2a.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@node103.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@node103.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ssh node103.yinzhengjie.org.cn
Last login: Sun Jun  9 17:47:28 2019
[root@node103.yinzhengjie.org.cn ~]# 
[root@node103.yinzhengjie.org.cn ~]# logout
Connection to node103.yinzhengjie.org.cn closed.
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ssh-copy-id root@node103.yinzhengjie.org.cn
[root@node101.yinzhengjie.org.cn ~]# ssh-copy-id root@node104.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'node104.yinzhengjie.org.cn (172.30.1.104)' can't be established.
ECDSA key fingerprint is SHA256:27/AmYOfma2zzj55dBOv2a3HtynE5iLqEVwNbcUz6CI.
ECDSA key fingerprint is MD5:b2:0f:5c:51:ea:72:64:bd:ba:29:99:48:66:0b:94:2a.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@node104.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@node104.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ssh node104.yinzhengjie.org.cn
Last login: Sun Jun  9 17:47:57 2019
[root@node104.yinzhengjie.org.cn ~]# 
[root@node104.yinzhengjie.org.cn ~]# who
root     pts/0        2019-06-09 18:11 (172.30.1.101)
[root@node104.yinzhengjie.org.cn ~]# 
[root@node104.yinzhengjie.org.cn ~]# logout
Connection to node104.yinzhengjie.org.cn closed.
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ssh-copy-id root@node104.yinzhengjie.org.cn
[root@node101.yinzhengjie.org.cn ~]# ssh-copy-id root@node105.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@node105.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@node105.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ssh node105.yinzhengjie.org.cn
Last login: Sun Jun  9 18:12:17 2019 from 172.30.1.101
[root@node105.yinzhengjie.org.cn ~]# 
[root@node105.yinzhengjie.org.cn ~]# who
root     pts/0        2019-06-09 18:12 (172.30.1.101)
[root@node105.yinzhengjie.org.cn ~]# 
[root@node105.yinzhengjie.org.cn ~]# logout
Connection to node105.yinzhengjie.org.cn closed.
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ssh-copy-id root@node105.yinzhengjie.org.cn
[root@node101.yinzhengjie.org.cn ~]# ssh-copy-id root@node106.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'node106.yinzhengjie.org.cn (172.30.1.106)' can't be established.
ECDSA key fingerprint is SHA256:27/AmYOfma2zzj55dBOv2a3HtynE5iLqEVwNbcUz6CI.
ECDSA key fingerprint is MD5:b2:0f:5c:51:ea:72:64:bd:ba:29:99:48:66:0b:94:2a.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@node106.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@node106.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ssh node106.yinzhengjie.org.cn
Last login: Sun Jun  9 17:51:26 2019
[root@node106.yinzhengjie.org.cn ~]# 
[root@node106.yinzhengjie.org.cn ~]# who
root     pts/0        2019-06-09 18:13 (172.30.1.101)
[root@node106.yinzhengjie.org.cn ~]# 
[root@node106.yinzhengjie.org.cn ~]# logout
Connection to node106.yinzhengjie.org.cn closed.
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ssh-copy-id root@node106.yinzhengjie.org.cn
[root@node101.yinzhengjie.org.cn ~]# ssh-copy-id root@node107.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'node107.yinzhengjie.org.cn (172.30.1.107)' can't be established.
ECDSA key fingerprint is SHA256:27/AmYOfma2zzj55dBOv2a3HtynE5iLqEVwNbcUz6CI.
ECDSA key fingerprint is MD5:b2:0f:5c:51:ea:72:64:bd:ba:29:99:48:66:0b:94:2a.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@node107.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@node107.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ssh node107.yinzhengjie.org.cn
Last login: Sun Jun  9 17:51:45 2019
[root@node107.yinzhengjie.org.cn ~]# 
[root@node107.yinzhengjie.org.cn ~]# who
root     pts/0        2019-06-09 18:14 (172.30.1.101)
[root@node107.yinzhengjie.org.cn ~]# 
[root@node107.yinzhengjie.org.cn ~]# logout
Connection to node107.yinzhengjie.org.cn closed.
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ssh-copy-id root@node107.yinzhengjie.org.cn
[root@node101.yinzhengjie.org.cn ~]# ssh-copy-id root@node108.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'node108.yinzhengjie.org.cn (172.30.1.108)' can't be established.
ECDSA key fingerprint is SHA256:27/AmYOfma2zzj55dBOv2a3HtynE5iLqEVwNbcUz6CI.
ECDSA key fingerprint is MD5:b2:0f:5c:51:ea:72:64:bd:ba:29:99:48:66:0b:94:2a.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@node108.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@node108.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# who
root     pts/0        2019-06-09 17:59 (172.30.1.1)
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ssh node108.yinzhengjie.org.cn
Last login: Sun Jun  9 17:51:56 2019
[root@node108.yinzhengjie.org.cn ~]# 
[root@node108.yinzhengjie.org.cn ~]# who
root     pts/0        2019-06-09 18:14 (172.30.1.101)
[root@node108.yinzhengjie.org.cn ~]# 
[root@node108.yinzhengjie.org.cn ~]# logout
Connection to node108.yinzhengjie.org.cn closed.
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ssh-copy-id root@node108.yinzhengjie.org.cn

3>.如果配置高可用的話,我們需要備用節點也需要到其它服務器進行免密登錄(比如,我們選擇node105.yinzhengjie.org.cn作為備用節點,則重復以上2個步驟即可)

[root@node105.yinzhengjie.org.cn ~]# ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
Generating public/private rsa key pair.
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:
SHA256:6tSLCrnUHhSj1QsOE8nsnGSurGxB9DToUSLEyGerbEA root@node105.yinzhengjie.org.cn
The key's randomart image is:
+---[RSA 2048]----+
|*=+o             |
|oEB* .           |
|+*O.B .          |
|.o=O + .         |
|=.o o . S        |
|.* +   o         |
|+ = o o .        |
|.+ + + . .       |
|. . o.o .        |
+----[SHA256]-----+
[root@node105.yinzhengjie.org.cn ~]# 
[root@node105.yinzhengjie.org.cn ~]# ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa
[root@node105.yinzhengjie.org.cn ~]# ssh-copy-id root@node101.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'node101.yinzhengjie.org.cn (172.30.1.101)' can't be established.
ECDSA key fingerprint is SHA256:27/AmYOfma2zzj55dBOv2a3HtynE5iLqEVwNbcUz6CI.
ECDSA key fingerprint is MD5:b2:0f:5c:51:ea:72:64:bd:ba:29:99:48:66:0b:94:2a.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@node101.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@node101.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@node105.yinzhengjie.org.cn ~]# 
[root@node105.yinzhengjie.org.cn ~]# ssh-copy-id root@node101.yinzhengjie.org.cn
[root@node105.yinzhengjie.org.cn ~]# ssh-copy-id root@node102.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'node102.yinzhengjie.org.cn (172.30.1.102)' can't be established.
ECDSA key fingerprint is SHA256:27/AmYOfma2zzj55dBOv2a3HtynE5iLqEVwNbcUz6CI.
ECDSA key fingerprint is MD5:b2:0f:5c:51:ea:72:64:bd:ba:29:99:48:66:0b:94:2a.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@node102.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@node102.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@node105.yinzhengjie.org.cn ~]# 
[root@node105.yinzhengjie.org.cn ~]# ssh-copy-id root@node102.yinzhengjie.org.cn
[root@node105.yinzhengjie.org.cn ~]# ssh-copy-id root@node103.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'node103.yinzhengjie.org.cn (172.30.1.103)' can't be established.
ECDSA key fingerprint is SHA256:27/AmYOfma2zzj55dBOv2a3HtynE5iLqEVwNbcUz6CI.
ECDSA key fingerprint is MD5:b2:0f:5c:51:ea:72:64:bd:ba:29:99:48:66:0b:94:2a.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@node103.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@node103.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@node105.yinzhengjie.org.cn ~]# 
[root@node105.yinzhengjie.org.cn ~]# 
[root@node105.yinzhengjie.org.cn ~]# ssh-copy-id root@node103.yinzhengjie.org.cn
[root@node105.yinzhengjie.org.cn ~]# ssh-copy-id root@node104.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'node104.yinzhengjie.org.cn (172.30.1.104)' can't be established.
ECDSA key fingerprint is SHA256:27/AmYOfma2zzj55dBOv2a3HtynE5iLqEVwNbcUz6CI.
ECDSA key fingerprint is MD5:b2:0f:5c:51:ea:72:64:bd:ba:29:99:48:66:0b:94:2a.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@node104.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@node104.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@node105.yinzhengjie.org.cn ~]# 
[root@node105.yinzhengjie.org.cn ~]# ssh-copy-id root@node104.yinzhengjie.org.cn
[root@node105.yinzhengjie.org.cn ~]# ssh-copy-id root@node105.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'node105.yinzhengjie.org.cn (172.30.1.105)' can't be established.
ECDSA key fingerprint is SHA256:27/AmYOfma2zzj55dBOv2a3HtynE5iLqEVwNbcUz6CI.
ECDSA key fingerprint is MD5:b2:0f:5c:51:ea:72:64:bd:ba:29:99:48:66:0b:94:2a.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@node105.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@node105.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@node105.yinzhengjie.org.cn ~]# 
[root@node105.yinzhengjie.org.cn ~]# ssh-copy-id root@node105.yinzhengjie.org.cn
[root@node105.yinzhengjie.org.cn ~]# ssh-copy-id root@node106.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'node106.yinzhengjie.org.cn (172.30.1.106)' can't be established.
ECDSA key fingerprint is SHA256:27/AmYOfma2zzj55dBOv2a3HtynE5iLqEVwNbcUz6CI.
ECDSA key fingerprint is MD5:b2:0f:5c:51:ea:72:64:bd:ba:29:99:48:66:0b:94:2a.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@node106.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@node106.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@node105.yinzhengjie.org.cn ~]# 
[root@node105.yinzhengjie.org.cn ~]# ssh-copy-id root@node106.yinzhengjie.org.cn
[root@node105.yinzhengjie.org.cn ~]# ssh-copy-id root@node107.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'node107.yinzhengjie.org.cn (172.30.1.107)' can't be established.
ECDSA key fingerprint is SHA256:27/AmYOfma2zzj55dBOv2a3HtynE5iLqEVwNbcUz6CI.
ECDSA key fingerprint is MD5:b2:0f:5c:51:ea:72:64:bd:ba:29:99:48:66:0b:94:2a.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@node107.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@node107.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@node105.yinzhengjie.org.cn ~]# 
[root@node105.yinzhengjie.org.cn ~]# ssh-copy-id root@node107.yinzhengjie.org.cn
[root@node105.yinzhengjie.org.cn ~]# ssh-copy-id root@node108.yinzhengjie.org.cn
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host 'node108.yinzhengjie.org.cn (172.30.1.108)' can't be established.
ECDSA key fingerprint is SHA256:27/AmYOfma2zzj55dBOv2a3HtynE5iLqEVwNbcUz6CI.
ECDSA key fingerprint is MD5:b2:0f:5c:51:ea:72:64:bd:ba:29:99:48:66:0b:94:2a.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@node108.yinzhengjie.org.cn's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@node108.yinzhengjie.org.cn'"
and check to make sure that only the key(s) you wanted were added.

[root@node105.yinzhengjie.org.cn ~]# 
[root@node105.yinzhengjie.org.cn ~]# ssh-copy-id root@node108.yinzhengjie.org.cn

 

五.ansible自動化運維工具快速入門使用

1>.安裝anble

    詳情請參考:https://www.cnblogs.com/yinzhengjie/p/10447587.html

2>.使用ansble一鍵安裝集群所需的依賴包(需要注意的時我們在搭建CM時,這些依賴包可能起不到一定的作用,但是在安裝服務時你會發現各種報錯,有的節點能啟動成功,有的節點不能啟動成功那你就得考慮是不是有依賴包沒有安裝)

[root@node101.yinzhengjie.org.cn ~]# grep keepcache /etc/yum.conf
keepcache=0
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# sed -i s'#keepcache=0#keepcache=1#' /etc/yum.conf
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# grep keepcache /etc/yum.conf
keepcache=1
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# sed -i s'#keepcache=0#keepcache=1#' /etc/yum.conf      #咱們可以把依賴包進行本地緩存,然后利用這些依賴包自建私有的自動化運維倉庫
[root@node101.yinzhengjie.org.cn ~]# ansible all -m shell -a 'yum -y install chkconfig python bind-utils psmisc libxslt zlib sqlite cyrus-sasl-plain cyrus-sasl-gssapi fuse fuse-libs redhat-lsb'
[root@node101.yinzhengjie.org.cn ~]# tail -2 /etc/ansible/hosts 
[cdh]
node[101:105].yinzhengjie.org.cn
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ansible cdh -m shell -a 'ln -s /yinzhengjie/softwares/jdk1.8.0_201/bin/jps /usr/local/bin/'
 [WARNING]: Consider using the file module with state=link rather than running 'ln'.  If you need to use command because file is insufficient you can add 'warn: false' to this command task or set 'command_warnings=False' in ansible.cfg to get
rid of this message.

node103.yinzhengjie.org.cn | CHANGED | rc=0 >>


node102.yinzhengjie.org.cn | CHANGED | rc=0 >>


node105.yinzhengjie.org.cn | CHANGED | rc=0 >>


node104.yinzhengjie.org.cn | CHANGED | rc=0 >>


node101.yinzhengjie.org.cn | CHANGED | rc=0 >>


[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ansible cdh -m shell -a 'ln -s /yinzhengjie/softwares/jdk1.8.0_201/bin/jps /usr/local/bin/'
[root@node101.yinzhengjie.org.cn ~]# ansible cdh -m shell -a 'jps'
node101.yinzhengjie.org.cn | CHANGED | rc=0 >>
Jps

node102.yinzhengjie.org.cn | CHANGED | rc=0 >>
Jps

node104.yinzhengjie.org.cn | CHANGED | rc=0 >>
Jps

node105.yinzhengjie.org.cn | CHANGED | rc=0 >>
Jps

node103.yinzhengjie.org.cn | CHANGED | rc=0 >>
Jps

[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ansible cdh -m shell -a 'jps'

 

六.集群時鍾同步(二選一即可)

1>.NTP集群部署

    博主推薦閱讀:
    https://www.cnblogs.com/yinzhengjie/p/9480665.html

2>.chrony集群部署(博主推薦)

  博主推薦閱讀:
    https://www.cnblogs.com/yinzhengjie/p/12292549.html

 

七.MySQL 5.7主從復制

    詳情請參考:https://www.cnblogs.com/yinzhengjie/p/10371899.html

 

八.安裝MySQL Connector

  顧名思義,MySQL Connector就是用來連接MySQL 數據庫的,根據我們的MySQL版本下載對應的連接器即可。我們在安裝CM初始化的時候就會用到它。

  MySQL官方下載地址:https://dev.mysql.com/downloads/connector/j/
[root@node101.yinzhengjie.org.cn ~]# yum -y install wget
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.njupt.edu.cn
 * extras: mirrors.neusoft.edu.cn
 * updates: mirrors.neusoft.edu.cn
base                                                                                                                         | 3.6 kB  00:00:00     
extras                                                                                                                       | 3.4 kB  00:00:00     
updates                                                                                                                      | 3.4 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package wget.x86_64 0:1.14-18.el7_6.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================================
 Package                        Arch                             Version                                    Repository                         Size
====================================================================================================================================================
Installing:
 wget                           x86_64                           1.14-18.el7_6.1                            updates                           547 k

Transaction Summary
====================================================================================================================================================
Install  1 Package

Total download size: 547 k
Installed size: 2.0 M
Downloading packages:
wget-1.14-18.el7_6.1.x86_64.rpm                                                                                              | 547 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : wget-1.14-18.el7_6.1.x86_64                                                                                                      1/1 
  Verifying  : wget-1.14-18.el7_6.1.x86_64                                                                                                      1/1 

Installed:
  wget.x86_64 0:1.14-18.el7_6.1                                                                                                                     

Complete!
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# yum -y install wget                    #安裝Linux下載工具
[root@node101.yinzhengjie.org.cn ~]# wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.47.tar.gz
--2019-06-09 18:31:03--  https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.47.tar.gz
Resolving dev.mysql.com (dev.mysql.com)... 137.254.60.11
Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://cdn.mysql.com//Downloads/Connector-J/mysql-connector-java-5.1.47.tar.gz [following]
--2019-06-09 18:31:04--  https://cdn.mysql.com//Downloads/Connector-J/mysql-connector-java-5.1.47.tar.gz
Resolving cdn.mysql.com (cdn.mysql.com)... 23.35.197.183, 23.35.197.183
Connecting to cdn.mysql.com (cdn.mysql.com)|23.35.197.183|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4452049 (4.2M) [application/x-tar-gz]
Saving to: ‘mysql-connector-java-5.1.47.tar.gz’

100%[==========================================================================================================>] 4,452,049    648KB/s   in 6.6s   

2019-06-09 18:31:13 (656 KB/s) - ‘mysql-connector-java-5.1.47.tar.gz’ saved [4452049/4452049]

[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.47.tar.gz      #下載MySQL連接器
[root@node101.yinzhengjie.org.cn ~]# ll
total 191684
-rw-r--r--. 1 root root      8409 Mar 24 22:46 jce_policy-8.zip
-rw-r--r--. 1 root root 191817140 Mar 24 22:27 jdk-8u201-linux-x64.tar.gz
-rw-r--r--  1 root root   4452049 Aug  7  2018 mysql-connector-java-5.1.47.tar.gz
drwxrwxr-x. 2 root root        24 Jun  9 00:13 UnlimitedJCEPolicyJDK8
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# tar -zxf mysql-connector-java-5.1.47.tar.gz 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ll
total 191684
-rw-r--r--. 1 root root      8409 Mar 24 22:46 jce_policy-8.zip
-rw-r--r--. 1 root root 191817140 Mar 24 22:27 jdk-8u201-linux-x64.tar.gz
drwxr-xr-x  3 root root       178 Aug  7  2018 mysql-connector-java-5.1.47
-rw-r--r--  1 root root   4452049 Aug  7  2018 mysql-connector-java-5.1.47.tar.gz
drwxrwxr-x. 2 root root        24 Jun  9 00:13 UnlimitedJCEPolicyJDK8
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ll mysql-connector-java-5.1.47
total 2448
-rw-r--r-- 1 root root   91845 Aug  7  2018 build.xml
-rw-r--r-- 1 root root  248527 Aug  7  2018 CHANGES
-rw-r--r-- 1 root root   18122 Aug  7  2018 COPYING
-rw-r--r-- 1 root root 1007505 Aug  7  2018 mysql-connector-java-5.1.47-bin.jar
-rw-r--r-- 1 root root 1007502 Aug  7  2018 mysql-connector-java-5.1.47.jar
-rw-r--r-- 1 root root   61407 Aug  7  2018 README
-rw-r--r-- 1 root root   63658 Aug  7  2018 README.txt
drwxr-xr-x 8 root root      79 Aug  7  2018 src
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# tar -zxf mysql-connector-java-5.1.47.tar.gz      #解壓下載后的安裝包
[root@node101.yinzhengjie.org.cn ~]# ll mysql-connector-java-5.1.47
total 2448
-rw-r--r-- 1 root root   91845 Aug  7  2018 build.xml
-rw-r--r-- 1 root root  248527 Aug  7  2018 CHANGES
-rw-r--r-- 1 root root   18122 Aug  7  2018 COPYING
-rw-r--r-- 1 root root 1007505 Aug  7  2018 mysql-connector-java-5.1.47-bin.jar
-rw-r--r-- 1 root root 1007502 Aug  7  2018 mysql-connector-java-5.1.47.jar
-rw-r--r-- 1 root root   61407 Aug  7  2018 README
-rw-r--r-- 1 root root   63658 Aug  7  2018 README.txt
drwxr-xr-x 8 root root      79 Aug  7  2018 src
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# mkdir /usr/share/java && cd /usr/share/java
[root@node101.yinzhengjie.org.cn /usr/share/java]# 
[root@node101.yinzhengjie.org.cn /usr/share/java]# cp ~/mysql-connector-java-5.1.47/mysql-connector-java-5.1.47-bin.jar ./
[root@node101.yinzhengjie.org.cn /usr/share/java]# 
[root@node101.yinzhengjie.org.cn /usr/share/java]# ln -s mysql-connector-java-5.1.47-bin.jar mysql-connector-java.jar 
[root@node101.yinzhengjie.org.cn /usr/share/java]# 
[root@node101.yinzhengjie.org.cn /usr/share/java]# ll
total 984
-rw-r--r-- 1 root root 1007505 Jun  9 18:35 mysql-connector-java-5.1.47-bin.jar
lrwxrwxrwx 1 root root      35 Jun  9 18:35 mysql-connector-java.jar -> mysql-connector-java-5.1.47-bin.jar
[root@node101.yinzhengjie.org.cn /usr/share/java]# 
[root@node101.yinzhengjie.org.cn /usr/share/java]#

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM