hadoop 2.5.1 cdh5.2.0(伪分布式)
(3).
启动
ResourceManager守护线程和NodeManager守护线程
准备工作
安装jdk
修改hosts
修改hostname
关闭防火墙
1.目录
cd /opt/dev/hadooptar -zxvf hadoop-2.5.0-cdh5.2.0.tarcd /opt/dev/hadoop/hadoop-2.5.0-cdh5.2.0
2.环境变量
vi /etc/profile
export JAVA_HOME=/opt/dev/jdk/jdk1.7.0_67export HADOOP_HOME=/opt/dev/hadoop/hadoop-2.5.0-cdh5.2.0export PATH=$PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
3.配置文件
(1).hadoop.env
export JAVA_HOME=/opt/dev/jdk/jdk1.7.0_67
export HADOOP_PREFIX=/opt/dev/hadoop/hadoop-2.5.0-cdh5.2.0
(2).core-site.xml
<!-- hadoop hdfs访问地址 -->
<property>
<name>fs.defaultFS</name>
<value>hdfs://localhost:9000</value>
</property>
<!-- ClientDatanodeProtocol 调用getBlockLocalPathInfo的时候 -->
<property>
<name>dfs.block.local-path-access.user</name>
<value>infomorrow</value>
</property>
<!-- hadoop 文件备份数 -->
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<!-- hadoop format路径 -->
<property>
<name>hadoop.tmp.dir</name>
<value>/home/infomorrow/hadoop-tmp</value>
</property>
(3).hdfs-site.xml
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
(4).mapred.set
<property>
<name>mapreduce.framework.name</name>
<value>yarn</value>
</property>
(5).yarn-site.xml
<property>
<name>yarn.nodemanager.aux-services</name>
<value>mapreduce_shuffle</value>
</property>
4.启动
(
1
). 格式化分布式文件系统:
hdfs namenode -format
(2). 启动nameNode
守护线程
和dataNode
守护线程
start-dfs.sh
start-yarn.sh
(4). namenode的web接口
http://192.168.0.105:50070/
(5).
ResourceManager的web接口
http://
192.168.0.105
:8088/
(6). hdfs命令
hdfs dfs -ls /
hdfs dfs -mkdir /user
hdfs dfs -put etc/hadoop input
hdfs dfs -get output output
(7).
运行mapreduce案例
hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.5.0-cdh5.2.0.jar grep input output 'dfs[a-z.]+'
hdfs dfs -cat output/*
5. 关闭
stop-dfs.sh
stop-yarn.sh
6. 查看是否启动jps
2400 NameNode2646 SecondaryNameNode2482 DataNode3294 NodeManager3079 ResourceManager
7.ssh免密码登陆
ssh hostname
ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys