4

我在 AWS EC2 机器上设置 SolrCloud 时遇到问题。剧情如下,

我为 zookeeper 和 solr 提供了三台服务器。

每台服务器上都运行着 zookeeper。当我使用 zookeeper 主机信息启动 Solr 时,它会按预期启动并工作。

问题是zookeeper在生成集群信息时使用服务器的私有IP,因此我无法使用无法识别私有IP的Solrj查询它。例如 server1。私有 IP ip-a,b,c,d 公共 IP : u,v,w,x Zookeeper 通过私有 IP 识别 solr 实例(显然从外部 EC2 机器看不到)

The cluster information looks something like this:
live nodes:[10.165.15.104:8983_solr] collections:{vicon=DocCollection(vicon)={
  "shards":{"shard1":{
      "range":"80000000-7fffffff",
      "state":"active",
      "replicas":{"10.165.15.104:8983_solr_vicon":{
          "shard":"shard1",
          "state":"down",
          "core":"vicon",
          "collection":"vicon",
          "node_name":"10.165.15.104:8983_solr",
          "base_url":"http://10.165.15.104:8983/solr",
          "leader":"true"}}}},
  "router":"compositeId"}, collection1=DocCollection(collection1)={
  "shards":{"shard1":{
      "range":"80000000-7fffffff",
      "state":"active",
      "replicas":{"10.165.15.104:8983_solr_collection1":{
          "shard":"shard1",
          "state":"down",
          "core":"collection1",
          "collection":"collection1",
          "node_name":"10.165.15.104:8983_solr",
          "base_url":"http://10.165.15.104:8983/solr",
          "leader":"true"}}}},
  "router":"compositeId"}, collections=DocCollection(collections)={
  "shards":{"shard1":{
      "range":"80000000-7fffffff",
      "state":"active",
      "replicas":{
        "10.165.15.104:8983_solr_collections":{
          "shard":"shard1",
          "state":"active",
          "core":"collections",
          "collection":"collections",
          "node_name":"10.165.15.104:8983_solr",
          "base_url":"http://10.165.15.104:8983/solr",
          "leader":"true"},
        "10.147.129.56:8983_solr_collections":{
          "shard":"shard1",
          "state":"down",
          "core":"collections",
          "collection":"collections",
          "node_name":"10.147.129.56:8983_solr",
          "base_url":"http://10.147.129.56:8983/solr"}}}},
  "router":"compositeId"}}

活动节点 IP 是私有 IP 而不是公共 IP

有什么方法可以让zookeeper将集群信息存储为主机名而不是ip。如果无法做到这一点,我该如何在 AWS EC2 机器上运行 solr Cloud?

4

1 回答 1

6

我想出了解决办法。我们可以使用 zookeeper 将使用的主机名启动 solr 服务器

只需在启动 solr 实例时给一个 -Dhost=xycom 就可以了

于 2013-04-24T04:10:46.993 回答