如何在类路径中包含hbase-site.xml [英] How to include hbase-site.xml in the classpath

查看:1332
本文介绍了如何在类路径中包含hbase-site.xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正试图让我的HBase代码使用我的hbase-site.xml中指定的设置。它似乎使用默认设置,而不是在hbase-site.xml配置文件中指定的设置。我已经在更新文件后重新启动了HBase群集,但它仍然没有使用我更新的配置文件。

I am currently trying to get my HBase code to use the settings specified in my hbase-site.xml. It seems to use default settings instead of what is specified in the hbase-site.xml config file. I have restarted the HBase cluster since updating the files, but it is still not using config files that I updated.

我使用的群集是2个节点,其中之一是主人。两个节点上的配置文件都指定主节点的IP作为动物园管理员法定人数。我相信问题在于我没有使用在hbase-site.xml中指定的设置,因为如果通过代码将zookeeper quorum设置为与我的hbase-site.xml中的值相同,但代码运行良好,但第二个节点不能如果没有通过代码指定法定人数,请联系主人。

The cluster I am using is 2 nodes, one of which is the master. The config files on both of the nodes specify the IP of the master node as the zookeeper quorum. I believe the problem is that my settings specified in hbase-site.xml are not being used because the code runs fine if I set the zookeeper quorum to the same value as in my hbase-site.xml via code, but the second node cannot contact the master if the quorum is not specified via code.

config = HBaseConfiguration.create();
config.set("hbase.zookeeper.quorum", masterNodeIP);

我非常感谢如何在我的代码的类路径中包含hbase-site.xml的说明或链接。我在Windows机器上使用Eclipse进行开发,并在Linux集群上安装HBase环境。由于依赖关系,我通常使用Eclipse来编译代码。

I would greatly appreciate instructions or a link on how to include hbase-site.xml into my code's classpath. I develop with Eclipse on a Windows machine and have the HBase environment installed on a Linux cluster. I usually use Eclipse to compile the code, due to dependencies.

理想情况下,我希望群集中的每个节点都使用自己的配置文件。

Ideally, I want each node in the cluster to use its own config file.

在此先感谢!

推荐答案

如果使用默认值, hbase-site.xml ,这可能意味着它正在被classpath中的另一个文件覆盖。这很可能,因为hbase jar中已经有 conf-site.xml

If it's using the default regardless of what you put in your hbase-site.xml, it probably means it is being overriden by another file in your classpath. This is very possible because there is already a conf-site.xml in the hbase jar.

解决这个问题,编辑你的类路径以在类路径的末尾添加包含你的 hbase-site.xml 的目录,以确保没有覆盖它。例如:

To fix this, edit your classpath to add the directory containing your hbase-site.xml at the end of the classpath to be sure nothing overrides it. Something like:

java -cp $CLASSPATH:/usr/lib/hbase/conf path.to.your.Mainclass

如果它太模糊了,我会建议从命令行运行而不是在Eclipse中,这样您就可以精确地确定你的类路径中有什么。

If it gets too obscure, I would advise running this from command line and not in Eclipse so you can be exactly sure of what you have in your classpath.

希望有帮助。

这篇关于如何在类路径中包含hbase-site.xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆