aws lambda:connect with hbase期间的连接超时

piztneat  于 2021-06-02  发布在  Hadoop
关注(0)|答案(0)|浏览(262)

我有一套安装了apachehbase的aws机器。我正在通过aws lambda访问hbase表并得到超时错误。它的功能似乎可以访问机器,但无法在hbase上进行操作。我检查了vpc设置(子集、安全组、入站和出站端口)以连接zookeeper机器,但我觉得一切正常。
有人能告诉我发生了什么吗:

public Void handleRequest(String input, Context context) {
        context.getLogger().log("Input: " + input);
        Configuration hbaseConf = new Configuration();

        hbaseConf.set("hbase.zookeeper.quorum", "XXX.XX.XX.XX");
        hbaseConf.set("hbase.zookeeper.property.clientPort", "2181");
        hbaseConf.set("hbase.cluster.distributed", "true");
        hbaseConf.set("hbase.rootdir", "hdfs://XXX.XX.XX.XX:9000/hbase");
        hbaseConf.set("hbase.master", "XXX.XX.XX.XX:16000");
        @SuppressWarnings("deprecation")
        HTable hTable = null;
        try {
            hTable = new HTable(hbaseConf, "rulesoutput_abc");
        } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }

        Put p = new Put(Bytes.toBytes(input)); 

        p.add(Bytes.toBytes("cf"),
                  Bytes.toBytes("datareceived"),Bytes.toBytes("raju"));
        context.getLogger().log("put value: " + p);
        try {
            hTable.put(p);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
          System.out.println("data inserted");

          // closing HTable
          try {
            hTable.close();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        return null;
    }

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题