- 需要配置免密码登录(ssh)
- brew install hadoop
默认安装最新的,我这里是装的是 hadoop 3.0.0 。配置文件目录在 /usr/local/Cellar/hadoop/3.0.0/libexec/etc/hadoop - 修改core-site.xml
<configuration>
<property>
<name>hadoop.tmp.dir</name>
<value>/usr/local/Cellar/hadoop/hdfs/tmp</value>
<description>A base for other temporary directories.</description>
</property>
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
</configuration>
- 修改 mapred-site.xml
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>localhost:9010</value>
</property>
</configuration>
- 修改 dfs-site.xml
注意:不设置 dfs.namenode.http-address,待会就打不开 hdfs 的web页面
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.namenode.http-address</name>
<value>localhost:50070</value>
</property>
</configuration>
- 配置环境变量,我设置的是当前用户的环境变量。 vim ~/.bash_profile
#hadoop
export HADOOP_HOME=/usr/local/Cellar/hadoop/3.0.0/libexec
- 使环境变量生效,终端执行
source ~/.bash_profile
- 格式化namenode节点,看到has been successfully,表示成功
hdfs namenode -format
- 启动服务
定位到 /usr/local/Cellar/hadoop/3.0.0/libexec/sbin
start-dfs.sh #启动HDFS
start-yarn.sh #启动yarn
jps 查看虚拟机进程
10082 NodeManager
10547 Jps
9429 NameNode
9574 DataNode
9945 ResourceManager
9754 SecondaryNameNode
有这几个进程表示启动成功。
- 访问web管理页面
http://localhost:50070
http://localhost:8088
网友评论