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]#

 

posted @ 2019-06-13 20:36  尹正杰  阅读(725)  评论(0编辑  收藏  举报