1.准备三台节点 hnd1 hnd2 hnd3
下载 hadoop
下载地址:http://apache.fayea.com/hadoop/common/
API文档:http://hadoop.apache.org/docs/r1.0.4/cn/index.html
2.解压;tar -zxvf hadoop-1.2.1.tar.gz
添加软连接:ln -sf /home/hadoop/package/hadoop-1.2.1 /home/hadoop-1.23.更改配置:
进入/home/hadoop-1.2/conf修改 vi core-site.xml 配置hdfs的入口和工作目录可参考:http://hadoop.apache.org/docs/r1.2.1/single_node_setup.htmlfile:///D:/tool/%E6%96%87%E6%A1%A3/db/hadoop-1.2.1/hadoop-1.2.1/docs/core-default.html修改hadoop.tmp.dir这个目录 dfs等很多工作目录是以此为基础的fs.default.name hdfs://hnd1:9000 hadoop.tmp.dir /opt/hadoop-1.2
修改 vi hdfs-site.xml 配置副本数 不配的情况下默认是3
dfs.replication 2
修改 vi slaves 配置datanode
hnd2hnd3修改 vi masters 配置second NameNode
hnd2 就是second NameNode配置到第二台系统中4.ssh免密码登录
生成密钥到/root/.ssh目录下$ ssh-keygen -t dsa -P '' -f ~/.ssh/id_dsa 执行下面命令实现本地免密码登录$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys跨系统免密码登录拷贝hnd1公钥到hnd2root目录下 scp id_dsa.pub root@hnd2:~在hnd2中root目录下 cat id_dsa.pub >> ~/.ssh/authorized_keys这样就可以访问了5.启动服务
把tar包拷贝到其它节点上scp -r /home/hadoop/package/hadoop-1.2.1.tar.gz root@hnd2:~/scp -r /home/hadoop/package/hadoop-1.2.1.tar.gz root@hnd3:~/解压 tar -zxvf hadoop-1.2.1.tar.gz创建软链ln -sf /root/hadoop-1.2.1 /home/hadoop-1.2把hnd1的配置/home/hadoop-1.2/conf这个目录全部拷贝到hnd2\hnd3scp ./* root@hnd2:/home/hadoop-1.2/conf/scp ./* root@hnd3:/home/hadoop-1.2/conf/bin目录下格式化 ./hadoop namenode -format启动服务 ./start-dfs.sh6.启动时JAVA_HOME is not set.
conf 配置vi hadoop-env.shJAVA_HOME的配置
解压 tar -zxvf jdk-8u91-linux-x64.tar.gz 配置 export JAVA_HOME=/usr/java/jdk1.8.0_77PATH=$JAVA_HOME/bin:$PATH:$HOME/bin执行 source .bash_profile 查看 Java -version OK其它节点安装jdk
拷贝 scp -r /home/hadoop/package/jdk-8u91-linux-x64.tar.gz root@hnd2:~/scp -r /home/hadoop/package/jdk-8u91-linux-x64.tar.gz root@hnd3:~/ 7.jps 查看启动的进程其他节点上的进程没有启动 关闭防火墙service iptables stop8.访问 http://hnd1:50070/
本地需要配置域名解析C:\Windows\System32\drivers\etc hosts9.
ssh: Could not resolve hostname hnd2: Name or service not knownvi /etc/hosts192.168.40.101 hnd1192.168.40.102 hnd2192.168.40.103 hnd3vi /etc/sysconfig/network
NETWORKING=yesHOSTNAME=h1
xshell 连接linux命令 ssh 192.168.40.101
断开的命令:exit
IT技术和行业交流群: 417691667