Mac配置hadoop
1.修改 /etc/hosts
127.0.0.1 localhost
2.下载hadoop2.9.0和jdk并安装配置相应环境
vim /etc/profile
export HADOOP_HOME=/Users/yg/app/cluster/hadoop-2.9.0
export HADOOP_CONF_DIR=$HADOOP_HOME/etc/hadoop
export PATH=$PATH:$HADOOP_HOME/bin
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
export PATH=$PATH:$JAVA_HOME/bin
3.配置SSH(免密码登录)
ssh-keygen -t rsa 生成公钥和私钥
cat xxx.pub >> authorized_keys 将公钥文件写到authorized_keys里
chmod 644 authorized_keys
ssh IP/HOSTNAME 测试免密码登录,
4.安装hadoop
tar zxf hadoop-2.9.0.tar.gz 解压
然后进到hadoop-2.9.0目录下的/etc/hadoop目录下
修改配置文件:
1.--core-site.xml
<property>
<name>fs.default.name</name>
<value>hdfs://localhost:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>/opt/hadoop-2.9.0/current/tmp</value>
</property>
<property>
<name>fs.trash.interval</name>
<value>4320</value>
</property>
2.--hdfs-site.xml
<property>
<name>dfs.namenode.name.dir</name>
<value>/Users/yg/app/cluster/hadoop-2.9.0/current/dfs/name</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>/Users/yg/app/cluster/hadoop-2.9.0/current/dfs/data</value>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.webhdfs.enabled</name>
<value>true</value>
</property>
<property>
<name>dfs.permissions.superusergroup</name>
<value>staff</value>
</property>
<property>
<name>dfs.permissions.enabled</name>
<value>false</value>
</property>
3.--yarn-site.xml
<property>
<name>yarn.resourcemanager.hostname</name>
<value>localhost</value>
</property>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.nodemanager.aux-services.mapreduce.shuffle.class</name>
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
</property>
<property>
<name>yarn.resourcemanager.address</name>
<value>localhost:18040</value>
</property>
<property>
<name>yarn.resourcemanager.scheduler.address</name>
<value>localhost:18030</value>
</property>
<property>
<name>yarn.resourcemanager.resource-tracker.address</name>
<value>localhost:18025</value>
</property> <property>
<name>yarn.resourcemanager.admin.address</name>
<value>localhost:18141</value>
</property>
<property>
<name>yarn.resourcemanager.webapp.address</name>
<value>localhost:18088</value>
</property>
<property>
<name>yarn.log-aggregation-enable</name>
<value>true</value>
</property>
<property>
<name>yarn.log-aggregation.retain-seconds</name>
<value>86400</value>
</property>
<property>
<name>yarn.log-aggregation.retain-check-interval-seconds</name>
<value>86400</value>
</property>
<property>
<name>yarn.nodemanager.remote-app-log-dir</name>
<value>/tmp/logs</value>
</property>
<property>
<name>yarn.nodemanager.remote-app-log-dir-suffix</name>
<value>logs</value>
</property>
4.--mapred-site.xml
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<property>
<name>mapreduce.jobtracker.http.address</name>
<value>localhost:50030</value>
</property>
<property>
<name>mapreduce.jobhisotry.address</name>
<value>localhost:10020</value>
</property>
<property>
<name>mapreduce.jobhistory.webapp.address</name>
<value>localhost:19888</value>
</property>
<property>
<name>mapreduce.jobhistory.done-dir</name>
<value>/jobhistory/done</value>
</property>
<property>
<name>mapreduce.intermediate-done-dir</name>
<value>/jobhisotry/done_intermediate</value>
</property>
<property>
<name>mapreduce.job.ubertask.enable</name>
<value>true</value>
</property>
5.--slaves
localhost
6.--hadoop-env.sh
修改
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
export HADOOP_CONF_DIR=/Users/yg/app/cluster/hadoop-2.9.0/etc/hadoop
5.格式化HDFS
hdfs namenode -format
6.启动
$HADOOP_HOME/sbin/start-all.sh
7.验证集群
jps