Table of contents
1. Environment construction goals
server | Run role |
---|---|
node1.adeaven.com | namenode、datanode、resourceManager、nodeManager |
node2.adeaven.com | secondary namenode、datanode、nodeManager |
node3.adeaven.com | datanode、nodeManager |
2. Basic environment construction
1. Mapping of hosts on 3 servers
- Modify the host file of node
vim /etc/hosts
2. Turn off the firewall
systemctl stop firewalld # Turn off the firewall and start it automatically next time
systemctl disable firewalld # Disable the firewall and never start
systemctl status firewalld # Check the firewall status
3. Password-free login
node1|node2|node3 are password-free for each other
- Generate public and private keys for ssh password-free login
ssh-keygen # Four carriage returns, done
- Upload the public key to the server [all three need to be set up, otherwise they cannot access each other]
ssh-copy-id node1
ssh-copy-id node2
ssh-copy-id node3
- Test password-free login
node1–》node2, open node1, enter the command ssh node2
enter the command exit, you can launch node2
4. Synchronize system time
yum -y install ntpdate # Install ntpdate
ntpdate ntp4.aliyun.com # Synchronize time, if the execution fails, execute date again
# View the time after synchronization
5. Create a unified working directory for the server
// Software installation path
mkdir -p ./export/server/
// Data storage path
mkdir -p ./export/data/
// Installation package storage path
mkdir -p ./export/software/
6. Install jdk environment
- Upload jdk to node1 /export/software
jdk-8u321-linux-x64.tar.gz is currently using jdk8
- Unzip to /export/server
tar zxvf export/software/jdk-8u321-linux-x64.tar.gz -C export/server
- Configure java environment variables
vim /etc/profile
export JAVA_HOME=export/server/jdk1.8.0_321
export PATH=$PATH:$JAVA_HOME\bin
export CLASSPATH=.$JAVA_HOME\lib\dt.jar:$jJAVA_HOME\bin\tools.jar
source /etc/profile
java -version
- Synchronize the environment to node2 and node3
scp -r /export/server/jdk1.8.0_321 root@node2:/export/server/
scp -r /etc/profile root@node2:/etc/
Synchronization command parsing
scp -r Username of the folder to be synchronized @ip [Host Name]: The location of the target folder
- Check the java version of node2 and node3
java -version
3. Problem handling
- Problem Description
After installing the system, the IP addresses of the three servers were 192.168.88.128, 192.168.88.129, and 192.168.88.130. However, after I restarted vmware several times, the IP addresses of the servers changed, which required me to modify the configuration hostname file. But this does not solve the fundamental problem. The IP will change the next time you restart, so you can't modify the configuration file anymore.
- Solutions
Fixed the IPs of three servers
- Specific steps
step1: Enter the name ifconfig to view the existing network card information
step2: Switch to the root user, modifying the network card information requires root permissions
step3: Modify the network card information according to the network card name in the picture above vi /etc/sysconfig/network-scripts/ifcfg-ens33, In fact, ens33 is the name of the network card.BOOTPROTO=“static”
IPADDR=192.168.88.130
NETMASK=255.255.255.0
GATEWAY=192.168.88.2
step4:Edit the resolv.conf file
vim /etc/resolv.conf
// 增加内容
nameserver 8.8.8.8
nameserver 8.8.4.4
search localdomain
step4: Save and exit
step5: Refresh the network card service network restart
step6: Test the network card, ping www.baidu.com, if it succeeds
3. Write at the end
Next article: I want to learn the cluster environment installation and initial configuration of hadoop