1. HBase installation and deployment
HBase has two deployment models: stand-alone mode and Cluster Edition mode. In either mode, you need to configure the files under the HBase conf directory. At a minimum, you must add JAVA_HOME in conf / hbase-env.sh file. In this file hbase-env.sh, HBase environment variables may be provided, such as heap memory size, other configurations of the JVM, storage location of the log files.
Note: HBase and Hadoop version requires the installation corresponds to the version, otherwise the situation can not use HBase will appear, mainly in the HBase shell command operation is very slow, or even wrong. HBase and Hadoop HBase version corresponds to the official website can view the document https://hbase.apache.org/book.html#basic.prerequisites fourth node basic.prerequisites introduced as:
From the graph you can know more hadoop-2.8.0 versions do not support HBase or there is instability, it is best to install hadoop-2.7.1 + or hadoop-2.8.3 + version can not be used to avoid HBase, and here I using hadoop-2.7.1 + version.
Above HBase2.0 version requires Jdk8 above, it is employed herein Java8.
1.1 Software configuration options
JDK:1.8 (jdk1.8.0_151)
Hadoop:2.7.6 (hadoop-2.7.6.tar.gz)
HBase:2.1.2 (hbase-2.1.1-bin.tar.gz)
1.2 server environment ready
1.2.1 change the hostname
Enter the hostname view the host name of the machine, and then enter the command vi / etc / sysconfig / network edit / etc / sysconfig / network file
Note: After the host name change, to restart (reboot) to take effect.
Enter vim / etc / hosts to add the host and the corresponding IP host name, do mapping.
Note: Use the host name in the configuration file, then this mapping must be done!
1.2.2 turn off the firewall
Turn off the firewall, easy external access.
CentOS 7 versions of the following inputs:
turn off the firewall
service iptables stop
version enter more than CentOS 7:
systemctl STOP firewalld.service
1.2.3 Time Settings
Input:
DATE
see if the server time consistent. If not then change
to change the time command
date -s ‘MMDDhhmmYYYY.ss’
2. HBase stand-alone deployment
Examples include independent HBase HBase all daemons, such as: Master, RegionServers and the ZooKeeper, they run inside a single JVM, and persisted to the local file system.
2.1 downloaded from the official website HBase installation package, and by a single node to upload Xftp5 machine
HBase version currently used for the hbase-2.1.2-bin.tar.gz
Upload to / opt on the machine node node1 / frame / directory by Xftp5
2.2 decompression hbase-2.1.2.tar.gz, and to extract the installation package is moved to / opt / app / directory on.
tar xzvf hbase-2.1.2-bin.tar.gz
mv hbase-2.1.2 /opt/app
2.3 modify the configuration hbase-env.sh, hbase-site.xml file
Edit hbase-env.sh, add the following configuration:
export JAVA_HOME=/usr/lib/java/jdk1.8.0_181 export HBASE_HOME=/opt/app/hbase-2.1.2 export HBASE_CLASSPATH=/opt/app/hadoop-2.7.6/etc/hadoop export HBASE_PID_DIR=/opt/app/hbase-2.1.2/pids export HBASE_MANAGES_ZK=false
Description: The path to the configuration of their subject, HBASE_MANAGES_ZK = false is not enabled HBase cluster comes Zookeeper.
Edit hbase-site.xml file, add the following configuration:
<the Configuration> <- - storage directory hdfs here can be a stand-alone version of!> <Property> <name> hbase.rootdir </ name> <value> hdfs: // node1: 9000 / HBase </ value> < Description> byregion of The Shared Directory Servers. </ Description> </ Property> <Property> <name> hbase.tmp.dir </ name> <value> /opt/app/hbase-2.1.2/tmp </ value> </ Property> <-! is a stand-alone mode to false, true distributed mode -> <Property> <name> hbase.cluster.distributed </ name> <value> to false </ value> </ Property> <! - zk host address and port of the default, no configuration -> </ configuration>
2.4 HBase start
After the successful launch stand-alone version of Hadoop, HBase switch to the directory
cd /opt/app/hbase-2.1.2/bin
Input:
./start-hbase.sh
In the browser, type:
http://192.168.187.201:16010/
The display screen is success!
3. HBase cluster Deployment
HBase 3.1 Download the installation package from the official website and upload it to the machines in the cluster by Xftp5
HBase version currently used for the hbase-2.1.2-bin.tar.gz
Download hbase-2.1.2-bin.tar.gz version:
Upload to / opt / frames / directory on the first node node1 hadoop cluster of machines by Xftp5:
3.2 decompression hbase-2.1.2-bin.tar.gz, and to extract the installation package is moved to / opt / app / directory.
tar zxvf hbase-2.1.2-bin.tar.gz
mv hbase-2.1.1 /opt/app/ && cd /opt/app/
3.3 modify environment variables (each machine have to perform)
Edit / etc / profile, and environment variables to take effect, enter the following command:
sudo vi /etc/profile
Add the following:
export HBASE_HOME=/opt/app/hbase-2.1.2
export PATH=:PATH:PATH:HBASE_HOME/bin
The environment variables to take effect: Source / etc / Profile
3.4 modify the configuration hbase-env.sh, hbase-site.xml, Regionservers file
Hbase configuration file into the directory, cd / opt / App / hbase-2.1.2 / conf /
①修改hbase-env.sh文件 vi hbase-env.sh,将以下内容写入到hbase-env.sh文件中:
export JAVA_HOME=/usr/lib/java/jdk1.8.0_151
# hadoop配置文件的位置
export HBASE_CLASSPATH=/opt/app/hadoop-2.7.5/etc/hadoop
# 如果使用独立安装的zookeeper,这个地方就是false,不使用内部的zookeeper,而是使用自己外部搭建的zookeeper集群
export HBASE_MANAGES_ZK=true
②修改hbase-site.xml配置文件 vi hbase-site.xml,并将以下内容写入到hbase-site.xml文件中:
<configuration>
# hbasemaster的主机和端口
<property>
<name>hbase.master</name>
<value>hadoop1:60000</value>
</property>
# 时间同步允许的时间差
<property>
<name>hbase.master.maxclockskew</name>
<value>180000</value>
</property>
# hbase共享目录,持久化hbase数据
<property>
<name>hbase.rootdir</name>
<value>hdfs://hadoop1:9000/hbase</value>
</property>
# 是否分布式运行,false即为单机
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
# zookeeper地址
<property>
<name>hbase.zookeeper.quorum</name>
<value>hadoop1,hadoop2,hadoop3</value>
</property>
# zookeeper配置信息快照的位置
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/home/hbase/tmp/zookeeper</value>
</property>
</configuration>
③修改Regionservers配置文件vi Regionservers,并将以下内容写入到Regionservers文件中:
hadoop1
hadoop2
hadoop3
3.5 把hadoop的hdfs-site.xml和core-site.xml放到hbase/conf下
cp /opt/app/hadoop-2.7.6/etc/hadoop/hdfs-site.xml /opt/app/hbase-2.1.2/conf/
cp /opt/app/hadoop-2.7.6/etc/hadoop/core-site.xml /opt/app/hbase-2.1.2/conf/
3.6 发送到其他节点机器
scp -r /opt/app/hbase-2.1.2/ hadoop@hadoop2:/opt/app/
scp -r /opt/app/hbase-2.1.2/ hadoop@hadoop3:/opt/app/
3.7 启动
①启动HBase命令:start-hbase.sh
②进入hbase的shell:hbase shell
注:先启动才能进入HBase shell
3.8 查看
进程:jps
退出hbase的shell:quit
页面:http://master:60010/
4. 总结
参考资料:
http://hbase.apache.org/book.html