标签:
由于个人机子略渣,无法部署XWindow环境,直接用的Shell来操作,想要用鼠标点击操作的出门转左不送~
wget http://mirror.bit.edu.cn/apache/hadoop/common/stable2/hadoop-2.7.1.tar.gz
mkdir /usr/hadoop
tar -xzvf hadoop-2.7.1.tar.gz
mv hadoop-2.7.1 /usr/hadoop/
mkdir /usr/hadoop/tmp
mkdir /usr/hadoop/hdfs
mkdir /usr/hadoop/hdfs/data
mkdir /usr/hadoop/hdfs/name
移入刚解压的hadoop文件夹中
cd /usr/hadoop/hadoop-2.7.1
①hadoop配置文件指定java路径
etc/hadoop/hadoop-env.sh和yarn-env.sh
把之前的java路径用#注释掉,然后按照自己的java路径添加上去,如:
export JAVA_HOME=/usr/java/jdk1.8.0_20
②在/etc/profile
后面添加
export HADOOP_HOME=/usr/hadoop/hadoop-2.7.1
export PATH=$PATH:$HADOOP_HOME/bin
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib"
后面两句要是没有就可能出现
You have loaded library /usr/hadoop/hadoop-2.7.0/lib/native/libhadoop.so.1.0.0 which might have disabled stack guard. The VM will try to fix the stack guard now.
It‘s highly recommended that you fix the library with ‘execstack -c <libfile>‘, or link it with ‘-z noexecstack‘.
添加完毕之后,要记得. /etc/profile
,使命令生效
执行hadoop version查看是否成功
很明显,成功了~
进入etc/hadoop/
①修改core-site.xml,加上
<property>
<name>fs.defaultFS</name>
<value>hdfs://192.168.56.120:9000</value>
</property>
<property>
<name>hadoop.tmp.dir</name>
<value>file:/usr/hadoop/tmp</value>
</property>
②修改hdfs-site.xml,加上
<property>
<name>dfs.namenode.name.dir</name>
<value>file:/usr/hadoop/hdfs/name</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>file:/usr/hadoop/hdfs/data</value>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.namenode.secondary.http-address</name>
<value>192.168.56.121:9001</value>
</property>
<property>
<name>dfs.webhdfs.enabled</name>
<value>true</value>
</property>
③修改mapred-site.xml.template,加上
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
<property>
<name>mapreduce.jobhistory.address</name>
<value>192.168.56.120:10020</value>
</property>
<property>
<name>mapreduce.jobhistory.webapp.address</name>
<value>192.168.56.120:19888</value>
</property>
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
<property>
<name>yarn.nodemanager.auxservices.mapreduce.shuffle.class</name>
<value>org.apache.hadoop.mapred.ShuffleHandler</value>
</property>
<property>
<name>yarn.resourcemanager.address</name>
<value>192.168.56.120:8032</value>
</property>
<property>
<name>yarn.resourcemanager.scheduler.address</name>
<value>192.168.56.120:8030</value>
</property>
<property>
<name>yarn.resourcemanager.resource-tracker.address</name>
<value>192.168.56.120:8031</value>
</property>
<property>
<name>yarn.resourcemanager.admin.address</name>
<value>192.168.56.120:8033</value>
</property>
<property>
<name>yarn.resourcemanager.webapp.address</name>
<value>192.168.56.120:8088</value>
</property>
<property>
<name>yarn.nodemanager.resource.memory-mb</name>
<value>768</value>
</property>
或者是注释掉原来的localhost,加上你的从服务器名(之前的hosts文件作用就是能够识别从服务器名与IP地址)
#localhost
slave1
slave2
bin/hdfs namenode -format
进行初始化
如果显示successfully formatted且返回值status 0那么就格式化成功,如果显示status 1那么就是革命尚未成功,同志你还是再把之前的步骤检查一遍,再格式化直至成功。
大概就是这样吧,或许还有些许不知道的bug→_→
标签:
原文地址:http://www.cnblogs.com/XBlack/p/4954791.html