[英]Error on trying to remotely access HBase
I'm using the HBase API in java and I'm just running a test program to retrieve and create some records in HBase table. 我在Java中使用了HBase API,我只是运行一个测试程序来检索并在HBase表中创建一些记录。 My HBase is configured on a Amazon EC2 linux instance.
我的HBase在Amazon EC2 linux实例上配置。 I'm trying to set the zookeeper IP and port but it gives me error below at
.set
我正在尝试设置zookeeper的IP和端口,但在
.set
下却给我错误
Configuration conf = new Configuration();
conf.set("hbase.zookeeper.quorum", HBaseConf.zookeeperIP);
conf.set("hbase.zookeeper.property.clientPort", HBaseConf.zookeeperPort);
It does not recognize the .set
method and give syntax error. 它无法识别
.set
方法并给出语法错误。 I have imported all the necessary packages but nothing helps. 我已经导入了所有必需的程序包,但无济于事。 Can someone please tell me how to resolve this.
有人可以告诉我如何解决这个问题。
您需要使用HBaseConfiguration
对象:
HBaseConfiguration conf = new HBaseConfiguration();
您应该使用Hbaseconfiguration.create()
private static Configuration conf = null;
/**
* Initialization
*/
static {
conf = HBaseConfiguration.create();
}
if not work then do this, 如果不行,那就这样做
add hbase/conf directory on classpath or if you are using eclipse/IDE then go to build path --> link source and add hbase/conf directory 在类路径上添加hbase / conf目录,或者如果您使用的是eclipse / IDE,则转到构建路径->链接源并添加hbase / conf目录
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.