cd /usr/local/Cellar/hadoop/3.1.2/libexec/etc/hadoop,打开open core-site.xml,填写<configutation><\configutation>之间的内容。
<!-- Put site-specific property overrides in this file. --> <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:8020</value> </property> </configuration>
设置MAP-REDUCE中JOBTRACKER的地址和端口号
cd /usr/local/Cellar/hadoop/3.1.2/libexec/etc/hadoop,打开mapred-site.xml,填写<\configutation>之间的内容。
cd /usr/local/Cellar/hadoop/3.1.2/libexec/etc/hadoop,在该目录下执行hdfs namenode -format
查看控制台,若出现ERROR,则需检查配置文件内容是否出错。
启动后台程序
cd /usr/local/Cellar/hadoop/3.1.2/sbin,在该目录下执行以下命令:
./start-dfs.sh or ./stop-dfs.sh启动或关闭hdfs
1 2 3 4
Starting namenodes on [localhost] Starting datanodes Starting secondary namenodes [MacBook-Pro.local] 2019-05-18 10:04:32,583 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable