hadoop、spark、flink集群修改默认ssh端口号
大数据集群在实际搭建过程中,其默认ssh端口不一定都是22,这时需要根据各自的配置文件进行适配。
ssh端口号默认为22,以centos7.x为例,可以在/etc/ssh/sshd_config中进行修改,如下示例将22改为22222:
# If you want to change the port on a SELinux system, you have to tell
# SELinux about this change.
# semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
#
#Port 22
Port 22222
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25555_key
# Ciphers and keying
#RekeyLimit default none
1、 Hadoop集群中适配ssh端口号
HADOOP_HOME=/opt/cloudera/parcels/CDH/lib/hadoop
在${HADOOP_HOME}/etc/hadoop/hadoop-env.sh
文件中,添加:
export HADOOP_SSH_OPTS="-p 22222"
2、 Spark集群中适配ssh端口号
SPARK_HOME=/opt/spark-2.4.0-cdh6.1.0
在${SPARK_HOME}/conf/spark-env.sh
文件中,添加:
export SPARK_SSH_OPTS="-p 22222"
3、 Flink集群中适配ssh端口号
FLINK_HOME=/opt/flink-1.7.2
在${FLINK_HOME}/conf/flink-conf.yaml
文件中,添加:
######## Modify ssh default from 22 to 22222 #########
env.ssh.opts: -p 22222