HBase installation
1. Environment variable configuration
Upload the installation package to CentOS, unzip the installation package to the hadoop directory
tar -zxvf hbase-1.6.0-bin.tar.gz -C /usr/hadoop
Configure environment variables
vi /etc/profile
Add the following code at the end, save and exit
export HBASE_HOME=/usr/hadoop/hbase-1.6.0
export PATH=$HBASE_HOME/bin:$PATH
Effective configuration
source /etc/profile
verification
hbase version
2. Configure HBase
Enter the hbase conf folder, edit the hbase-env.sh file, modify the Java path, and remove the comment
export JAVA_HOME=/usr/java/jdk1.8.0_241
Use the zookeeper that comes with hbase
export HBASE_MANAGES_ZK=false
Edit the hbase-site.xml file
<configuration>
<!-- 将HBase数据保存在HDFS目录中 -->
<property>
<name>hbase.rootdir</name>
<value>hdfs://master:8020/hbase</value>
</property>
<!-- HBase是否是分布式环境 -->
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<!-- 配置zookeeper地址,节点全部启用zookeeper,个数必须是奇数 -->
<property>
<name>hbase.zookeeper.quorum</name>
<value>master,slave1,slave2</value>
</property>
<!-- zookeeper数据目录 -->
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/usr/hadoop/zookeeper-3.5.7/data</value>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>
</property>
</configuration>
Modify the file regionservers and add the host name of the slave node
slave1
slave2
slave3
3. Synchronize HBase configuration files
Synchronize the HBase configuration file of the master node to slave1, slave2, and slave3
scp -r /usr/hadoop/hbase-1.6.0 slave1:/usr/hadoop
scp -r /usr/hadoop/hbase-1.6.0 slave2:/usr/hadoop
scp -r /usr/hadoop/hbase-1.6.0 slave3:/usr/hadoop
Configure the environment variables of slave1, slave2, and slave3 respectively
scp /etc/profile slave1:/etc/
scp /etc/profile slave2:/etc/
scp /etc/profile slave3:/etc/
Effective configuration on slave1, slave2, and slave3 respectively
source /etc/profile
4. Start HBase
Start zookeeper, start hdfs, start yarn
Run HBase start command
start-hbase.sh
[root@master bin]# jps
9760 ResourceManager
9447 NameNode
13208 HMaster
13337 HRegionServer
12202 HQuorumPeer
9612 SecondaryNameNode
14414 Jps
Enter the HBase web management page
http://master:16011/
TIPS:
1. If the following situations occur, the web management page cannot be opened
pids/hbase-root-master.pid: 没有那个文件或目录
Determine if hdfs and hbase configuration files are the same
The value under hbase.rootdir under hbase-site.xml must be the same as the value under fs.defaultFS under the hadoop configuration file core-site.xml, ip and port!
Modify hbase's pid file save path
Open hbase-env.sh in the conf directory and find the following code
# export HBASE_PID_DIR=/var/hadoop/pids
Modify to own path
export HBASE_PID_DIR=/usr/hadoop/hbase-1.6.0/pids
2. When HMaster fails to start, add the following content to hbase-site.xml:
<property>
<name>hbase.unsafe.stream.capability.enforce</name>
<value>false</value>
<description>
Controls whether HBase will check for stream capabilities (hflush/hsync).
Disable this if you intend to run on LocalFileSystem.
WARNING: Doing so may expose you to additional risk of data loss!
</description>
</property>
Source:
https://stackoverflow.com/questions/48709569/hbase-error-illegalstateexception-when-starting-master-hsync
Official explanation:
https://github.com/apache/hbase/blob/master/hbase-procedure/src/test/resources/hbase-site.xml
3. When it shows that the port is occupied, check the occupied first, kill the port, and restart
netstat -nultp
kill -9 端口号
5. Enter HBase Shell
hbase shell