26

Running Solr w/ Etcd

 5 years ago
source link: https://www.tuicool.com/articles/hit/Jv2Iv2a
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Not a recommendation. Still experimenting. Not rigorously tested. Help needed. Intimidated.

Last week, while I was revisiting Apache Solr with Kubernetes , I thought we I might be able to repurpose Kubernetes to handle service discovery for Solr instead of Zookeeper. After all, Kubernetes (via etcd ) and Zookeeper seem to do a lot of the same things. Could etcd perhaps make Solr run leaner?

The idea of abandoning Zookeeper was a little disconcerting though. Anyone who comes from the Solr world will tell you if you are trying to run a Solr cluster without Zookeeper, “good luck” because Zookeeper and Solr are tightly coupled. I heard it a few times from some of the top Solr engineers on earth and the guys that said it are usually right.

But I started thinking about etcd , which is the service discovery component of Kubernetes. Of course, What if I could find a Zookeeper-like API for Solr to talk to etcd without a whole lot of rework? Lucky for all of us, someone else already did that, the kind folks at etc-io (formerly CoreOS) .

It was shockingly simple to run Solr with zetcd .

Here’s all you need to do to start zetcd (the Zookeeper-like layer on top of etcd in Kubernetes):

You need to have Go installed and the environment variables setup. If not, there’s an example in Step 1 or in the link in the previous sentence. If you have the language installed, you can start at Step 2 as seen below:

Step 1 (Example on Mac OS X)

$ brew install go
$ export GOPATH="$HOME/go"
$ export PATH="$PATH:$GOPATH/bin"

Step 2

$ go get github.com/etcd-io/zetcd/cmd/zetcd
$ zetcd --zkaddr 0.0.0.0:2181 --endpoints localhost:2379

Step 3

Then, start Solr in Standalone mode. Here’s the cloud example:

$ bin/solr start -e cloud -z localhost:2181 -noprompt

Solr is now talking to zetcd, which is really etcd, but it thinks it’s talking to Zookeeper. It’s that simple. Try it out and let me know how it goes in the comments. I am just starting to dig and have lots to learn.

Some features will not work like some of the commands you are accustomed to in the Zookeeper CLI. Another more obvious issue is the fact that zetcd does not expose CPU and heap size. I am digging into the likely reasons for that and hope we can address them soon.

We haven’t tested this integration really at all, but I am experimenting and we expect to provide some feedback in the coming weeks. Any help on that front would be greatly appreciated. This evolution could be great for Solr because it will afford organizations more flexibility in terms of how they deploy their full-text search applications in the cloud.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK