Hbase pseudo distribution installation configuration

Hbase installation configuration

Hbase installation prerequisites

  • JDK
  • Hadoop (Hadoop comes with zookeeper, so no additional download is required)

Download the Hbase compressed package

HbaseDownload

Software Version Compatibility

Hadoop and Hbase

For the matching relationship between Hadoop and Hbase , you can view the official Hbase documentation and search for 'Hadoop version support matrix': http://hbase.apache.org/book.html#basic.prerequisites

The correspondence between HBase and Hadoop versions is as follows:

image description

Check that your hadoop version is 2.10.2

image-20230410151919747

The 2.3.x series versions of Hbase in release

image-20230410151800846

Hbase and JDK

The corresponding relationship between HBase and JDK version is as follows:

image description

image-20230410155934961

Software Installation

software location

/usr/loca/hbase

image-20230417155107218

Create data save and log save folders

hbase_dataThe directory used to save the data generated by hbase

hbase_logLog directory for recording hbase operations

zookeeper_dataThe directory used to save the data generated by zookeeper

image-20230417155300092

Modify the configuration file

modify hbase-site.xmlfile

In Apache projects such as Hadoop and HBase, there are usually some default configuration files, such as hadoop-default.xmlor hbase-default.xml. These default configuration files contain the default settings for the project.

When deploying these projects, in order to avoid directly modifying the default configuration file, we usually create a <软件名>-site.xmlnew configuration file named as hadoop-site.xmlor hbase-site.xml. The "site" suffix indicates that these configurations are specific to your deployment environment. This way, when the project is updated, you can preserve your deployment-specific settings without worrying about conflicting with the default settings. Settings in these "site" configuration files override corresponding settings in the default configuration file.

  <property>
    <name>hbase.cluster.distributed</name> <!--是否是分布式配置-->
    <value>true</value>
  </property>

  <property>
    <name>hbase.tmp.dir</name> <!-- 缓存文件的保存目录 -->
    <value>./tmp</value>
  </property>

  <property>
    <name>hbase.unsafe.stream.capability.enforce</name> <!-- 不用管 -->
    <value>false</value>
  </property>

  <property>
    <name>hbase.rootdir</name>
    <value>file:///usr/local/hbase/hbase-2.3.1/hbase_data</value> <!-- hbase的data保存目录,需要手动创建 -->
  </property>

  <property>
    <name>hbase.zookeeper.quorum</name> <!-- 表示使用hbase自带的zookeeper -->
    <value>localhost</value>
  </property>

  <property>
    <name>hbase.zookeeper.property.clientPort</name> <!-- zookeeper的端口号 -->
    <value>2181</value>
  </property>

  <property>
    <name>hbase.zookeeper.property.dataDir</name> <!-- zookeeper的data保存目录 -->
    <value>/usr/local/hbase/hbase-2.3.1/zookeeper_data</value>
  </property>

modify hbase-env.shfile

Add your own Java and Hadoop variables

And the log save directory variable

export JAVA_HOME=/usr/local/Java/jdk1.8.0_361
export HADOOP_HOME=/usr/local/hadoop
export HBASE_MANAGES_ZK=false
export HBASE_LOG_DIR=/usr/local/hbase/hbase-2.3.1/hbase_log

Modify the ~/.bashrc file

Add hbase environment variables

Enables global use of commands in bin

#hbase
export HBASE_HOME=/usr/local/hbase/hbase-2.3.1
export PATH=$PATH:$HBASE_HOME/bin

Start hbase and verify

start-hbase.shStart with

Use jpsto verify, if there is hbase related HRegionServerand HMasterprogress, it means that the startup is successful

image-20230417160239413

Permission issuePermission denied

Modify users and user groups

Change the user and user group of the target directory to the current user

sudo chown -R yourUserName:yourUserName <floderName>

Modify the permissions of the target directory

Usually an error occurs because the current user does not have write permissions to the target folder

So you need to open the write permission of the directory to the current user

chmod -R 755 folder: This command is used to change the permissions of the specified folder (and its subfolders and files).

Permissions are represented by three digits, and each number represents the permissions of the file owner , the group to which the file belongs , and other users .

For example 755:

  • Owner (the first number, which is 7): has read, write, and execute permissions (7 = 4 + 2 + 1, where 4 means read permission, 2 means write permission, and 1 means execute permission )
  • Usergroup (the second number, which is 5): has read and execute permissions (5 = 4 + 1)
  • Other users (third number, which is 5): have read and execute permissions (5 = 4 + 1)

Therefore, in the user group that determines that the current user is in the target directory or file , you can use the following command to modify the permissions

sudo chown -R 775 <floderName>

SLF4J问题: Class path contains multiple SLF4J bindings.

Multiple binding issues with SLF4J:

This issue is caused by multiple SLF4J bindings being found in the classpath . While this issue does not directly cause HBase to fail to start, it is recommended to fix it to avoid potential problems.

To fix this, remove one of the bindings from Hadoop or HBase's catalog.lib

Files lib/client-facing-thirdpartyunder the HBase directory can be deleted . slf4j-log4j12-1.7.30.jarThis way SLF4J will only use bindings from Hadoop slf4j-reload4j-1.7.36.jar.

Hbase application combination

Hbase + Redis

Hbase + solr

Build user portraits

reference documents

Hadoop, Hbase, Hive and zookeeper version compatibility relationship

Deploy the latest version of zookeeper pseudo-distributed cluster on linux

HBase pseudo-distributed mode installation and startup

HBase cluster tutorial

Guess you like

Origin blog.csdn.net/ahahayaa/article/details/130203233