hadoop和hbase都部署在linux下,但是我们习惯在windows下使用eclipse编写java,所以就有了这个蛋疼的事情
环境:windows7 eclipse hbase-0.92.0
1、把需要用到的jar导入
需要的jar可以在linux下的HADOOP_HOME/lib和HBASE_HOME/lib下找到,需要的jar包如下:
2、配置文件hbase-site.xml:
<configuration> <property> <name>hbase.rootdir</name> <value>hdfs://192.168.1.128:9000/hbase</value> </property> <property> <name>hbase.cluster.distributed</name> <value>true</value> </property> <property> <name>hbase.master</name> <value>192.168.1.128:60000</value> </property> <property> <name>hbase.zookeeper.quorum</name> <value>192.168.1.128</value> </property> <property> <name>zookeeper.session.timeout</name> <value>60000</value> </property> <property> <name>hbase.zookeeper.prpperty.clientPort</name> <value>2181</value> </property> </configuration>
3、测试函数:
public static void main(String[] args) throws IOException {
Configuration conf