在Linux上配置Hadoop网络涉及多个步骤,以下是详细的配置过程:
ip address show hostnamectl set-hostname master /etc/hosts 文件,将IP地址和主机名映射添加到文件中。/etc/sysconfig/network-scripts/ifcfg-eth0 文件,设置静态IP地址、子网掩码和网关。TYPE=Ethernet BOOTPROTO=static IPADDR=192.168.1.100 NETMASK=255.255.255.0 GATEWAY=192.168.1.1 DNS1=8.8.8.8 DNS2=8.8.4.4 ONBOOT=yes service network restart ssh-keygen -t rsa ~/.ssh/authorized_keys 文件中:ssh-copy-id user@node2 ssh-copy-id user@node3 <configuration> <property> <name>fs.defaultFS</name> <value>hdfs://namenode:9000</value> </property> </configuration> <configuration> <property> <name>dfs.replication</name> <value>3</value> </property> <property> <name>dfs.namenode.name.dir</name> <value>/path/to/namenode/data</value> </property> </configuration> <configuration> <property> <name>mapreduce.framework.name</name> <value>yarn</value> </property> </configuration> <configuration> <property> <name>yarn.resourcemanager.hostname</name> <value>ResourceManager</value> </property> <property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value> </property> </configuration> /etc/profile 或 ~/.bashrc 文件,添加Hadoop和Java的环境变量。export JAVA_HOME=/path/to/jdk export HADOOP_HOME=/path/to/hadoop export PATH=$PATH:$HADOOP_HOME/bin source /etc/profile sudo systemctl stop firewalld sudo systemctl disable firewalld sudo vi /etc/selinux/config 将 SELINUX=enforcing 修改为 SELINUX=disabled ,然后保存并退出。 hdfs namenode -format start-dfs.sh start-yarn.sh