服务规划

gz上传文件,解压文件,创建软连接


cd etc


修改workers文件


配置hadoop-env.sh,这个文件作用主要是Hadoop运行的环境变量

Delphi
export JAVA_HOME=/export/server/jdk
export HADOOP_HOME=/export/server/hadoop
export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop
export HADOOP_LOG_DIR=$HADOOP_HOME/logs
配置core-site。xml文件


java
<configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://node1:8020</value>
</property>
<property>
<name>io.file.buffer.size</name>
<value>131072</value>
</property>
</configuration>
修改hdfs-site.xml文件




创建nn、dn文件夹



复制文件夹
diff
scp -r hadoop-3.3.6 node2:`pwd`/
html
scp -r hadoop-3.3.6 node3:`pwd`/

在node2、node3上构建软连接


配置环境变量

javascript
vim /etc/profile
javascript
export HADOOP_HOME=/export/server/hadoop
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
javascript
source /etc/profile

授权hadoop用户

在各种配置文件中,我们都是以root用户进行操作的,普通用户hadoop并没有操作权限,现在我们需要对普通用户hadoop进行授权。
javascript
chown -R hadoop:hadoop /export
javascript
chown -R hadoop:hadoop /data
授权之前

授权之后



在确保所用node都给Hadoop用户进行授权之后,格式化整个文件系统
perl
格式化namenode
# 确保以hadoop用户执行
su - hadoop
# 格式化namenode
hadoop namenode -format
在格式化之后,我们可以来到/data目录下,可以看到dn和nn文件中已经存储了数据:


启动

验证,在node中切换到hadoop用户,输入jps:
node1:

node2:

node3:
