LAN on any PC under Windows Eclipse remote connection HBase database

Source: Internet
Author: User
Tags zookeeper

Through a long period of repeated failure, finally implemented in Windows Remote connection HBase database, in the ongoing attempt to deeply appreciate the importance of a detailed document, so the detailed process of my configuration is recorded. You are welcome to comment if there are some places where words are used incorrectly, or if you understand them incorrectly.

First, the operating platform

HBase Server side: Ubuntu 14.04 64-bit; Hbase1.1.3;java 1.8;

HBase customer service side: WINDOWS32/64 bit; java1.8;eclipse 4.5;

Second, Linux server-side environment configuration

1. Installing Java 1.8 software

1) Download Java software

Note: If java1.8 is not in the System software Library, do the following

$ sudo apt-get install Software-properties-common

$ sudo apt-get install python-software-properties

The top two actions are to download the basic Development Kit under Ubuntu

$ sudo add-apt-repository Ppa:webupd8team/java

2) Installing Java 8

$ sudo apt-get update

$ sudo apt-get installoracle-java8-installer

3) Verify the Java version of the installation

$ java–version Output Java version information after execution

2. Installation Configuration HBase

1) Download hbase-1.1.3

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

2) Unzip

$tar Xzf hbase-1.1.3-bin.tar.gz

$MV hbase-1.1.3 HBase will decompress is all files moved to the HBase directory

3) Configure HBase standalone mode

3.1 Specifying Java_home for HBase

$ vim hbase/conf/hbase-env.sh

Modify the path of the Java_home={java installation directory in the file}

Modify export Hbase_manages_zk=true to indicate that the zookeeper cluster is hosted by HBASE and does not need to download the zookeeper program separately and then start it yourself.

3.2 Configuring the Hbase-site.xml file

$ vim Hbase/conf/hbase-site.xml

Add between <configuration></configuration> in file:

<property>

<name>hbase.rootdir</name>

<value>file:///<PATH>/hbase</value>

</property>

The above means that the HBase database will use the local file system as a backup of the data to prevent the server from losing power. You can also back up to the HDFs file system.

3.3 Starting hbase and hbase shells

$ cdhbase/bin

$./start-hbase.sh

$./hbase Shell

After you start the HBase shell, you can create a table based on your own commands, insert data, and so on. Then open the browser and enter: localhost:16010 Enter the webpage to see HBase related information. Note: The port is 16010, not official documents and most blogs are written in 60000, the reason is unknown, personally think it may be because the official document written is the version before HBase 1.0. If you don't know the master port number for the version you downloaded, you can view it by command: $ NETSTAT–NLP | grep java.

3.3 Configuring hostname and hosts

Further configuration is required because the HBase database needs to be remotely manipulated by the Kua platform. Set the hostname in the/etc/hostname file, which is the host name of HBase's master run, which is usually the default name.

In the/etc/hosts file, before the modification was: 127.0.0.1 localhost

127.0.1.1 Sobey (machine name). If you do not modify the run directly, through the command: $ NETSTAT–NLP | grep java view, you can see that HBase is running on the IP address of 127.0.1.1, this is a local address, if you need remote control within the LAN, you need to modify the 127.0.1.1 for the machine's Internet IP address, such as: 172.16.133.18. Reminder: In the/hbase/conf/regionservers file content try not to modify, because it is placed in HBase node running machine domain name, the default is localhost, it corresponds to the local address: 127.0.0.1.

Note: The machine name in the hosts must be modified uniformly with the machine name in the hostname or

are not modified.

3.4 Configuring the system environment variables for HBase

To facilitate the startup or shutdown of HBase, add the following information to the system environment variable:

$ vim ~/.BASHRC

Export Hbase_home=<path>/hbase

Export habse_conf_dir= $HBASE _home/conf

Export hbase_class_path= $HBASE _conf_dir

Export path= $PATH: $HBASE _home/bin

Remember to perform after editing: source ~/.BASHRC

Here, the HBase server-side configuration is complete.

Third, Windows client side configuration

1. Download and install Java 1.8 and configure the environment variables.

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

2, download hbase-1.1.3-bin.tat.gz and unzip.

3, the client side Java program settings

1) Find the jar packages required to run the HBase program, which are in the Lib folder after HBase decompression

2) Copy the Hbase-site.xml file under the Conf file under the HBase file into a separate folder for it.

3) Open the Eclipse software, create a new project, import the external dependency package (the jar package required to run HBase) in the project, and import the folder with the Hbase-site.xml file separately into the Java build pathàlibraries.

4) Important Java programs for the Windows Eclipse Remote Connection HBase Program

In general, this procedure is put into the constructor of the Java class to ensure that the method function in the class is connected with HBase on the service side when the program is run. In this program IP on the hbase server Internet IP address, 2181 refers to zookeeper port, the single-machine environment HBase running is through the zookeeper management, so the customer service side want to connect HBase, You must know the port number of the zookeeper listen, which is Port 2181 in the default environment.

5) Windows under the Hosts file

Locate the Hosts file under Win7 C:\Windows\System32\drivers\etc, and add the following: 172.16.133.18 sobey-xps-m1330. Where the first half of the IP address, the second part of the machine name, according to the actual situation to modify.

With the above configuration and operation, the HBase database can be operated remotely under any system on any PC on the LAN.

Reminder: If it is a virtual machine environment, to pay attention to the IP settings, due to the need for LAN other PC connected to the virtual machine, so its IP must make the LAN can be connected to other computers. On the virtual machine click Set à network adapter à check the bridging mode and then restart. Test it by command: ifconfig, view IP, and then whether the other PC in the LAN can ping through.

LAN on any PC under Windows Eclipse remote connection HBase database

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.