Hadoop单节点部署

修改主机名

Last login: Sun Apr  4 14:57:45 2021 from 10.0.2.1
Authorized only. All activity will be monitored and reported.
[hj@unicom-centos7-shanghai-area0 ~]$ 
[hj@unicom-centos7-shanghai-area0 ~]$ su - root
Password: 
Last login: Sun Apr  4 14:57:51 CST 2021 on pts/0
[root@unicom-centos7-shanghai-area0 ~]# hostnamectl set-hostname  hadoop10-unicom-centos7-shanghai-area0

[root@hadoop10-unicom-centos7-shanghai-area0 ~]# vi /etc/hosts # 修改 hosts 文件,设几个节点作为 Hadoop 集群
10.0.2.10 hadoop10-unicom-centos7-shanghai-area0
...

添加普通用户

不建议直接使用 root 账号进行操作,以最高权限 root 运行的程序权限过大很不安全,应该使用普通账号登陆进来使用。

[root@hadoop10-unicom-centos7-shanghai-area0 ~] useradd xiaoshuai.zhu
[root@hadoop10-unicom-centos7-shanghai-area0 ~] passwd xiaoshuai.zhu
Changing password for user xiaoshuai.zhu.
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.

[root@hadoop10-unicom-centos7-shanghai-area0 ~] vi /etc/sudoers
...
## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
hj    ALL=(ALL)       ALL
xiaoshuai.zhu  ALL=(ALL)       ALL 
...

创建部署目录和存储目录

统一创建两个文件夹:/opt/software、/opt/module,其中 /opt/software 存放软件安装包,/opt/module 软件安装目录。

[root@hadoop10-unicom-centos7-shanghai-area0 ~] mkdir /opt/module /opt/software
[root@hadoop10-unicom-centos7-shanghai-area0 ~] chown xiaoshuai.zhu:xiaoshuai.zhu /opt/module /opt/software

部署JDK和Hadoop

切换到xiaoshuai.zhu普通用户。

[root@hadoop10-unicom-centos7-shanghai-area0 ~] exit
logout

[hj@hadoop10-unicom-centos7-shanghai-area0 ~] su - xiaoshuai.zhu
Password: 

[xiaoshuai.zhu@hadoop10-unicom-centos7-shanghai-area0 ~]$ cd /opt/software/ 
[xiaoshuai.zhu@hadoop10-unicom-centos7-shanghai-area0 ~]$ tar -zxvf jdk-8u181-linux-x64.tar.gz
[xiaoshuai.zhu@hadoop10-unicom-centos7-shanghai-area0 software]$ tar -zxvf hadoop-3.2.2.tar.gz
[xiaoshuai.zhu@hadoop10-unicom-centos7-shanghai-area0 software]$ mv jdk1.8.0_181/ /opt/module/
[xiaoshuai.zhu@hadoop10-unicom-centos7-shanghai-area0 software]$ mv hadoop-3.2.2 /opt/module/
[xiaoshuai.zhu@hadoop10-unicom-centos7-shanghai-area0 software]$ sudo vi /etc/profile
export JAVA_HOME=/opt/module/jdk1.8.0_81
export PATH=$PATH:$JAVA_HOME/bin
export HADOOP_HOME=/opt/module/hadoop-3.2.2
export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
[xiaoshuai.zhu@hadoop10-unicom-centos7-shanghai-area0 software]$ source /etc/profile
[xiaoshuai.zhu@hadoop10-unicom-centos7-shanghai-area0 ~]# java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)
[xiaoshuai.zhu@hadoop10-unicom-centos7-shanghai-area0 ~]# 
[xiaoshuai.zhu@hadoop10-unicom-centos7-shanghai-area0 ~]# hadoop version
Hadoop 3.2.2
Source code repository Unknown -r 7a3bc90b05f257c8ace2f76d74264906f0f7a932
Compiled by hexiaoqiao on 2021-01-03T09:26Z
Compiled with protoc 2.5.0
From source with checksum 5a8f564f46624254b27f6a33126ff4
This command was run using /opt/module/hadoop-3.2.2/share/hadoop/common/hadoop-common-3.2.2.jar
上一篇
下一篇