6

我对 Hadoop 和 Hbase 非常陌生,Hbase 与 RDMS 完全不同。我想创建一个表并使用 MapReduce 将其加载到 Hbase 中。Hadoop 和 Hbase 位于不同的服务器中。我可以使用 IP 地址、用户名和密码使用“腻子”访问该服务器。在 JDBC 中,我们可以使用驱动程序、用户名和密码进行配置,但在 HBase 中,我可以如何为我机器中的应用程序配置 IP 地址、用户名和密码。我检查了“hbase-site.xml”。

4

2 回答 2

5

您可以使用对象连接到远程 HBase。使用该类,您可以在像 hbase-site.xml 这样的 xml 文件中设置所有必要的参数,并使用 addResource 方法示例将文件名传递给 Configuration 对象:

org.apache.hadoop.conf.Configuration hbaseConfiguration = HBaseConfiguration.create();
hbaseConfiguration.addResource(new Path("/home/john/hbase-site.xml));
于 2012-10-28T05:58:53.010 回答
5

连接到远程系统时,您可以使用此代码进行配置

config.set("hbase.zookeeper.quorum", args[0]);// ip of hbase server(remote)
config.set("hbase.zookeeper.property.clientPort", args[1]);// portno : 2181 default
编辑 hbase 目录中的 conf/regionservers 文件以在其中添加 Hbase 服务器(远程)(我这样做了,不需要编辑 etc/hosts 以在我的办公室网络中获取 hbase 服务器),即在编辑 regionservers 后看起来像

localhost
远程hbase服务器的ip地址

例如
本地主机
10.132.258.366

于 2012-10-30T09:37:09.043 回答