11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Setting up a ZooKeeper Ensemble<br />

With an external ZooKeeper ensemble, you need to set things up just a little more carefully as compared to the<br />

Getting Started example.<br />

The difference is that rather than simply starting up the servers, you need to configure them to know about and<br />

talk to each other first. So your original zoo.cfg file might look like this:<br />

dataDir=/var/lib/zookeeperdata/1<br />

clientPort=2181<br />

initLimit=5<br />

syncLimit=2<br />

server.1=localhost:2888:3888<br />

server.2=localhost:2889:3889<br />

server.3=localhost:2890:3890<br />

Here you see three new parameters:<br />

initLimit: Amount of time, in ticks, to allow followers to connect and sync to a leader. In this case, you have 5<br />

ticks, each of which is 2000 milliseconds long, so the server will wait as long as 10 seconds to connect and sync<br />

with the leader.<br />

syncLimit: Amount of time, in ticks, to allow followers to sync with ZooKeeper. If followers fall too far behind a<br />

leader, they will be dropped.<br />

server.X: These are the IDs and locations of all servers in the ensemble, the ports on which they communicate<br />

with each other. The server ID must additionally stored in the /myid file and be located in the dataD<br />

ir of each ZooKeeper instance. The ID identifies each server, so in the case of this first instance, you would<br />

create the file /var/lib/zookeeperdata/1/myid with the content "1".<br />

Now, whereas with <strong>Solr</strong> you need to create entirely new directories to run multiple instances, all you need for a<br />

new ZooKeeper instance, even if it's on the same machine for testing purposes, is a new configuration file. To<br />

complete the example you'll create two more configuration files.<br />

The /conf/zoo2.cfg file should have the content:<br />

tickTime=2000<br />

dataDir=c:/sw/zookeeperdata/2<br />

clientPort=2182<br />

initLimit=5<br />

syncLimit=2<br />

server.1=localhost:2888:3888<br />

server.2=localhost:2889:3889<br />

server.3=localhost:2890:3890<br />

You'll also need to create /conf/zoo3.cfg:<br />

tickTime=2000<br />

dataDir=c:/sw/zookeeperdata/3<br />

clientPort=2183<br />

initLimit=5<br />

syncLimit=2<br />

server.1=localhost:2888:3888<br />

server.2=localhost:2889:3889<br />

server.3=localhost:2890:3890<br />

<strong>Apache</strong> <strong>Solr</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>6.0</strong><br />

558

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!