11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Create the instance<br />

Creating the instance is a simple matter of extracting the files into a specific target directory. The actual directory<br />

itself doesn't matter, as long as you know where it is, and where you'd like to have ZooKeeper store its internal<br />

data.<br />

Configure the instance<br />

The next step is to configure your ZooKeeper instance. To do that, create the following file: <br />

/conf/zoo.cfg. To this file, add the following information:<br />

tickTime=2000<br />

dataDir=/var/lib/zookeeper<br />

clientPort=2181<br />

The parameters are as follows:<br />

tickTime: Part of what ZooKeeper does is to determine which servers are up and running at any given time, and<br />

the minimum session time out is defined as two "ticks". The tickTime parameter specifies, in miliseconds, how<br />

long each tick should be.<br />

dataDir: This is the directory in which ZooKeeper will store data about the cluster. This directory should start out<br />

empty.<br />

clientPort: This is the port on which <strong>Solr</strong> will access ZooKeeper.<br />

Once this file is in place, you're ready to start the ZooKeeper instance.<br />

Run the instance<br />

To run the instance, you can simply use the ZOOKEEPER_HOME/bin/zkServer.sh script provided, as with this<br />

command: zkServer.sh start<br />

Again, ZooKeeper provides a great deal of power through additional configurations, but delving into them is<br />

beyond the scope of this tutorial. For more information, see the ZooKeeper Getting Started page. For this<br />

example, however, the defaults are fine.<br />

Point <strong>Solr</strong> at the instance<br />

Pointing <strong>Solr</strong> at the ZooKeeper instance you've created is a simple matter of using the -z parameter when using<br />

the bin/solr script. For example, in order to point the <strong>Solr</strong> instance to the ZooKeeper you've started on port 2181,<br />

this is what you'd need to do:<br />

Starting cloud example with Zookeeper already running at port 2181 (with all other defaults):<br />

bin/solr start -e cloud -z localhost:2181 -noprompt<br />

Add a node pointing to an existing ZooKeeper at port 2181:<br />

bin/solr start -cloud -s -p 8987 -z localhost:2181<br />

NOTE: When you are not using an example to start solr, make sure you upload the configuration set to<br />

zookeeper before creating the collection.<br />

Shut down ZooKeeper<br />

To shut down ZooKeeper, use the zkServer script with the "stop" command: zkServer.sh stop.<br />

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

557

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

Saved successfully!

Ooh no, something went wrong!