Article Catalog
- Hbase should be deployed in clusters for normal table creation, insertion and querying of data, etc.
- What is HBase?
- First, download the Hbase installation package
- 1.1 Change IP first
- 1.2 Go to the official website to download the required version
- 1.3 Installing HBase after uploading the installation package to the virtual machine
- Second, modify the HBase configuration file
- 2.1 Modification of documents
- 2.2 Modification of documents
- 2.3 Modify /etc/profile
- 2.5 Copy the configured HBase files to slave1 and slave2.
- III. Initiation
- 3.1 Starting zookeeper
- 3.2 Start hdfs
- 3.3 Starting hbase
- 3.4 Viewing the hbase page
- IV. HBase Operation
- 4.1 Entering the HBase Command Line
- 4.1.1 Viewing Help Commands
- 4.1.2 See what tables are currently in the database
- 4.2 Creating tables
- 4.3 Insertion of data
- 4.4 Viewing Table Data
- V. Summary
HbaseTo cluster deployment, you can build tables, insert data and query data normally, etc.
What is HBase?
HBase is a storage platform that allows random-access access and retrieval of data, storing structured and semi-structured data, so a typical website can have both web content and log information in HBase. It does not require a predefined schema for data, allowing dynamic and flexibledata modelHBase is a highly reliable, high-performance, column-oriented, scalable distributed storage system that utilizes HBASE technology to store data on inexpensive PCs.Server Build large-scale structured storage clusters on.
First, download the Hbase installation package
Change the IP address before downloading the hbase installer. master, slave1, and slave2 IP addresses should all be changed.
If you don't know what your computer's IP is, you can open cmd and enter the Ipconfig command to check.
1.1 Change IP first
Enter the following command in the virtual machine to access the configuration file to change the IP address.
vi /etc/sysconfig/network-scripts/ifcfg-ens33
- 1
You need to reboot the card after changing the IP.
systemctl restart network
- 1
After a successful reboot you need to ping the external network to see if it works.
After you can use it successfully, you need to check if the IP mapping is successful.
1.2 Go to the official website to download the required version
The version I downloaded is hbasehbase-1.4.
Download URL:
http://archive.apache.org/dist/hbase/?spm=a2c6h.-detail.5.3e627a59LuyV5L
1.3 Installing HBase after uploading the installation package to the virtual machine
Before doing so, switch to /usr/local.
cd /usr/local
- 1
Unzip the installer in this path
tar -zxvf hbase-1.4.8-bin.tar.gz
- 1
Use the ll command to see if the hbase package is installed under the current path.
Second, modify the HBase configuration file
Switch path: cd /usr/local/hbase-1.4.8/conf/
2.1 Modification of documents
First go to the file and add the configuration
vi hbase-env.sh
- 1
Added environment configuration code:
export HBASE_CLASSFATH=/usr/local/hadoop-2.7.1/etc/hadoop
export JAVA_HOME=/usr/local/jdk1.8.0_221/
- 1
- 2
2.2 Modification of documents
Go to the configuration file
vi hbase-site.xml
- 1
Added environment configuration code:
<configuration>
<property>
<name>hbase.rootdir</name>
<value>hdfs://master:9000/HBase</value>
</property>
<property>
<name>hbase.cluster.distributed</name>
<value>true</value>
</property>
<!-- 0.98 New changes after the previous version did not.port,The default port is60000 -->
<property>
<name>hbase.master.port</name>
<value>16000</value>
</property>
<property>
<name>hbase.zookeeper.quorum</name>
<value>master,slave1,slave2</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/usr/local/zookeeper-3.5.7/zkData</value>
</property>
</configuration>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
2.3 Modify /etc/profile
Go to the configuration file
vi /etc/profile
- 1
Added environment configuration code:
export HBASE_HOME=/usr/local/hbase-1.4.8
export PATH=$PATH:/usr/local/hbase-1.4.8/bin
- 1
- 2
After saving and exiting, you need to refresh the global variable to get access to it again.
ource /etc/profile
- 1
2.5 Copy the configured HBase files to slave1 and slave2.
You need to switch to /usr/local first.
scp -r /usr/local/hbase-2.5.4 root@slave1:/usr/local
scp -r /usr/local/hbase-2.5.4 root@slave1:/usr/local
scp -r hbase-1.4.8 root@slave1:/usr/local
scp -r hbase-1.4.8 root@slave2:/usr/local
- 1
- 2
- 3
- 4
Use ll in slave1 to see if there is a configured hbase file, same in slave2.
III. Initiation
activate (a plan)HadoopStart the zookeeper cluster before starting the HBase cluster.
3.1 Initiationzookeeper
Because I have installed zookeeper before this, so do not operate here, need to go to Baidu themselves.
First switch to the /usr/local directory and then use start zookeeper.
zkServer.sh start
- 1
Use jps to view all cluster processes and see the QuorumPeerMain process indicating a successful startup.
Same in slave1
3.2 Start hdfs
Start hds first.
start-dfs.sh
- 1
restart
start-yarn.sh
- 1
You can also use the startup if you don't want to bother.
start-all.sh
- 1
The stop order is:
stop-all.sh
- 1
After starting hadoop, go to the web side to see if it started successfully.
3.3 Starting hbase
priming command
start-hbase.sh
- 1
stop command
stop-hbase.sh
- 1
Processes can be viewed with jps
3.4 Viewing the hbase page
IV. HBase Operation
4.1 Entering the HBase Command Line
You need to switch to the /usr/loca path, if you are already in this path you don't need to switch.
hbase shell
- 1
4.1.1 Viewing Help Commands
help
- 1
4.1.2 See what tables are currently in the database
list
- 1
4.2 Creating tables
create 'student','info'
- 1
4.3 Insertion of data
put 'student','1001','info:sex','male'
put 'student','1001','info:age','18'
put 'student','1002','info:name','Janna'
put 'student','1002','info:sex','female'
put 'student','1002','info:age','20'
- 1
- 2
- 3
- 4
- 5
4.4 Viewing Table Data
can 'student'
- 1
At this point the Hbase cluster is built.
V. Summary
This is just a small task in my study of hadoop, from the beginning of the topic can not understand to be able to operate out, I think I learn to harvest. In the future, there will be more difficult problems, do not stop learning.