windows 环境下,IDEA 开发HBase与Java连接hbase长时间无反应问题

1.本地环境hbase1.2.1错用了hadoop-core.jar,应该使用hadoop2版本的jar

2.本地环境没有配置region Servers的host

要现在hbase安装主机上的ect\hosts文件里加上主机ip和主机名,如下第一行所示。192.168.187.209 ubuntu001

192.168.31.100 hadoop000
#192.168.187.209    localhost


因为我用windows系统调hbasePAI,在C\Windows\System32\drivers\etc\hosts 下添加用样的内容 
整体如下

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   192.168.10.106             Administrator
127.0.0.1       syf
192.168.10.106             Administrator
192.168.31.100 hadoop000

3.如果上述的方法依旧解决不了长时间连接无反应的问题,那么就是windows下hadoop环境不存在或者出现问题。
3.1 在项目中新建resources,并添加log4j.prpoerties日志文件

windows 环境下,IDEA 开发HBase与Java连接hbase长时间无反应问题_第1张图片
log4j.properties

log4j.rootCategory=info, console
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.target=System.err
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n

根据具体的报错原因去解决。
3.2 重新运行程序,报如下错误
19/09/04 16:26:01 ERROR Shell: Failed to locate the winutils binary in the hadoop binary path
java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries.
仔细查看报错是缺少winutils.exe程序。
 Hadoop都是运行在Linux系统下的,在windows下eclipse中运行mapreduce程序,要首先安装Windows下运行的支持插件(我的是hadoop2.6-common-bin.zip),
到网上下载与自己版本吻合的插件安装并配置。
将linux环境下的hadoop依赖包下载下来,解压在相应的目录,去如下网址:https://github.com/srccodes/hadoop-common-2.2.0-bin, 下载hadoop的插件,不要顾虑它的版本,不用怕,因为我用的最新的hadoop-2.7.0都没问题!下载好后,把winutils.exe加入你的hadoop-x.x.x/bin下。
配置hadoop环境变量
windows 环境下,IDEA 开发HBase与Java连接hbase长时间无反应问题_第2张图片
将hadoop的环境变量加入path
windows 环境下,IDEA 开发HBase与Java连接hbase长时间无反应问题_第3张图片
至此重启电脑后,问题便可以解决了
 

你可能感兴趣的:(大数据)