安裝Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
官網(wǎng):https://brew.sh/index_zh-cn.html
安裝Hadoop
brew install hadoop
查看安裝路徑:
brew list hadoop
配置Hadoop
前往安裝目錄(默認為/usr/local/Cellar/hadoop/2.8.0)
cd /usr/local/Cellar/hadoop/2.8.0/libexec/etc/hadoop/
修改相關(guān)配置文件
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.templete
<configuration>
<property>
<name>mapred.job.tracker</name>
<value>localhost:9010</value>
</property>
</configuration>
hdfs-site.xml
<configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
運行Hadoop
格式化Namenode
cd /usr/local/Cellar/hadoop/2.8.0/bin
hadoop namenode -format
啟動Hadoop
cd /usr/local/Cellar/hadoop/2.8.0/sbin
./start-all.sh
檢查運行狀態(tài)
Jps
jps
查看以下服務是否正常啟動
94945 DataNode
95059 SecondaryNameNode
94853 NameNode
95318 Jps
95181 ResourceManager
95279 NodeManager
訪問以下網(wǎng)址
Resource Manager: http://localhost:50070
JobTracker: http://localhost:8088
Specific Node Information: http://localhost:8042