Skip to content

Instantly share code, notes, and snippets.

@amccarty
Created August 16, 2016 20:51
Show Gist options
  • Save amccarty/f74167a40ce4ed6e08dc59dcbb27c036 to your computer and use it in GitHub Desktop.
Save amccarty/f74167a40ce4ed6e08dc59dcbb27c036 to your computer and use it in GitHub Desktop.
Configure solr 6.1 and external zookeeper ensemble
solr 6.1 and zookeeper
1. install solr via puppet
2. stop solr
3. install zookeeper
cd /cul/share
sudo wget http://apache.claz.org/zookeeper/stable/
zookeeper-3.4.8.tar.gz
sudo tar xvzf zookeeper-3.4.8.tar.gz ; sudo ln -s zookeeper-3.4.8 zookeeper
4. configure zookeeper (zoo.cfg, myid)
create /cul/share/zookeeper/conf/zoo.cfg:
#############################
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/cul/share/zookeeper/tmp
clientPort=2181
server.1=aws-110-194.internal.library.cornell.edu:2888:3888
server.2=aws-110-195.internal.library.cornell.edu:2888:3888
server.3=aws-110-196.internal.library.cornell.edu:2888:3888
#############################
Create /cul/share/zookeeper/tmp/myid
- contents should simply the server.X number from the config, i.e., the myid content for server "aws-110-194.internal.library.cornell.edu" should be "1"
5. start zookeeper
sudo /cul/share/zookeeper/bin/zkServer.sh start
test/check node status:
echo stat | nc localhost 2181 | grep Mode
results should be "Mode: follower" or "Mode: leader"
6. configure solr (/etc/default, solr.xml)
Change the following lines in /cul/data/solr/data/solr.xml:
<str name="host">${host:}</str>
to:
<str name="host">aws-110-194.internal.library.cornell.edu</str>
(where "aws-110-194.internal.library.cornell.edu" is the server's hostname. IP address can be used here as well)
Add/change the following lines in /etc/default/solr.in.sh:
SOLR_PORT="8983"
SOLR_MODE=solrcloud
ZK_HOST=aws-110-194.internal.library.cornell.edu:2181,aws-110-195.internal.library.cornell.edu:2181,aws-110-196.internal.library.cornell.edu:2181
7. start solr
8. upload solr config to zookeeper
sh /cul/app/solr/solr-6.1.0/server/scripts/cloud-scripts/zkcli.sh -zkhost aws-110-194.internal.library.cornell.edu:2181,aws-110-195.internal.library.cornell.edu:2181,aws-110-196.internal.library.cornell.edu:2181 -cmd upconfig -confname data_driven -confdir /cul/app/solr/solr/server/solr/configsets/data_driven_schema_configs/conf
9. Verify the config made it to zookeeper
/cul/share/zookeeper/bin/zkCli.sh
[zk: localhost:2181(CONNECTED) 0] ls /configs
[data_driven]
10. Create a collection
On a single node, hit the following URL:
http://aws-110-195.internal.library.cornell.edu:8983/solr/admin/collections?action=CREATE&name=test_solrcloud&numShards=2&replicationFactor=2&maxShardsPerNode=2&collection.configName=data_driven
11. Verify by checking the cloud config
http://aws-110-195.internal.library.cornell.edu:8983/solr/#/~cloud
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment