1、集群准备
环境:阿里云(三台)
查看并关闭防火墙
systemctl status firewalld --查看防火墙 systemctl stop firewalld --关闭 systemctl disable firewalld.service --关闭开机启动
关闭selinux
查看 cat /etc/selinux/config,阿里云默认selinux是关闭状态
否则需要修改 SELINUX=disabled
2、修改主机名
查看主机名
hostname
修改主机名:为cdh01(其他两台 cdh02,cdh03)
vim /etc/hostname
输入:cdh01
查看修改结果:cat /etc/hostname
配置主机映射(三台都需要配置)
vim /etc/hosts
正常,三台都配置为公网即可,阿里云比较特殊:
本机ip要设置为内网ip,其他节点ip设置为外网ip。
否则不知何时就会报错:比如端口占用异常,或监听不到的情况。
172.16.37.31 cdh01 cdh01 --本机为内网ip 47.97.120.25 cdh02 cdh02 --外网ip 118.31.36.223 cdh03 cdh03 --外网ip
三台配置完,reboot 重启即可(不reboot,主机名不会变更)
3、配置免密登录
生成公钥和私钥(一路敲回车就好,随便在哪个路径下都可执行此命令)
ssh-keygen -t rsa
在/root/.ssh会生成两个文件: id_rsa(私钥)、id_rsa.pub(公钥)
将公钥拷贝到要免密登录的目标机器上(包括自己)
ssh-copy-id cdh01 ssh-copy-id cdh02 ssh-copy-id cdh03
拷贝过程中:输入yes,以及root账户密码
尝试登录cdh02等:
ssh cdh02
至此,免密登录已经配置完成



