参考:https://zhuanlan.zhihu.com/p/116394945
ip | hostanem | 配置 | 服务 |
---|---|---|---|
192.168.109.151 | node1 | 2c8g | master |
192.168.109.152 | node2 | 2c4g | |
192.168.109.153 | node3 | 2c4g | |
三台机器都要
对于linux用户来讲,普通用户的权限是有一定限制的,所以在有些操作的时候,是需要sudo权限的,那么如何在linux下赋予普通用户sudo权限呢?此处将讲解一下方法。
在login我们的系统后,如果是普通用户,我们可以使用su - root来切换到root用户下进行操作,在root用户下,命令行输入 visudo回车即可进入/etc/sudoers下,找到
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
在这个下面添加如下即可
liucf ALL=(ALL) ALL
然后保存退出,再次切换到普通用户下,执行sudo命令就可以看到相应的信息了
3台都要
3台都要
① 查看系统是否自带JDK
[liucf@node1 ~]$ java -version
openjdk version "1.8.0_262"
OpenJDK Runtime Environment (build 1.8.0_262-b10)
OpenJDK 64-Bit Server VM (build 25.262-b10, mixed mode)
[liucf@node1 ~]$ rpm -qa | grep java
java-1.8.0-openjdk-1.8.0.262.b10-1.el7.x86_64
javapackages-tools-3.4.1-11.el7.noarch
tzdata-java-2020a-1.el7.noarch
python-javapackages-3.4.1-11.el7.noarch
java-1.8.0-openjdk-headless-1.8.0.262.b10-1.el7.x86_64
[liucf@node1 ~]$
② 删除自带jdk
然后将上一步中带openjdk的文件全部删除,具体根据你安装的版本不同,文件也不尽相同,这里以上一步中的文件为例。
[liucf@node2 ~]$ sudo rpm -e --nodeps java-1.8.0-openjdk-1.8.0.262.b10-1.el7.x86_64
[liucf@node2 ~]$ sudo rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.262.b10-1.el7.x86_64
[liucf@node2 ~]$ java -version
-bash: /usr/bin/java: No such file or directory
[liucf@node2 ~]$
[liucf@node1 soft]$ tar -zxvf jdk-8u121-linux-x64.tar.gz -C /home/liucf/soft
[liucf@node1 jdk1.8.0_121]$ sudo vim /etc/profile
[liucf@node1 jdk1.8.0_121]$ source /etc/profile
[liucf@node1 jdk1.8.0_121]$ java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
[liucf@node1 jdk1.8.0_121]$
CentOS7 默认使用RSA加密算法生成密钥对,保存在~/.ssh目录下的id_rsa(私钥)和id_rsa.pub(公钥)。也可以使用“-t DSA”参数指定为DSA算法,对应文件为id_dsa和id_dsa.pub,密钥对生成过程会提示输入私钥加密密码,可以直接回车不使用密码保护。
分发秘钥到各个机器,注意本机也分发一份
[liucf@node2 ~]$ ssh-copy-id -i node1
[liucf@node2 ~]$ ssh-copy-id -i node2
[liucf@node2 ~]$ ssh-copy-id -i node3
sudo systemctl stop firewalld
sudo systemctl disable firewalld
sudo vim /etc/selinux/config
SELINUX=enforcing --> SELINUX=disabled
参照:https://blog.csdn.net/m0_37813354/article/details/105118147
里的 3.4 配置ntp
下载:https://www.apache.org/dyn/closer.cgi/hadoop/common/hadoop-3.2.2/hadoop-3.2.2.tar.gz
[liucf@node1 softfile]$ tar -zxvf hadoop-3.2.2.tar.gz -C /home/liucf/soft
fs.defaultFS
hdfs://node1:8020/
hadoop.tmp.dir
/home/liucf/data/dfs/tmp
dfs.replication
2
dfs.permissions.enabled
false
export JAVA_HOME=/home/liucf/soft/jdk1.8.0_121
[liucf@node1 soft]$ scp -r hadoop-3.2.2 liucf@node2:/home/liucf/soft
[liucf@node1 soft]$ scp -r hadoop-3.2.2 liucf@node3:/home/liucf/soft
[liucf@node1 soft]$ hdfs namenode -format
[liucf@node1 soft]$ /home/liucf/soft/hadoop-3.2.2/sbin/hadoop-daemon.sh start namenode
[liucf@node2 data]$ /home/liucf/soft/hadoop-3.2.2/sbin/hadoop-daemon.sh start datanode
[liucf@node3 data]$ /home/liucf/soft/hadoop-3.2.2/sbin/hadoop-daemon.sh start datanode
① jps 命令各个机器上查看进程
② web ui 查看
查看端口
[liucf@node1 soft]$ hdfs getconf -confKey dfs.namenode.http-address
0.0.0.0:9870
http://192.168.109.151:9870/
yarn.resourcemanager.hostname
node1
yarn.nodemanager.aux-services
mapreduce_shuffle
yarn.nodemanager.aux-services.mapreduce_shuffle.class
org.apache.hadoop.mapred.ShuffleHandler
yarn.log-aggregation-enable
true
两个文件里都配置
export JAVA_HOME=/home/liucf/soft/jdk1.8.0_121
[liucf@node1 soft]$ scp -r hadoop-3.2.2 liucf@node2:/home/liucf/soft
[liucf@node1 soft]$ scp -r hadoop-3.2.2 liucf@node3:/home/liucf/soft
[liucf@node1 soft]$ /home/liucf/soft/hadoop-3.2.2/sbin/yarn-daemon.sh start resourcemanager
[liucf@node2 data]$ /home/liucf/soft/hadoop-3.2.2/sbin/yarn-daemon.sh start nodemanager
[liucf@node3 data]$ /home/liucf/soft/hadoop-3.2.2/sbin/yarn-daemon.sh start nodemanager
8.3.5 验证
jps 看到进程都在
ResourceManager
NodeManager
完成