Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

HBase explanation and deployment

Shulou Source: shulou.com Published: 2022-06-02 19:11:39 11月15日 Update

HBase is a NoSQL database.

What is a NoSQL database?

Saving data based on Key-value

NoSQL databases do not support things

Common NoSQL databases:

HBase: HDFS based, column-oriented database

Table---> Contents

Data---> Documents

Redis: A memory-based NoSQL database that supports persistence (RDB, AOF)

Predecessor: MemCached does not support persistence

MongoDB: Document-based NoSQL database (BSON documents, JSON binary)

Cassandra: Column Oriented NoSQL Database

Table structure of HBase

article(table)

rowkey

content

author

comments

title

text

user

content

Article 1

Chicken or egg first?

……

someone

Hand spray

Chickens don't make you.

Articles...

……

……………………

architecture

HBase Environment Deployment:

Native mode---1 host: no HDFS required, data stored directly on the operating system

1. Install JAVA environment, modify environment variables

2. Install HBase

Pseudo-distribution mode---1 host: HDFS support required, data stored directly on HDFS

1. Install JAVA environment, modify environment variables

2. Deploying HDFS pseudo-distributed

3. Deploying HBase Pseudo-Distributed

Full distribution mode---3 hosts: HDFS support required, data stored directly on HDFS

1. Install JAVA environment, modify environment variables

2. Deploying HDFS Fully Distributed

3. Deploying HBase Fully Distributed

HA Full Distribution Mode---3 hosts

Environmental pre-deployment preparation:

Set environment variable vi ~/.bash_profile

HBASE_HOME=/root/training/hbase-1.3.1

export HBASE_HOME

PATH=$HBASE_HOME/bin:$PATH

export PATH

Local mode:

hbase-env.sh

28 export JAVA_HOME=/root/training/jdk1.8.0_144

hbase-site.xml

hbase.rootdir

file:///root/training/hbase-1.3.1/data

Start HBase: start-hbase.sh

pseudo-distributed mode

hbase-env.sh

129 export HBASE_MANAGES_ZK=true

hbase-site.xml

hbase.rootdir

hdfs://192.168.157.11:9000/hbase

hbase.cluster.distributed

true

hbase.zookeeper.quorum

192.168.157.11

dfs.replication

1

regionservers

192.168.157.11

Start HBase: start-hbase.sh

fully distributed model

hbase-site.xml

hbase.rootdir

hdfs://192.168.157.12:9000/hbase

hbase.cluster.distributed

true

hbase.zookeeper.quorum

192.168.157.12

dfs.replication

2

hbase.master.maxclockskew

180000

regionservers

192.168.157.13

192.168.157.14

scp -r hbase-1.3.1/ root@bigdata13:/root/training

scp -r hbase-1.3.1/ root@bigdata14:/root/training

Start HBase: start-hbase.sh

HA of HBase

No additional configuration required, only a single point on one of the slave nodes to start Hmaster

Start HBase: start-hbase.sh

bigdata13:hbase-daemon.sh start master

HBase Web Console web port: 16010

HBase command line operations:

Go to Command Line: hbase shell

View:

View table: list

Query data:

scan is equivalent to select * from table name

Get is equivalent to select * from table name where rowkey=?

Insert data:

put 'table',' row','column family': column name',' value '

put 'students', 'stu1', 'info:name', 'Tom'

Clear the table of data:

truncate 'table name'--------> The essence of truncate is to delete the table before creating it

truncate 'students'

Delete table:

disable 'table name'

drop 'table name'

Tags: Data environment database schema support host distributed variable content command document article structure operating system thing binary architecture author memory Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple macOS Huawei Shulou Information OPPO Reno