search
HomeDatabaseMysql Tutorial局域网内任何一台pc上windows下eclipse远程连接hbase数据库

通过很长一段时间的反复失败,终于在windows下实现远程连接hbase数据库,在不断的尝试过程中深感一个详细的文档的重要性,于是就把我配置的详细过程记录下来。文中如果有些地方用词不当,或者理解错误,欢迎您们评论。 一、运行平台 hbase服务器端:Ubuntu 1

通过很长一段时间的反复失败,终于在windows下实现远程连接hbase数据库,在不断的尝试过程中深感一个详细的文档的重要性,于是就把我配置的详细过程记录下来。文中如果有些地方用词不当,或者理解错误,欢迎您们评论。

一、运行平台

hbase服务器端:Ubuntu 14.04 64位;HBASE1.1.3;JAVA 1.8;

hbase客服端:windows32/64位;JAVA1.8;eclipse 4.5;

二、linux服务器端环境配置

1、  安装java 1.8软件

1)下载java软件

注:如果系统软件库中没有java1.8,则执行以下操作

$ sudo apt-get install software-properties-common

$ sudo apt-get install python-software-properties

上面两个操作是下载Ubuntu下的基础开发套件

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

2)安装java 8

$ sudo apt-get update

$ sudo apt-get installoracle-java8-installer

3)验证安装的java版本

$ java –version 执行后会输出java版本信息

2、  安装配置HBASE

1)下载hbase-1.1.3

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

2)解压

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

$mv hbase-1.1.3 hbase  将解压是文件全部移至hbase目录中

3)配置hbase单机模式

3.1为hbase指定JAVA_HOME

   $ vim hbase/conf/hbase-env.sh

   文件中修改JAVA_HOME={java安装目录的路径}

   修改export HBASE_MANAGES_ZK=true,表示由hbase托管Zookeeper集群,不需要单独下载Zookeeper程序,然后自己去启动。

3.2配置hbase-site.xml文件

   $ vim hbase/conf/hbase-site.xml

在文件中之间添加:

 hbase.rootdir

  file:////hbase

上面的意思是hbase数据库将使用本地文件系统作为数据备份以免服务器掉电丢失。同时也可备份到HDFS文件系上。

            3.3启动hbase和hbase shell

                $ cdhbase/bin

                $./start-hbase.sh

                $ ./hbase shell

               启动hbase shell 后可以根据自带的命令进行建表,插入数据等操作。然后打开浏览器,输入:localhost:16010 进入网页可以看到hbase相关信息。注意:端口是16010,不是官方文档和大多数博客里面写的60000,原因不详,个人认为可能是因为官方文档写是是hbase 1.0之前的版本。如果不清楚自己下载的版本对应的master端口号,可以通过命令查看:$ netstat –nlp | grep java 。

             3.3配置hostname以及hosts

                由于需要进行夸平台远程操作hbase数据库,所以需要进一步配置。在/etc/hostname文件中设置主机名,这个主机名就是hbase的Master运行的主机名字,一般情况下直接就是默认名字。

                在/etc/hosts文件中,在没有修改之前是:127.0.0.1  localhost

127.0.1.1 sobey(机器名)。如果不修改直接运行,通过命令:$ netstat –nlp | grep java 查看,可以看出Hbase运行在IP地址为127.0.1.1上,这是一个本地地址,如果需要局域网内远程操控,则需要修改127.0.1.1为机器的互联网IP地址,如:172.16.133.18。提醒:在/hbase/conf/regionservers文件内容尽量不要修改,因为里面放着hbase中节点运行的机器域名,单机环境下默认为localhost,它对应的也是本地的地址:127.0.0.1。

                注意:hosts中机器名必须和hostname中机器名统一修改或

                都不修改。

             3.4 配置hbase的系统环境变量

                 为方便hbase的启动或者关闭等操作,在系统环境变量中添加如下信息:

                   $ 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

                      编辑完后记住执行:source ~/.bashrc

        到此,hbase服务器端的配置已完成。

三、windows客服端配置

1、下载安装java 1.8并且配置好环境变量。

1、下载安装eclipse,最好为最新版。

2、下载hbase-1.1.3-bin.tat.gz并解压。

3、客服端java程序设置

1)找到运行hbase程序所需要的jar包,这些文件都在hbase解压后的lib文件夹里面

2)将hbase文件下conf文件下的hbase-site.xml文件拷贝一份,放入为其单独建一个文件夹中。

3)打开eclipse软件,新建工程,在工程中导入外部依赖包(运行hbase所需的jar包),将单独放有hbase-site.xml文件的文件夹也导入java build path à Libraries中。

4)Windows下eclipse 远程连接hbase程序的重要java程序

一般讲这段程序放入java 类的构造函数中,以保证类中方法函数运行时程序是和服务端的hbase是连接的。在这段程序中IP就hbase服务端的互联网IP地址,2181是指zookeeper的端口,单机环境 下hbase运行是通过自带的zookeeper管理的,所以客服端想连接hbase,必须知道zookeeper的listen的端口号,默认环境下是2181端口。

5)Windows下hosts文件

在win7下C:\Windows\System32\drivers\etc中找到hosts文件,添加如下内容:172.16.133.18  sobey-XPS-M1330。其中,前半部分表示IP地址,后半部分表示机器名字,根据实际情况进行修改。

     通过以上的配置和操作,接下来就可以在局域网中任何一台PC上任何系统下远程操作hbase数据库。

     提醒:如果是虚拟机环境下,要注意IP的设置,由于需要局域网其他PC连接到虚拟机上,所以它的IP必须使局域网内其他电脑都可以连接。在虚拟机上点击设置à网络适配器à选中桥接模式,然后重启。测试一下,通过命令:ifconfig,查看IP,然后通过局域网内其他PC是否能够ping通。

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
MySQL's Place: Databases and ProgrammingMySQL's Place: Databases and ProgrammingApr 13, 2025 am 12:18 AM

MySQL's position in databases and programming is very important. It is an open source relational database management system that is widely used in various application scenarios. 1) MySQL provides efficient data storage, organization and retrieval functions, supporting Web, mobile and enterprise-level systems. 2) It uses a client-server architecture, supports multiple storage engines and index optimization. 3) Basic usages include creating tables and inserting data, and advanced usages involve multi-table JOINs and complex queries. 4) Frequently asked questions such as SQL syntax errors and performance issues can be debugged through the EXPLAIN command and slow query log. 5) Performance optimization methods include rational use of indexes, optimized query and use of caches. Best practices include using transactions and PreparedStatemen

MySQL: From Small Businesses to Large EnterprisesMySQL: From Small Businesses to Large EnterprisesApr 13, 2025 am 12:17 AM

MySQL is suitable for small and large enterprises. 1) Small businesses can use MySQL for basic data management, such as storing customer information. 2) Large enterprises can use MySQL to process massive data and complex business logic to optimize query performance and transaction processing.

What are phantom reads and how does InnoDB prevent them (Next-Key Locking)?What are phantom reads and how does InnoDB prevent them (Next-Key Locking)?Apr 13, 2025 am 12:16 AM

InnoDB effectively prevents phantom reading through Next-KeyLocking mechanism. 1) Next-KeyLocking combines row lock and gap lock to lock records and their gaps to prevent new records from being inserted. 2) In practical applications, by optimizing query and adjusting isolation levels, lock competition can be reduced and concurrency performance can be improved.

MySQL: Not a Programming Language, But...MySQL: Not a Programming Language, But...Apr 13, 2025 am 12:03 AM

MySQL is not a programming language, but its query language SQL has the characteristics of a programming language: 1. SQL supports conditional judgment, loops and variable operations; 2. Through stored procedures, triggers and functions, users can perform complex logical operations in the database.

MySQL: An Introduction to the World's Most Popular DatabaseMySQL: An Introduction to the World's Most Popular DatabaseApr 12, 2025 am 12:18 AM

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

The Importance of MySQL: Data Storage and ManagementThe Importance of MySQL: Data Storage and ManagementApr 12, 2025 am 12:18 AM

MySQL is an open source relational database management system suitable for data storage, management, query and security. 1. It supports a variety of operating systems and is widely used in Web applications and other fields. 2. Through the client-server architecture and different storage engines, MySQL processes data efficiently. 3. Basic usage includes creating databases and tables, inserting, querying and updating data. 4. Advanced usage involves complex queries and stored procedures. 5. Common errors can be debugged through the EXPLAIN statement. 6. Performance optimization includes the rational use of indexes and optimized query statements.

Why Use MySQL? Benefits and AdvantagesWhy Use MySQL? Benefits and AdvantagesApr 12, 2025 am 12:17 AM

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

Describe InnoDB locking mechanisms (shared locks, exclusive locks, intention locks, record locks, gap locks, next-key locks).Describe InnoDB locking mechanisms (shared locks, exclusive locks, intention locks, record locks, gap locks, next-key locks).Apr 12, 2025 am 12:16 AM

InnoDB's lock mechanisms include shared locks, exclusive locks, intention locks, record locks, gap locks and next key locks. 1. Shared lock allows transactions to read data without preventing other transactions from reading. 2. Exclusive lock prevents other transactions from reading and modifying data. 3. Intention lock optimizes lock efficiency. 4. Record lock lock index record. 5. Gap lock locks index recording gap. 6. The next key lock is a combination of record lock and gap lock to ensure data consistency.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use