AWS EC2计算机上的Solrcloud配置

时间:2013-04-17 08:22:53

标签: solr amazon-web-services amazon-ec2 apache-zookeeper solrcloud

我在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?

1 个答案:

答案 0 :(得分:6)

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

在启动solr实例时只需给出-Dhost = x.y.com即可正常工作