Я установил hbase 0.98.13 на ubuntu, и он выглядит нормально. У меня есть пример программы клиента Java в Windows, чтобы создать таблицу в hbase. Если я упакую java-программу и ftp на ubuntu и запустил java-клиент локально, он может создать таблицу «люди» hbase. Однако, если я запускаю java-программу из Windows, таблица hbase не создается. Журнал hbase показывает, что сеанс устанавливается с моего ПК с Windows, который равен 10.154.14.43. Но после этого ничего не произошло. вот журнал hbase, когда я запускаю java-клиент из окон.hbase createtable не удалось из окон
2015-09-02 11:05:14,477 INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181] server.NIOServerCnxnFactory: Accepted socket connection from /10.154.14.43:59780
2015-09-02 11:05:14,479 INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181] server.ZooKeeperServer: Client attempting to establish new session at /10.154.14.43:59780
2015-09-02 11:05:14,500 INFO [SyncThread:0] server.ZooKeeperServer: Established session 0x14f8bf64aa20026 with negotiated timeout 40000 for client /10.154.14.43:59780
2015-09-02 11:05:19,013 DEBUG [LruStats #0] hfile.LruBlockCache: Total=415.43 KB, free=386.27 MB, max=386.68 MB, blockCount=4, accesses=99, hits=95, hitRatio=95.96%, , cachingAccesses=99, cachingHits=95, cachingHitsRatio=95.96%, evictions=89, evicted=0, evictedPerRun=0.0
2015-09-02 11:05:25,149 DEBUG [cju-linux,33912,1441162218543-BalancerChore] balancer.BaseLoadBalancer: Not running balancer because only 1 active regionserver(s)
2015-09-02 11:10:19,013 DEBUG [LruStats #0] hfile.LruBlockCache: Total=415.43 KB, free=386.27 MB, max=386.68 MB, blockCount=4, accesses=101, hits=97, hitRatio=96.04%, , cachingAccesses=101, cachingHits=97, cachingHitsRatio=96.04%, evictions=119, evicted=0, evictedPerRun=0.0
2015-09-02 11:10:25,149 DEBUG [cju-linux,33912,1441162218543-BalancerChore] balancer.BaseLoadBalancer: Not running balancer because only 1 active regionserver(s)
2015-09-02 11:15:19,013 DEBUG [LruStats #0] hfile.LruBlockCache: Total=415.43 KB, free=386.27 MB, max=386.68 MB, blockCount=4, accesses=103, hits=99, hitRatio=96.12%, , cachingAccesses=103, cachingHits=99, cachingHitsRatio=96.12%, evictions=149, evicted=0, evictedPerRun=0.0
2015-09-02 11:15:25,150 DEBUG [cju-linux,33912,1441162218543-BalancerChore] balancer.BaseLoadBalancer: Not running balancer because only 1 active regionserver(s)
2015-09-02 11:18:01,831 WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181] server.NIOServerCnxn: Exception causing close of session 0x14f8bf64aa20026 due to java.io.IOException: Connection reset by peer
2015-09-02 11:18:01,832 INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181] server.NIOServerCnxn: Closed socket connection for client /10.154.14.43:59780 which had sessionid 0x14f8bf64aa20026
2015-09-02 11:18:42,000 INFO [SessionTracker] server.ZooKeeperServer: Expiring session 0x14f8bf64aa20026, timeout of 40000ms exceeded
2015-09-02 11:18:42,000 INFO [ProcessThread(sid:0 cport:-1):] server.PrepRequestProcessor: Processed session termination for sessionid: 0x14f8bf64aa20026
Вот журнал, когда я запускаю java-клиент из той же ubuntu.
2015-09-02 10:54:22,890 INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181] server.NIOServerCnxnFactory: Accepted socket connection from /127.0.0.1:49964
2015-09-02 10:54:22,892 INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181] server.ZooKeeperServer: Client attempting to establish new session at /127.0.0.1:49964
2015-09-02 10:54:22,909 INFO [SyncThread:0] server.ZooKeeperServer: Established session 0x14f8bf64aa2001b with negotiated timeout 40000 for client /127.0.0.1:49964
2015-09-02 10:54:23,267 INFO [FifoRpcScheduler.handler1-thread-14] master.HMaster: Client=hduser/null create 'people', {NAME => 'contactinfo', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'false', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}, {NAME => 'name', DATA_BLOCK_ENCODING => 'NONE', BLOOMFILTER => 'ROW', REPLICATION_SCOPE => '0', VERSIONS => '1', COMPRESSION => 'NONE', MIN_VERSIONS => '0', TTL => 'FOREVER', KEEP_DELETED_CELLS => 'false', BLOCKSIZE => '65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}
2015-09-02 10:54:23,269 INFO [ProcessThread(sid:0 cport:-1):] server.PrepRequestProcessor: Got user-level KeeperException when processing sessionid:0x14f8bf64aa20000 type:create cxid:0x206 zxid:0x21d txntype:-1 reqpath:n/a Error Path:/hbase/table-lock/people Error:KeeperErrorCode = NoNode for /hbase/table-lock/people
2015-09-02 10:54:23,342 DEBUG [FifoRpcScheduler.handler1-thread-14] lock.ZKInterProcessLockBase: Acquired a lock for /hbase/table-lock/people/write-master:339120000000000
2015-09-02 10:54:23,370 INFO [MASTER_TABLE_OPERATIONS-cju-linux:33912-0] handler.CreateTableHandler: Create table people
2015-09-02 10:54:23,382 DEBUG [MASTER_TABLE_OPERATIONS-cju-linux:33912-0] util.FSTableDescriptors: Wrote descriptor into: file:/home/hduser/hbase/.tmp/data/default/people/.tabledesc/.tableinfo.0000000001
Как вы видите, появляется следующая строка, когда я запускаю java-клиент из ubuntu.
[FifoRpcScheduler.handler1-thread-14] master.HMaster: Client=hduser/null create 'people', .....
И вот мой исходный код.
public class CreateTable {
public static void main(String[] args) throws IOException {
Configuration config = HBaseConfiguration.create();
// Example of setting zookeeper values for HDInsight
// in code instead of an hbase-site.xml file
//
config.set("hbase.zookeeper.quorum", "cju-linux");
//config.set("hbase.zookeeper.property.clientPort", "2181");
//config.set("hbase.cluster.distributed", "true");
System.out.println("before creating table people 1111111111");
// create an admin object using the config
HBaseAdmin admin = new HBaseAdmin(config);
System.out.println("before creating table people 22222222");
// create the table...
HTableDescriptor tableDescriptor = new HTableDescriptor(TableName.valueOf("people"));
// ... with two column families
tableDescriptor.addFamily(new HColumnDescriptor("name"));
tableDescriptor.addFamily(new HColumnDescriptor("contactinfo"));
System.out.println("before creating table people 33333");
admin.createTable(tableDescriptor);
System.out.println("before creating table people 4444");
// define some people
String[][] people = {
{ "1", "Marcel", "Haddad", "[email protected]"},
{ "2", "Franklin", "Holtz", "[email protected]" },
{ "3", "Dwayne", "McKee", "[email protected]" },
{ "4", "Rae", "Schroeder", "[email protected]" },
{ "5", "Rosalie", "burton", "[email protected]"},
{ "6", "Gabriela", "Ingram", "[email protected]"} };
System.out.println("before creating table people xxxxxxxxxxxxxxxx");
HTable table = new HTable(config, "people1");
System.out.println("After creating table people");
// Add each person to the table
// Use the `name` column family for the name
// Use the `contactinfo` column family for the email
for (int i = 0; i< people.length; i++) {
Put person = new Put(Bytes.toBytes(people[i][0]));
person.add(Bytes.toBytes("name"), Bytes.toBytes("first"), Bytes.toBytes(people[i][1]));
person.add(Bytes.toBytes("name"), Bytes.toBytes("last"), Bytes.toBytes(people[i][2]));
person.add(Bytes.toBytes("contactinfo"), Bytes.toBytes("email"), Bytes.toBytes(people[i][3]));
table.put(person);
}
// flush commits and close the table
table.flushCommits();
table.close();
}
При запуске клиента Java из окон, сообщение «перед созданием таблицы людей 33333» печатается, но сообщение «перед созданием таблицы людей 4444» не выводится на печать.
После включения отладки программа Java-клиент работает на окнах выводит это сообщение
2015-09-02 15:41:25,737 INFO [main] client.HConnectionManager$HConnectionImplementation: getMaster attempt 2 of 35 failed; retrying after sleep of 200, exception=com.google.protobuf.ServiceException:org.apache.hadoop.hbase.ipc.RpcClient$FailedServerException: This server is in the failed servers list: localhost/127.0.0.1:48285
Я гугле и изменил мой/и т.д. файл/хостов на убунту нравится этот
10.154.14.5 localhost cju-linux
Я перезапустил hbase, он все равно не работает.
Как отладить эту проблему?