Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The second of big data's learning series-HBase environment building (stand-alone)

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Introduction

In the previous article, we set up a stand-alone environment for Hadoop, while this article built a stand-alone environment for HBase.

Environment preparation 1, server selection

Ali CVM: entry-level (postpaid)

Operating system: linux CentOS 6.8

Cpu:1 kernel

Memory: 1G

Hard disk: 40g

2, configuration selection

JDK:1.8 (jdk-8u144-linux-x64.tar.gz)

Hadoop:2.8.2 (hadoop-2.8.2.tar.gz)

HBase:1.6.2 (hbase-1.2.6-bin.tar.gz)

3, download address

Official website address:

JDK:

Http://www.oracle.com/technetwork/java/javase/downloads

Hadopp:

Http://www.apache.org/dyn/closer.cgi/hadoop/common

HBase:

Http://mirror.bit.edu.cn/apache/hbase/

Baidu Cloud:

Link: https://pan.baidu.com/s/1jIemnA2 password: 3ykr

Second, the configuration of the server

Before configuring Hadoop, you should do the configuration first

1, change the hostname

Change the hostname first in order to facilitate management.

Enter:

Hostname

View the name of this machine

Then enter:

Vim / etc/sysconfig/network

Modify host name

Change the name of HOSTNAME to the name you want to set

Note: after the host name is changed, reboot will not take effect until it is restarted.

Input

Vim / etc/hosts

Add the host IP and the corresponding host name to do the mapping.

Note: this mapping must be done if the hostname is used in the configuration file!

2. Turn off the firewall

Turn off the firewall to facilitate external access.

The following inputs for CentOS 7 version:

Turn off the firewall

Service iptables stop

Input for versions above CentOS 7:

Systemctl stop firewalld.service

3, time setting

Enter:

Date

Check whether the server time is the same, and if not, change it.

Change time command

Date-s' MMDDhhmmYYYY.ss' III, HBase environment installation 1, download HBase

Extract the downloaded HBase configuration file

On linux, enter:

Tar-xvf hbase-1.2.6-bin.tar.gz

Then move to / opt/hbase

Input

Mv hbase-1.2.6 / home/hbase2,HBase environment configuration 3.2.1 environment configuration

Edit / etc/profile file

Enter:

Export HBASE_HOME=/home/hbase/hbase-1.2.6export PATH=.:$ {JAVA_HOME} / bin:$ {HADOOP_HOME} / bin:$ {HBASE_HOME} / bin:$PATH

Enter:

Source / etc/profile

Make the configuration effective

Input

Hbase version

View version

3.2.2 modify the configuration file

Create a new folder under the root directory

Mkdir / root/hbase mkdir / root/hbase/tmp mkdir / root/hbase/pids

Switch to / home/hbase/hbase-1.2.6/conf

3.2.2.1 modify hbase-env.sh

Edit the hbase-env.sh file to add the following configuration

Export JAVA_HOME=/home/java/jdk1.8export HADOOP_HOME=/home/hadoop/hadoop2.8export HBASE_HOME=/home/hbase/hbase-1.2.6export HBASE_CLASSPATH=/home/hadoop/hadoop2.8/etc/hadoopexport HBASE_PID_DIR=/root/hbase/pidsexport HBASE_MANAGES_ZK=false

Description: configure the path to your own. HBASE_MANAGES_ZK=false is a Zookeeper cluster that does not enable HBase native.

3.2.2.2 modify hbase-site.xml

Edit the hbase-site.xml file and add the following configuration

Hbase.rootdir hdfs://test1:9000/hbase The directory shared byregion servers. Hbase.zookeeper.property.clientPort 2181 Property from ZooKeeper'sconfig zoo.cfg. The port at which the clients will connect. Zookeeper.session.timeout 120000 hbase.zookeeper.quorum test1 hbase.tmp.dir / root/hbase/tmp hbase.cluster.distributed false

Description: hbase.rootdir: this directory is a shared directory for region server and is used to persist Hbase. Hbase.cluster.distributed: the running mode of Hbase. False is in stand-alone mode and true is in distributed mode. If false,Hbase and Zookeeper run in the same JVM.

4By HBASE start

After successfully starting Hadoop

Change to the HBase directory

Cd / home/hbase/hbase-1.2.6/bin

Enter:

. / start-hbase.sh

Enter in the browser:

Http://39.108.208.105:16010/

The display of this interface is successful!

HBase shell usage

After HBase starts

Enter:

HBase shell

Enter hbase

Then enter list to query which tables there are.

Because HBase is a column storage structure, it is different from the traditional relational database in building tables.

Create a new user table t_user

Add two column families, st1 and st2

Create'tresume username, thecontrol, thecontrol, theory1, theory2'.

Add data to this table

Add primary keys, columns, and values

Put't send usernames to 1001 minutes, 1001 to st1, to 18 put't to users, to 1001 to st2, to name names, to zhangsan'.

Then query the table data

Scan'tasking username'

View table structure

Describe'tasking username'

Delete record

Delete't_user','1001','st1:age'

Delete tabl

To delete a table, you must first mask the table

Disable'tasking username'

Delete

Drop'tasking username'

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report