连接外部Accumulo实例和java [英] Connecting an external Accumulo instance and java

查看:444
本文介绍了连接外部Accumulo实例和java的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Accumulo连接到VM。问题是,我无法将它与Java连接起来。我可以看到Apache推出的网页,但我无法使用代码。我认为这是一个缺乏知识问题而不是一个真正的问题,但我无法找到它的文档。所有示例都使用localhost作为zooServer名称,这显然不适用于我。

I am trying to connect to a VM with Accumulo. The problem is, I can't get it hooked up in Java. I can see the webpage Apache throws up, but I can't get it to work with code. I think this is a lack of knowledge issue rather than a real problem, but I can't find documentation on it. All the examples use localhost as the zooServer name, this obviously doesn't work for me.

所以,这是我的代码:

  String instanceName = "accumulo-02"
  String zooServers = "192.168.56.5, accumulo-02.localdomain:9997"
  ZooKeeperInstance inst = new ZooKeeperInstance(instanceName, zooServers)
  ....

其余部分并不重要,因为我无法连接到服务器。

The rest isn't important because I cannot connect to the server.

这也是用Groovy编写的。我刚刚为Java人员改变了我的代码。

This is also really written in Groovy. I just changed my code there for the Java guys.

编辑:
程序驻留在我的电脑上。 Accumulo,Hadoop和Zookeeper都在VM上。它的IP是IP和isntance名称是该名称。在accumulo的配置中,'accumulo-02'是主人,奴隶等的域......

The program resides on my computer. Accumulo, Hadoop, and Zookeeper are all on the VM. The ip of it is that IP and the isntance name is that name. In the config of accumulo, 'accumulo-02' is the domain for masters, slaves, and etc...

推荐答案

在连接到 <时,要正确指定 Apache ZooKeeper 节点的列表使用 ZooKeeperInstance 的href =http://accumulo.apache.org =nofollow> Apache Accumulo ,应将zooServers指定为:

To correctly specify the list of Apache ZooKeeper nodes when connecting to Apache Accumulo with the ZooKeeperInstance, the zooServers should be specified as:


  1. ZooKeeper的主机:端口逗号分隔列表已经设置并运行,没有空格

  2. 确保您使用客户端端口 ZooKeeper ,而不是 TServer 。 (端口 2181 是ZooKeeper的默认客户端端口。端口 9997 是TServers的默认客户端端口。)

  3. 如果你'在默认端口( 2181 )上重新运行ZooKeeper,您可以省略:port 部分,只留下以逗号分隔的 hosts 列表,或者你可以将它们组合在一起,如果你有一些在非标准端口上,有些在标准端口上,如 proxyhost,proxyhost:2182,thirdhost:2181

  4. 无论您使用 IP地址 主机名都无关紧要,只要您指定的内容可以从客户端,端口打开并且未被防火墙阻止。

  1. A comma-separated list of host:port that ZooKeeper is already set up and running on, without spaces.
  2. Ensure you are using the client port for ZooKeeper, and not the TServer. (Port 2181 is the default client port for ZooKeeper. Port 9997 is the default client port for TServers.)
  3. If you're running ZooKeeper on the default port (2181), you may omit the :port portion, leaving only a comma-separated list of hosts, or you can combine them if you have some on the non-standard port and some on the standard port, as in "proxyhost,proxyhost:2182,thirdhost:2181".
  4. It shouldn't matter whether you use the IP address or the hostname, so long as whatever you specify can be reached from the client, and the port is open and not blocked by a firewall.

请参阅JavaDoc评论构造函数这里

See the JavaDoc comment on the constructor here.

这篇关于连接外部Accumulo实例和java的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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