我在服务器(192.168.36.42
)
package com.test;
import java.util.ArrayList;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.Put;
public class HBaseClient {
public static void main(String[] args) throws Exception {
Configuration config = HBaseConfiguration.create();
System.out.println("IP Address : " + config.get("hbase.zookeeper.quorum"));
HTable table = new HTable(config, "test_table");
ArrayList<Put> data = new ArrayList<Put>();
Put p = new Put("row3".getBytes());
p.add("field1".getBytes(), "qualifier".getBytes(), "value".getBytes());
table.put(data);
table.flushCommits();
data.clear();
table.close();
System.out.println("close table");
}
}
这是客户端的控制台输出:
14/02/26 16:21:31 INFO ipc.HBaseRPC: Server at BJ-NQ-V-CR002/192.168.36.42:44525 could not be reached after 1 tries, giving up.
14/02/26 16:21:33 INFO ipc.HBaseRPC: Server at BJ-NQ-V-CR002/192.168.36.42:44525 could not be reached after 1 tries, giving up.
14/02/26 16:21:35 INFO ipc.HBaseRPC: Server at BJ-NQ-V-CR002/192.168.36.42:44525 could not be reached after 1 tries, giving up.
14/02/26 16:21:37 INFO ipc.HBaseRPC: Server at BJ-NQ-V-CR002/192.168.36.42:44525 could not be reached after 1 tries, giving up.
客户端/etc/host
:
192.168.36.42 BJ-NQ-V-CR002
HBase的-site.xml中
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>hbase.zookeeper.quorum</name>
<value>BJ-NQ-V-CR002</value>
</property>
<property>
<name>hbase.zookeeper.property.clientPort</name>
<value>2181</value>
</property>
</configuration>
hbase(main):003:0> describe 'test_table'
DESCRIPTION ENABLED
'test_table', {NAME => 'field1', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', true
VERSIONS => '3', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => '2147483647', KEEP_DELETED_CELLS => 'false',
BLOCKSIZE => '65536', IN_MEMORY => 'false', ENCODE_ON_DISK => 'true', BLOCKCACHE => 'true'}, {NAME => 'field2', D
ATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'NONE', REPLICATION_SCOPE => '0', VERSIONS => '3', COMPRESSION => 'N
ONE', MIN_VERSIONS => '0', TTL => '2147483647', KEEP_DELETED_CELLS => 'false', BLOCKSIZE => '65536', IN_MEMORY =>
'false', ENCODE_ON_DISK => 'true', BLOCKCACHE => 'true'}
1 row(s) in 0.1680 seconds
的/ etc /主机
127.0.0.1 BJ-NQ-V-CR002
127.0.0.1 localhost localhost.localdomain
192.168.36.42 BJ-NQ-V-CR002
HBase的-site.xml中
<configuration>
<property>
<name>hbase.zookeeper.quorum</name>
<value>BJ-NQ-V-CR002</value>
</property>
<property>
<name>hbase.rootdir</name>
<value>file:///root/hbase-0.94.16/data/hbase</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/root/hbase-0.94.16/data/zookeeper</value>
</property>
</configuration>
regionservers
BJ-NQ-V-CR002
答案 0 :(得分:0)
您的日志不显示任何超时异常,只是一些zookeeper输出。不过我以前见过这个。
检查您是否可以从hbase shell put
。您可能只有一个服务于此表的区域服务器,并且存在问题。有问题的区域服务器已关闭或者表文件在hdfs上不可用。
重新启动区域服务器并查看其日志