首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >hbase createtable从windows失败

hbase createtable从windows失败
EN

Stack Overflow用户
提问于 2015-09-02 11:54:50
回答 2查看 147关注 0票数 0

我在ubuntu上设置了hbase 0.98.13,它看起来工作正常。我在Windows中有一个Java客户端示例程序,用于在hbase中创建表。如果我将java程序和ftp打包到ubuntu并在本地运行java客户端,它可以创建hbase表'people‘。但是,如果我从Windows运行java程序,则不会创建hbase表。hbase日志显示从我的windows PC 10.154.14.43建立了一个会话。但在那之后什么也没发生。这是我从windows运行java客户端时的hbase日志。

代码语言:javascript
复制
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

这是我在同一个ubuntu上运行java客户端时的日志。

代码语言:javascript
复制
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

如您所见,当我从ubuntu运行java客户端时,将显示以下代码行。

代码语言:javascript
复制
[FifoRpcScheduler.handler1-thread-14] master.HMaster: Client=hduser/null create 'people', .....

这是我的源代码。

代码语言:javascript
复制
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", "marcel@fabrikam.com"},
        { "2", "Franklin", "Holtz", "franklin@contoso.com" },
        { "3", "Dwayne", "McKee", "dwayne@fabrikam.com" },
        { "4", "Rae", "Schroeder", "rae@contoso.com" },
        { "5", "Rosalie", "burton", "rosalie@fabrikam.com"},
        { "6", "Gabriela", "Ingram", "gabriela@contoso.com"} };

    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();
  }

当我从windows运行java客户端时,打印出消息“在创建表格people 33333之前”,但没有打印出消息“在创建表格people 4444之前”。

打开debug后,运行在windows上的java客户端程序将打印出以下消息

代码语言:javascript
复制
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

我已经在谷歌上搜索并更改了我在ubuntu上的/etc/hosts文件,如下所示

代码语言:javascript
复制
10.154.14.5 localhost cju-linux

我重新启动了hbase,它仍然不能工作。

如何调试此问题?

EN

回答 2

Stack Overflow用户

发布于 2015-09-05 00:29:09

看起来当你在windows上运行它的时候,它在连接到集群或者说出正确的协议时会有问题。确保您的windows机器能够连接到集群中的所有机器(检查zookeeper、hmaster和region服务器主机和端口)。如果可以正常连接,请验证客户端和服务器是否都使用兼容版本(即0.98.x)。您还可以尝试单步执行createTable命令。如果您让它运行很长很长时间,当它放弃重试时,您可能还会看到一个异常,这可能会给您提供更多线索。您可以减少客户端重试次数,以使其更快实现。祝好运。

票数 0
EN

Stack Overflow用户

发布于 2015-09-11 02:45:38

您应该清除Zookeeper数据目录。为此,请停止Zookeeper,在hbase-site.xml中检查hbase.zookeeper.property.dataDir属性的值,清除此目录,然后重新启动Zookeeper。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32344397

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档