简体   繁体   中英

Solr cloud with external zookeeper

I am following this tutorial: https://gist.github.com/kalharbi/fd29661b9926eb087c45

configuring solr cloud with 2 nodes.

1.Configured zookeeper on both machine:192.168.1.56:2181(localadmin4), 192.168.1.55:2182(localadmin8) when checked status, both are working:

localadmin8@localadmin8:/opt/solr$ ../zookeeper/bin/zkServer.sh status /data/zookeeper/z2/zoo.cfg ZooKeeper JMX enabled by default Using config: /data/zookeeper/z2/zoo.cfg Mode: leader

localadmin4@localadmin4:/opt/solr$ ../zookeeper/bin/zkServer.sh status /data/zookeeper/z1/zoo.cfg 
ZooKeeper JMX enabled by default
Using config: /data/zookeeper/z1/zoo.cfg
Mode: follower

2.started solr

localadmin4@localadmin4:/opt/solr$ ./bin/solr start -c -p 8983 -z 192.168.1.56:2181,192.168.1.55:2182

localadmin8@localadmin8:/opt/solr$ ./bin/solr start -c -p 8984 -z 192.168.1.56:2181,192.168.1.55:2182

3.checked solr admin in browser: http://192.168.1.56:8983 , http://192.168.1.55:8984 . Both the solr are working fine.

4.uploaded configuration to zookeeper: localadmin4@localadmin4:/opt/solr$ ./server/scripts/cloud-scripts/zkcli.sh -cmd upconfig -zkhost 192.168.1.56:2181 -confdir ./server/solr/configsets/data_driven_schema_configs/conf/ -confname l-config

5.While creating collection: http://192.168.1.56:8983/solr/admin/collections?action=CREATE&name=onix&numShards=2&replicationFactor=1&collection.configName=l-config

it gives me following response:

<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">33011</int>
</lst>
<lst name="failure">
<str name="127.0.1.1:8984_solr">org.apache.solr.client.solrj.SolrServerException:Server refused connection at: http://127.0.1.1:8984/solr</str>
</lst>
<lst name="success">
<lst name="127.0.1.1:8983_solr">
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">1957</int>
</lst>
<str name="core">onix_shard2_replica1</str>
</lst>
</lst>
</response>

instead of hitting on 192.168.1.55:8984_solr , it is hitting 127.0.1.1:8984_solr.

How to resolve this issue?

This is probably caused by Solr detecting its own, wrong IP on startup, and thus, using the wrong IP when registering the node in the Solr cluster.

You can tell Solr which IP to use by giving the embedded Jetty container the IP to use (or for only intra-node communication, using SOLR_HOST should be enough).

Someone asked me how to ensure that Solr is exposed exclusively on a server's internal IP address so I thought this bit of information would be useful more generally. On Linux, edit the solr.in.sh file, find the property called SOLR_HOST (it is commented out by default) and set its value to the IP address or the host name that you want Solr to listen for requests.

SOLR_HOST="192.168.1.55"

The procedure is similar on Windows, except that the file to be edited is solr.in.cmd.

It was pointed out to me later that setting SOLR_HOST is not enough because the host/IP set by that property is only used by SolrCloud for making inter-shard requests. We also need to set a property used by Jetty in solr.in.sh or solr.in.cmd:

SOLR_OPTS="$SOLR_OPTS -Djetty.host=192.168.1.55"

Did you add IP like this 127.0.1.1 may it should be 127.0.0.1 crosscheck.

Also make sure you modified zoo.cfg file correctly with proper server nodes and server id mapping files.

ex:

 server.1=127.0.0.1:2222:2223
 server.2=127.0.0.1:3333:3334

My blog on External Zookeeper with Solr Cloud might help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM