redhat6.4下(用作hadoop master :记录所有数据分布情况--namenode)--安装单实例计算机
1、修改hostname
[root@hadoop01 ]# vim /etc/hosts
[root@hadoop01 ]# hostname
hadoop01
2、关闭防火墙
[root@hadoop01]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
[root@hadoop01 ]# chkconfig iptables off
[root@hadoop01 ]# vi /etc/selinux/config
3、配置java环境
[root@hadoop01 ]# vi /etc/profile
export JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/
export JRE_HOME=$JAVA_HOME/jre
export CLASSPARH=$JACA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
[root@hadoop01 ]# source /etc/profile //环境生效
[root@hadoop01 ]# mv hadoop-2.7.6 /opt
4、新建hadoop文件夹
mkdir /root/hadoop
mkdir /root/hadoop/tmp
mkdir /root/hadoop/var
mkdir /root/hadoop/dfs
mkdir /root/hadoop/dfs/name
mkdir /root/hadoop/dfs/data
5、配置hadoop
[root@hadoop01 hadoop]# pwd
/opt/hadoop-2.7.6/etc/hadoop
[root@hadoop01 hadoop]vim hadoop-env.sh //修改JAVA_HOME
export HADOOP_OPTS="-Djava.library.path=${HADOOP_HOME}/lib/native"
JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/
[root@hadoop01 hadoop]vim yarn-env.sh //修改JAVA_HOME
JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/
[root@hadoop01 hadoop]# vim core-site.xml
[root@hadoop01 hadoop]#vim hdfs-site.xml
[root@hadoop01 hadoop# vim mapred-site.xml
[root@hadoop01 hadoop]# vim yarn-site.xml
[root@hadoop01 hadoop# vi /etc/profile
export HADOOP_HOME=/opt/hadoop-2.7.6
export HADOOP_COMMON_LIB_NATIVE_DIR=$HADOOP_HOME/lib/native
export HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME/lib"
export PATH=.:${JAVA_HOME}/bin:${HADOOP_HOME}/bin:$PATH:$HADOOP_HOME/sbin
6、初始化并启动HADOOP
[root@hadoop01 bin]# ./hadoop namenode -format //初始化
[root@hadoop01 current]# pwd
/root/hadoop/dfs/name/current
[root@hadoop01 current]# ls //验证初始化成功
fsimage_0000000000000000000 fsimage_0000000000000000000.md5 seen_txid VERSION
[root@hadoop01 sbin]# pwd
/opt/hadoop-2.7.6/sbin
[root@hadoop01 sbin]# ./start-dfs.sh //启动HDFS
Starting namenodes on [hadoop01]
The authenticity of host 'hadoop01 (172.19.15.151)' can't be established.
RSA key fingerprint is 00:57:cb:a6:0d:28:05:17:58:0b:5f:8c:9d:2e:c5:1f.
Are you sure you want to continue connecting (yes/no)? yes
hadoop01: Warning: Permanently added 'hadoop01,172.19.15.151' (RSA) to the list of known hosts.
root@hadoop01's password:
hadoop01: starting namenode, logging to /opt/hadoop-2.7.6/logs/hadoop-root-namenode-hadoop01.out
root@localhost's password:
localhost: starting datanode, logging to /opt/hadoop-2.7.6/logs/hadoop-root-datanode-hadoop01.out
Starting secondary namenodes [0.0.0.0]
The authenticity of host '0.0.0.0 (0.0.0.0)' can't be established.
RSA key fingerprint is 00:57:cb:a6:0d:28:05:17:58:0b:5f:8c:9d:2e:c5:1f.
Are you sure you want to continue connecting (yes/no)? yes
0.0.0.0: Warning: Permanently added '0.0.0.0' (RSA) to the list of known hosts.
root@0.0.0.0's password:
0.0.0.0: starting secondarynamenode, logging to /opt/hadoop-2.7.6/logs/hadoop-root-secondarynamenode-hadoop01.out
[root@hadoop01 sbin]# ./start-yarn.sh //启动yarn
[root@hadoop01 sbin]# start-yarn.sh
-bash: start-yarn.sh: command not found
[root@hadoop01 sbin]# ./start-yarn.sh
starting yarn daemons
starting resourcemanager, logging to /opt/hadoop-2.7.6/logs/yarn-root-resourcemanager-hadoop01.out
root@localhost's password:
localhost: starting nodemanager, logging to /opt/hadoop-2.7.6/logs/yarn-root-nodemanager-hadoop01.out
7、查看是否启动成功
[root@hadoop01 sbin]# jps
27916 DataNode
28629 Jps
28239 ResourceManager
27779 NameNode
28083 SecondaryNameNode
28531 NodeManager
8、网页访问
http://172.19.15.151:8088/cluster
http://172.19.15.151:50070
另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。