尝试远程访问HBase时出错
问题描述:
我在java中使用HBase API,我只是运行一个测试程序来检索并在HBase表中创建一些记录。我的HBase在Amazon EC2 linux实例上配置。 我试图设置动物园管理员的IP和端口,但它给了我在下面.set
尝试远程访问HBase时出错
Configuration conf = new Configuration();
conf.set("hbase.zookeeper.quorum", HBaseConf.zookeeperIP);
conf.set("hbase.zookeeper.property.clientPort", HBaseConf.zookeeperPort);
它不承认.set
方法并给出语法错误的错误。我导入了所有必需的软件包,但没有任何帮助。有人可以告诉我如何解决这个问题。
答
您需要使用HBaseConfiguration
对象:
HBaseConfiguration conf = new HBaseConfiguration();
答
你应该使用Hbaseconfiguration.create()
答
private static Configuration conf = null;
/**
* Initialization
*/
static {
conf = HBaseConfiguration.create();
}
如果不工作,那么这样做,
加HBase的/ conf目录下的类路径,或者如果您正在使用eclipse/IDE,然后去建立路径 - >链接源并添加hbase/conf目录
同样的错误。请检查: https://drive.google.com/file/d/0B7Mh8qOofl7QNElVelJKRkxyaEk/view?usp=sharing – Sibtain 2015-02-10 10:52:43
我不知道你的jar版本,但它可能是:'Configuration conf = HBaseConfiguration.create() ;'以及。 – 2015-02-10 10:54:34
这也不适合我。我正在使用hbase-0.94.26.jar。 我应该在我的eclipse项目中包含hbase-site.xml吗? – Sibtain 2015-02-10 10:59:03