H base+ H adoop+ Z ookeeper 集群
一、 服务器规划和基础配置
*RM-ResourceManager,HM-HMaster,SN- SecondaryNameNode ,NM-NodeManager,HR-HRegionServer
IP |
Hostname |
角色 |
10.0.0.1 |
Node1 |
RM,HM,NameNode,SN |
10.0.0.2 |
Node2 |
DataNode,NM,HR |
10.0.0.3 |
Node3 |
DataNode,NM,HR |
1. ssh 免密认证
ssh-keygen yum -y install openssh-clients ssh-copy-id
2. Hosts 文件主机名解析
vim /etc/hosts
10.0.0.1 Node1
10.0.0.2 Node2
10.0.0.3 Node3
3. 防火墙 selinux 关闭
setenforce 0
4. Java8 安装
java 1.8.0_144
vim /etc/profile
export JAVA_HOME=/usr/local/jdk
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
5. 软件版本
hbase 1.2.11+hadoop3.1.2+zookeeper3.4.13
二、 Zookeeper 集群搭建
1. 配置文件更改
1.mv /root/soft/zookeeper-3.4.13 /usr/local/zookeeper
2. mv conf/zoo_sample.cfg conf/zoo.cfg
3. mkdir /usr/local/zookeeper/{data,logs}
4.vim conf/zoo.cfg
-增加如下设置
dataDir=/usr/local/zookeeper/data
dataLogDir=/usr/local/zookeeper/logs
server.1=10.0.0.1:2888:3888
server.2=10.0.0.2:2888:3888
server.3=10.0.0.3:2888:3888
MaxSessionTimeout=200000
5. vim /usr/local/zookeeper/data/myid
1(另外两台改成2和3)
2. 服务启动测试 (3 台都启动后查看日志是否有报错 )
1. cd /usr/local/zookeeper
2. ./bin/zkServer.sh start #启动服务
3. ./bin/zkServer.sh status #查看服务状态
三、 Hadoop 集群搭建
1. 配置文件更改
1.mv /root/soft/hadoop-3.1.2 /usr/local/hadoop
2.vim /etc/profile(3台都需要更改)
export HADOOP_HOME=/usr/local/hadoop
export PATH=$PATH:$HADOOP_HOME/bin
source /etc/profile 使配置生效
3. cd /usr/local/hadoop/etc/hadoop
vim core-site.xml
<configuration> <property> <name>hadoop.tmp.dir</name> <value>file:/home/hadoop/tmp</value> </property> <property> <name>fs.defaultFS</name> <value>hdfs://10.0.0.1:9000</value> </property> </configuration>
4. mkdir -p /home/hadoop /hdfs/name
mkdir -p /home/hadoop /hdfs/ data
vim hdfs-site.xml
<configuration> <property> <name>dfs.replication</name> <value>2</value> </property> <property> <name>dfs.name.dir</name> <value>file:/home/hadoop/hdfs/name</value> </property> <property> <name>dfs.data.dir</name> <value>file:/home/hadoop/hdfs/data</value> </property> </configuration>
dfs.replication 表示数据副本数,一般不大于 datanode 的节点数。
5. vim mapred-site.xml
<configuration> <property> <name>mapreduce.framework.name</name> <value>yarn</value> </property> <property> <name>mapred.job.tracker</name> <value>10.0.0.1:9001</value> </property> </configuration>
6. vim yarn-site.xml
<configuration> <!-- Site specific YARN configuration properties --> <property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value> </property> <property> <name>yarn.resourcemanager.hostname</name> <value>10.0.0.1</value> </property> </configuration>
7.修改从服务器配置
vim worker
10.0.0.2
10.0.0.3
2. 增加环境变量
1. vim hadoop-env.sh
添加 JDK 路径
export JAVA_HOME=/usr/local/jdk
2. cd /usr/local/hadoop
①vim sbin/start-dfs.sh(stop-dfs.sh)
添加 HDFS的root执行权限
HDFS_DATANODE_USER=root
HADOOP_SECURE_DN_USER=hdfs
HDFS_NAMENODE_USER=root
HDFS_SECONDARYNAMENODE_USER=root
②vim sbin/start-yarn.sh(stop-yarn.sh)
添加 yarn的root执行权限
YARN_RESOURCEMANAGER_USER=root
HADOOP_SECURE_DN_USER=yarn
YARN_NODEMANAGER_USER=root
3. 配置从节点的 Hadoop 环境
scp -r /usr/local/hadoop 10.0.0.2:/usr/local/
scp -r /usr/local/hadoop 10.0.0.3:/usr/local/
4. 服务启动测试
①格式化namenode,第一次启动服务前执行的操作,以后不需要执行。
cd /usr/local/hadoop
./bin/hadoop namenode -format
② 在master节点执行如下命令
./sbin/start-all.sh
四、 Hbase 集群搭建
1. 配置文件更改
mv /root/soft/hbase- 1.2.11 /usr/local/hbase
1.cd /usr/local/hbase
vim config/hbase-site.xml
<configuration> <property> <name>hbase.rootdir</name> <value>hdfs://10.0.0.1:9000/hbase</value> </property> <property> <name>hbase.master</name> <value>10.0.0.1</value> </property> <property> <name>hbase.master.info.port</name> <value>60010</value> </property> <property> <name>hbase.cluster.distributed</name> <value>true</value> </property> <property> <name>hbase.zookeeper.quorum</name> <value>10.0.0.1,10.0.0.2,10.0.0.3</value> </property> <property> <name>hbase.zookeeper.property.clientPort</name> <value>2181</value> </property> <property> <name>zookeeper.session.timeout</name> <value>200000</value> </property> <property> <name>dfs.support.append</name> <value>true</value> </property> <property> <name>hbase.unsafe.stream.capability.enforce</name> <value>false</value> </property> </configuration>
2.修改从服务器配置
vim config/regionservers
10.0.0.2
10.0.0.3
2. 增加环境变量
vim hbase-env.sh
export JAVA_HOME=/usr/local/jdk
export HBASE_CLASSPATH=/usr/local/hadoop/etc/hadoop #配置hbase找到Hadoop
export HBASE_MANAGES_ZK=false #使用外部的zookeeper
3. 配置从节点的 Hadoop 环境
scp -r /usr/local/hbase 10.0.0.2:/usr/local/
scp -r /usr/local/hbase 10.0.0.3:/usr/local/
4. 服务启动测试
cd /usr/local/hbase
./bin/start-hbase.sh
5. 运行检查
10.0.0.1
jps
10.0.0.2
jps
10.0.0.3
Jps
五、 错误排查
启动 hbase报java.lang.ClassNotFoundException: org.apache.htrace.SamplerBuilder
上传htrace-core-3.1.0-incubating.jar到lib目录下
Attempting to operate on hdfs namenode as root
HDFS_DATANODE_USER=root
HADOOP_SECURE_DN_USER=hdfs
HDFS_NAMENODE_USER=root
HDFS_SECONDARYNAMENODE_USER=root
java.lang.IllegalStateException: The procedure WAL relies on the ability to hsync for proper operation during component failures, but the underlying filesystem does not support doing so. Please check the config value of 'hbase.procedure.store.wal.use.hsync' to set the desired level of robustness and ensure the config value of 'hbase.wal.dir' points to a FileSystem mount that can provide it.
<property>
<name>hbase.unsafe.stream.capability.enforce</name>
<value>false</value>
</property>
Operation category READ is not supported in state standby
获取 namenode 节点状态
./bin/hdfs haadmin -getServiceState Node1
手动更改 namenode 状态为 active
./bin/hdfs haadmin -transitionToActive --forcemanual Node1
NameNode is not formatted
./bin/hadoop namenode -format
Unable to check if JNs are ready for formatting
解决方法:先用 ./zkServer.sh start 启动各个zookeeper,再用./hadoop-daemon.sh start journalnode启动各个NodeName上的JournalNode进程。然后再进行格式化即可。
Incompatible namespaceID for journal Storage Directory /root/hadoop/hdfs/journal/hadoop-test: NameNode has nsId 229502726 but storage has nsId 1994970436
是多次格式化 namenode导致版本不一致,删除namenode的目录后,重新格式化,重启后,该问题解决。
java.io.IOException: Incompatible clusterIDs in /data/dfs/data: namenode clusterID = CID-d1448b9e-da0f-499e-b1d4-78cb18ecdebb; datanode clusterID = CID-ff0faa40-2940-4838-b321-98272eb0dee3
先停掉集群,然后将 datanode 节点目录 /dfs/data/current/VERSION 中的修改为与 namenode 一致即可
got premature end-of-file at txid 0; expected file to go up to 2
hdfs namenode -bootstrapStandby #会清空hdfs
以上所述就是小编给大家介绍的《Hbase+Hadoop+Zookeeper集群(含排错)》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:- coredns 排错记
- 译文 | 推荐信:程序排错
- OpenStack排错常用步骤和命令
- 记一次排错经历——npm缓存浅析
- mysqldump备份表中有大字段失败的排错过程
- Rainbond v5.1.7,应用展示清晰透明,优化应用排错
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Introduction to Graph Theory
Douglas B. West / Prentice Hall / 2000-9-1 / USD 140.00
For undergraduate or graduate courses in Graph Theory in departments of mathematics or computer science. This text offers a comprehensive and coherent introduction to the fundamental topics of graph ......一起来看看 《Introduction to Graph Theory》 这本书的介绍吧!