Search code examples
solrapache-zookeepersolrcloud

Solr with external zookeeper ensemble on three separate VMs not running in cloud mode (only 1 live node shown)


I'm trying to set up a solr cloud connected to an external zookeeper ensemble on three separate VMs. The VMs are running an Ubuntu 16.04 inside a VirtualBox with a bridged network.

For convenience I assigned the names zoo1, zoo2 and zoo3 to each VM respectively in the /etc/hosts files of each VM.

I installed zookeeper 3.4.8-1 on each VM via repositiory.

After editing 'myid' and 'zoo.conf' files on each VM I'm able to start the zookeeper ensemble. Asking for the status using the zkServer.sh script I get this result on zoo1 and zoo2:

$ /usr/share/zookeeper/bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /etc/zookeeper/conf/zoo.cfg
Mode: follower

The result for zoo3 looks the same except for the Mode: 'Mode: leader'

I'm also able to upload files to zookeeper which I can access from all three VMs once I uploded them to one zookeeper instance.

So zookeeper seems to run nicely, I think.


I installed Solr on each VM (zoo1, zoo2 and zoo3) following this how to: Taking Solr to Production (I left out the chroot part)

After starting solr on each machine as a service with

$ sudo service solr start

or using the start script

$ sudo /opt/solr/bin/solr start -c -z "zoo1:2181,zoo2:2181,zoo3:2181"

I can access the admin panel on each machine, yet I think solr doesn't run in cloud mode because the status gives me just one live node:

$ bin/solr status

Found 1 Solr nodes: 

Solr process 10642 running on port 8983
{
  "solr_home":"/var/solr/data",
  "version":"6.1.0 4726c5b2d2efa9ba160b608d46a977d0a6b83f94 - jpountz - 2016-06-13 09:46:58",
  "startTime":"2016-07-14T12:44:45.509Z",
  "uptime":"0 days, 0 hours, 23 minutes, 14 seconds",
  "memory":"40.6 MB (%8.3) of 490.7 MB",
  "cloud":{
    "ZooKeeper":"zoo1:2181,zoo2:2181,zoo3:2181",
    "liveNodes":"1",
    "collections":"0"}}

I tried adding 'SOLR_MODE=solrcloud' to my solr.in.sh but it didn't make any difference.

When I create a collection on one VM using the admin panel I can see the collection under 'cloud' in the admin panel on each VM. But it isn't distributed to zoo1, zoo2 and zoo3. Instead it shows only on 127.0.0.1.

Any help will be greatly appreciated! Thanks in advance. gerriT


Solution

  • Just after posting my question I found it:

    After setting the SOLR_HOST Variable to zoo1, zoo2 and zoo3 on each VM respectively it worked. My solr.in.sh now looks like this:

    [...]
    SOLR_MODE=solrcloud
    ZK_HOST="zoo1,zoo2,zoo3"
    
    # By default the start script uses "localhost"; override the hostname here
    # for production SolrCloud environments to control the hostname exposed to cluster state
    SOLR_HOST="zoo2"
    [...]
    

    for zoo2.

    Before SOLR_HOST was commented out.