HDFS 搭建记录
1. 三台服务:
172.17.0.62(namenode)
172.17.0.68(datanode)
172.17.0.76(datanode)
/etc/hosts包含的内容:
三台都包含的域名映射:(注意:域名中不要有下划线(_),否则 datanode起不来,呵呵:。。)
172.17.0.76 tomcattomcatmobileplatformtest.bjdv #不要有下划线(_)
172.17.0.62 tomcatmobileplatform.bjdv
172.17.0.68 mobileplatformweblogic.bjdv
#各个服务器映射自己的主机名
127.0.0.1 cd6d8c70882c
2. namenode与datanode配置互相的不用密码的ssh,以及登陆localhost的不用密码的ssh,这里用的rsa
每台服务器上执行一下:#localhost的ssh
1)ssh-keygen -t rsa -f /root/.ssh/id_rsa (连续两下回车,即不设密码)
2)cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
把namenode和datanode上的id_rsa.pub拷到对方的/root下,并在对方上执行一下3,4 #namenode与datanode互相的ssh
3)cat /root/id_rsa.pub >> /root/.ssh/authorized_keys
4)chmod 0600 ~/.ssh/authorized_keys
3.下载并拷贝hadoop(本文使用的是hadoop-2.7.2)到三台服务器。
4.配置文件:
etc/hadoop/core-site.xml:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
--> <!-- Put site-specific property overrides in this file. --> <configuration>
<property>
<name>fs.defaultFS</name>
<value>hdfs://172.17.0.62:9000</value>
</property>
</configuration>
etc/hadoop/hadoop-env.sh:
加入JAVA_HOME,HADOOP_PID_DIR
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export HADOOP_PID_DIR=/nodespace/h/pids
etc/hadoop/hdfs-site.xml:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. See accompanying LICENSE file.
--> <!-- Put site-specific property overrides in this file. --> <configuration>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
<property>
<name>dfs.namenode.name.dir</name>
<value>/nodespace/namenode</value>
</property>
<property>
<name>dfs.datanode.data.dir</name>
<value>/nodespace/datanode</value>
</property>
</configuration>
etc/hadoop/slaves:
172.17.0.68
172.17.0.76
namenode服务器上:
# mkdir /nodespace/namenode (dfs.namenode.name.dir)
# bin/hadoop namenode -format
# sbin/start-dfs.sh
查看日志
# tail -f logs/hadoop-root-namenode-2ac9303a23f0.log -n 200
检查服务
# jps
27831 Jps
27353 NameNode
27584 SecondaryNameNode
# ./bin/hdfs dfsadmin -report
Configured Capacity: 20869324800 (19.44 GB)
Present Capacity: 14557261824 (13.56 GB)
DFS Remaining: 14557155328 (13.56 GB)
DFS Used: 106496 (104 KB)
DFS Used%: 0.00%
Under replicated blocks: 0
Blocks with corrupt replicas: 0
Missing blocks: 0
Missing blocks (with replication factor 1): 0 -------------------------------------------------
Live datanodes (2): Name: 172.17.0.68:50010 (mobileplatformweblogic.bjdv)
Hostname: localhost
Decommission Status : Normal
Configured Capacity: 10434662400 (9.72 GB)
DFS Used: 49152 (48 KB)
Non DFS Used: 4756729856 (4.43 GB)
DFS Remaining: 5677883392 (5.29 GB)
DFS Used%: 0.00%
DFS Remaining%: 54.41%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Mon Aug 29 14:55:37 CST 2016 Name: 172.17.0.76:50010 (tomcattomcatmobileplatformtest.bjdv)
Hostname: localhost
Decommission Status : Normal
Configured Capacity: 10434662400 (9.72 GB)
DFS Used: 57344 (56 KB)
Non DFS Used: 1555333120 (1.45 GB)
DFS Remaining: 8879271936 (8.27 GB)
DFS Used%: 0.00%
DFS Remaining%: 85.09%
Configured Cache Capacity: 0 (0 B)
Cache Used: 0 (0 B)
Cache Remaining: 0 (0 B)
Cache Used%: 100.00%
Cache Remaining%: 0.00%
Xceivers: 1
Last contact: Mon Aug 29 14:55:38 CST 2016
( NameNode 的webUI信息 似乎不正确,只能看到一个Datanode, http://172.17.0.62:50070/dfshealth.html, 上面的 bin/hdfs dfsadmin -report 是正确的)
测试:
# bin/hadoop fs -put LICENSE.txt /
datanode服务器上:
检查服务
# jps
21622 DataNode
21774 Jps
日志查看:
# tail -f logs/hadoop-root-datanode-cd6d8c70882c.log
datanode上:
没有压缩的情况下,往hdfs上传文件后在其中的一个datanode上可以看到(如:blk_1073741828),dfs.replication设置为1,所以在所有datanode上只有一份文件。
# ls -l datanode/current/BP-333745209-172.17.0.62-1472441549732/current/finalized/subdir0/subdir0/
total 8
-rw-r--r-- 1 root root 1366 Aug 29 14:55 blk_1073741828
-rw-r--r-- 1 root root 19 Aug 29 14:55 blk_1073741828_1004.meta
以上是自己搭建hdfs时测试与总结,有不对的地方,欢迎指正。
HDFS 搭建记录的更多相关文章
- Mac OSX系统中Hadoop / Hive 与 spark 的安装与配置 环境搭建 记录
Mac OSX系统中Hadoop / Hive 与 spark 的安装与配置 环境搭建 记录 Hadoop 2.6 的安装与配置(伪分布式) 下载并解压缩 配置 .bash_profile : ...
- faster-rcnn(testing): ubuntu14.04+caffe+cuda7.5+cudnn5.1.3+opencv3.0+matlabR2014a环境搭建记录
python版本的faster-rcnn见我的另一篇博客: py-faster-rcnn(running the demo): ubuntu14.04+caffe+cuda7.5+cudnn5.1.3 ...
- py-faster-rcnn(running the demo): ubuntu14.04+caffe+cuda7.5+cudnn5.1.3+python2.7环境搭建记录
第一次写博客,以此纪念这几天安装caffe,跑faster-rcnn的血泪史.在此特别感谢网络各路大神,来自全球各地,让我能从中汲取营养,吸取经验,总结规律. faster-rcnn分为matlab版 ...
- 生产apollo搭建记录(五)
1. 生产apollo搭建记录(五) 1.1. 目标 搭建两个环境配置,dev和pro,但目前可用服务器限制,打算mysql用同一个,服务器分生产和测试 1.2. 数据库 建三个库 注意注意:在启 ...
- 12.2RAC搭建记录
12.2RAC环境搭建记录 安装前资源检查 资源限制要求/etc/security/limits.conf Table 6-1 Installation Owner Resource Limit Re ...
- RobotFramework测试环境搭建记录
Robotframwork测试环境搭建记录 1.安装Python2.7(https://www.python.org/) 在环境变量path中加入“C:\Python27” 安装后的验证方法为在命令行 ...
- (转载)PHP环境搭建-记录
PHP环境搭建-记录 转于 http://jingyan.baidu.com/article/fcb5aff797ec41edaa4a71c4.html php5.5 做了大量的更新,在与apac ...
- KubeSphere单节点(all-in-one)平台搭建记录
KubeSphere单节点(all-in-one)平台搭建记录 目录 KubeSphere单节点(all-in-one)平台搭建记录 一.主机准备 1.1 主机配置 1.2 环境准备 二.下载kube ...
- Android 环境搭建记录
Android 环境搭建记录 官网 https://developer.android.com/ studio 下载地址 官方下载 jikexueyuanwiki 国内镜像 studio历史版本 安装 ...
随机推荐
- Bootstrap-模态框Modal使用
传值使用JavaScript方式吧,代码如下: <!DOCTYPE html> <html> <head> <meta charset="UTF-8 ...
- NSString、NSMutableString基本使用
郝萌主倾心贡献.尊重作者的劳动成果,请勿转载. 假设文章对您有所帮助.欢迎给作者捐赠,支持郝萌主.捐赠数额任意.重在心意^_^ 我要捐赠: 点击捐赠 Cocos2d-X源代码下载:点我传送 游戏官方下 ...
- GitHub具体教程
GitHub具体教程 Table of Contents 1 Git具体教程 1.1 Git简单介绍 1.1.1 Git是何方神圣? 1.1.2 重要的术语 1.1.3 索引 1.2 Git安装 1. ...
- jdk1.5多线程Lock接口及Condition接口
jdk1.5多线程的实现的方式: jdk1.5之前对锁的操作是隐式的 synchronized(对象) //获取锁 { } //释放锁 jdk1.5锁的操作是显示的:在包java.util.concu ...
- 训练趣题:黑与白 有A、B、C、D、E五人,每人额头上都帖了一张黑或白的纸。(此处用javascript实现)
今天的题目原题是这样的: “ 黑与白:有A.B.C.D.E五人,每人额头上都帖了一张黑或白的纸.五人对坐,每人都可以看到其它人额头上的纸的颜色.五人相互观察后,A说:“我看见有三人额头上帖的是白纸,一 ...
- declare-styleable:自定义控件的属性
http://www.cnblogs.com/jisheng/archive/2013/01/10/2854891.html 在使用过程中, 1 TypedArray a = getContext() ...
- getSharedPreferences()与getSharedPreferences()与getDefaultSharedPreferences()的区别
http://blog.csdn.net/ah200614435/article/details/7869681 一直迷惑于这三个方法的关系,最近忙完项目,好好的分析一下. 如果你熟悉Context那 ...
- Android - This Handler class should be static or leaks might occur.
今天学习了使用 HTTP协议,从Android客户端往Tomcat服务器端以GET发送请求,途中无意中发现自己写的Handler类被Android提示:This Handler class shoul ...
- 获取SqlServer当前链接数
1.提供有关 Microsoft SQL Server 数据库引擎实例中的当前用户.会话和进程的信息,显示所有session sp_who 2.针对 SQL Server 上的每个经过身份验证的会话返 ...
- 在 Mac OS X 中建立加密的 Zip 压缩 -- 让机密资料加上密码
在 Mac OS X 中要压缩档案的話,基本上就用滑鼠点右鍵选「压缩...」就可以制作 Zip 格式的压缩档,很方便.但如果是机密的资料要透过 Email 等管道传送时,常常会需要建立加密的 Zip ...