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.

The .der files that are output from Step 2 should then be loaded to ZooKeeper under a node /keys/exe so they<br />

are available throughout every node. You can load any number of public keys to that node and all are valid. If a<br />

key is removed from the directory, the signatures of that key will cease to be valid. So, before removing the a<br />

key, make sure to update your runtime library configurations with valid signatures with the update-runtimeli<br />

b command.<br />

At the current time, you can only use the ZooKeeper zkCli.sh (or zkCli.cmd on Windows) script to issue<br />

these commands (the <strong>Solr</strong> version has the same name, but is not the same). If you are running the embedded<br />

ZooKeeper that is included with <strong>Solr</strong>, you do not have this script already; in order to use it, you will need to<br />

download a copy of ZooKeeper v3.4.6 from http://zookeeper.apache.org/. Don't worry about configuring the<br />

download, you're just trying to get the command line utility script. When you start the script, you will connect to<br />

the embedded ZooKeeper. If you have your own ZooKeeper ensemble running already, you can find the script<br />

in $ZK_INSTALL/bin/zkCli.sh (or zkCli.cmd if you are using Windows).<br />

To load the keys, you will need to connect to ZooKeeper with zkCli.sh, create the directories, and then create<br />

the key file, as in the following example.<br />

# Connect to ZooKeeper<br />

# Replace the server location below with the correct ZooKeeper connect string for<br />

your installation.<br />

$ .bin/zkCli.sh -server localhost:9983<br />

# After connection, you will interact with the ZK prompt.<br />

# Create the directories<br />

[zk: localhost:9983(CONNECTED) 5] create /keys<br />

[zk: localhost:9983(CONNECTED) 5] create /keys/exe<br />

# Now create the public key file in ZooKeeper<br />

# The second path is the path to the .der file on your local machine<br />

[zk: localhost:9983(CONNECTED) 5] create /keys/exe/pub_key.der<br />

/myLocal/pathTo/pub_key.der<br />

After this, any attempt to load a jar will fail. All your jars must be signed with one of your private keys for <strong>Solr</strong> to<br />

trust it. The process to sign your jars and use the signature is outlined in Steps 4-6.<br />

Step 4: Sign the jar File<br />

Next you need to sign the sha1 digest of your jar file and get the base64 string.<br />

$ openssl dgst -sha1 -sign priv_key.pem myjar.jar | openssl enc -base64<br />

The output of this step will be a string that you will need to add the jar to your classpath in Step 6 below.<br />

Step 5: Load the jar to the Blob Store<br />

Load your jar to the Blob store, using the Blob Store API. This step does not require a signature; you will need<br />

the signature in Step 6 to add it to your classpath.<br />

curl -X POST -H 'Content-Type: application/octet-stream' --data-binary @{filename}<br />

http://localhost:8983/solr/.system/blob/{blobname}<br />

The blob name that you give the jar file in this step will be used as the name in the next step.<br />

Step 6: Add the jar to the Classpath<br />

Finally, add the jar to the classpath using the Config API as detailed above. In this step, you will need to provide<br />

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

500

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

Saved successfully!

Ooh no, something went wrong!