Remote connection to hbase database from eclipse on any pc in the LAN in windows

Source: Internet
Author: User
After a long time of repeated failures, we finally achieved remote connection to the hbase database in windows, and deeply touched the importance of a detailed document during constant attempts, so I recorded the detailed configuration process. In this article, you are welcome to comment on improper words or incorrect understanding. 1. hbase server: Ubuntu1

After a long time of repeated failures, we finally achieved remote connection to the hbase database in windows, and deeply touched the importance of a detailed document during constant attempts, so I recorded the detailed configuration process. In this article, you are welcome to comment on improper words or incorrect understanding. I. operating platform hbase server: Ubuntu 1

After a long time of repeated failures, we finally achieved remote connection to the hbase database in windows, and deeply touched the importance of a detailed document during constant attempts, so I recorded the detailed configuration process. In this article, you are welcome to comment on improper words or incorrect understanding.

I. Operating Platform

Hbase server: Ubuntu 14.04 64-bit; HBASE1.1.3; JAVA 1.8;

Hbase client: windows32/64-bit; JAVA1.8; eclipse 4.5;

Ii. linux server environment Configuration

1. install java 1.8 software

1) download java software

Note: If the system software library does not contain java1.8, perform the following operations:

$ Sudo apt-get install software-properties-common

$ Sudo apt-get install python-software-properties

The above two operations are to download the basic development kit under Ubuntu

$ Sudo add-apt-repository ppa: webupd8team/java

2) install java 8

$ Sudo apt-get update

$ Sudo apt-get installoracle-java8-installer

3) Verify the installed java version

$ After java-version is executed, the java version information is output.

2. install and configure HBASE

1) download hbase-1.1.3

Web http://mirrors.cnnic.cn/apache/hbase/1.1.3/hbase-1.1.3-bin.tar.gz

2) decompress

$ Tar xzf hbase-1.1.3-bin.tar.gz

$ Mv hbase-1.1.3 hbase unzip all files to the hbase directory

3) Configure hbase standalone Mode

3.1 specify JAVA_HOME for hbase

$ Vim hbase/conf/hbase-env.sh

Modify JAVA_HOME = {path to the java installation directory}

Modify export HBASE_MANAGES_ZK = true, which indicates that the Zookeeper cluster is hosted by hbase. You do not need to download the Zookeeper program and start it on your own.

3.2 configure the hbase-site.xml File

$ Vim hbase/conf/hbase-site.xml

In the file Between:

Hbase. rootdir

File :/// /Hbase

The above means that the hbase database will use the local file system as a data backup to avoid the loss of server power. It can also be backed up to the HDFS file system.

3.3 start hbase and hbase shell

$ Cdhbase/bin

$./Start-hbase.sh

$./Hbase shell

After hbase shell is started, you can create tables and insert data according to the built-in commands. Open the browser and enter: localhost: 16010 to go to the webpage to view hbase information. Note: The port number is 16010, which is not the official document or 60000 written in most blogs. The reason is unknown. I personally think it may be because the official document is written in versions earlier than hbase 1.0. If you do not know the master port number corresponding to the version you downloaded, run $ netstat-nlp | grep java.

3.3 configure hostname and hosts

Further configuration is required because you need to remotely operate hbase databases on the Apsara stack. Set the host name in the/etc/hostname file. The host name is the name of the host running on the hbase Master. Generally, it is the default name.

In the/etc/hosts file, before modification, it is 127.0.0.1 localhost.

127.0.1.1 sobey (machine name ). Run Hbase directly without modifying it. Run the command $ netstat-nlp | grep java to check whether Hbase runs on the IP address 127.0.1.1. This is a local address. If you need remote control in the LAN, you need to change 127.0.1.1 to the Internet IP address of the machine, for example, 172.16.133.18. Reminder: do not modify the content of the/hbase/conf/regionservers file as far as possible, because the Domain Name of the machine running on the hbase node is placed in it. The default value is localhost in the single-host environment, it corresponds to the local address 127.0.0.1.

Note: The host name in hosts must be modified in the same way as that in hostname or

Are not modified.

3.4 configure hbase system environment variables

To enable or disable hbase, add the following information to the system environment variable:

$ Vim ~ /. Bashrc

Export HBASE_HOME = /Hbase

Export HABSE_CONF_DIR = $ HBASE_HOME/conf

Export HBASE_CLASS_PATH = $ HBASE_CONF_DIR

Export PATH = $ PATH: $ HBASE_HOME/bin

After editing, remember to execute: source ~ /. Bashrc

At this point, the configuration of the hbase server has been completed.

Iii. windows client Configuration

1. Download and install java 1.8 and configure environment variables.

1. Download and install eclipse, preferably the latest version.

2. Download hbase-1.1.3-bin.tat.gz and decompress it.

3. client-side java program settings

1) Find the jar package required to run the hbase program. These files are all in the lib folder after hbase is decompressed.

2) copy the hbase-site.xml file under the conf file under the hbase file into a separate folder for it.

3) Open eclipse software, create a new project, and import external dependency packages (jar packages required to run hbase) to the project ), importing a folder with a separate hbase-site.xml file into java build path à Libraries.

4) Important java programs for remote connection to hbase in eclipse in Windows

Generally, this program is put into the constructor of the java class to ensure that the program is connected to the hbase of the server when the method function is running in the class. In this program, the IP address is the Internet IP address of the hbase server. 2181 refers to the zookeeper port. In a single-host environment, hbase runs through its own zookeeper, so the customer server wants to connect to hbase, you must know the port number of the listen of zookeeper. Port 2181 is used by default.

5) hosts files in Windows

In win7 C: \ Windows \ System32 \ drivers \ etc Find hosts file, add the following content: 172.16.133.18 sobey-XPS-M1330. The first half indicates the IP address, and the second half indicates the name of the machine, which can be modified according to the actual situation.

With the above configuration and operations, you can remotely operate hbase databases on any PC in the LAN.

Note: In a virtual machine environment, pay attention to the IP Address Settings. Because you need to connect other PCs in the LAN to the virtual machine, the IP address must be accessible to other computers in the LAN. On the virtual machine, click Set network adapter select bridge mode, and then restart. Test whether the IP address can be pinged through the command ifconfig.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.