How to setup Solr Cloud with two search servers?

2019-07-04 05:16发布

Hi I'm developing rails project with sunspot solr and configuring Solr Cloud. My environment: rails 3.2.1, ruby 2.1.2, sunspot 2.1.0, Solr 4.1.6.

Why SolrCloud: I need more stable system - oftentimes search server goes on maintenance and web application stop working on production. So, I think about how to make 2 identical search servers instead of one, to make system more stable: if one server will be down, other will continue working.

I cannot find any good turtorial with simple, easy to understand and described in details turtorial... I'm trying to set up SolrCloud on two servers, but I do not fully understand how it is working inside:

  • synchronize data between two servers (is it automatic action?)
  • balances search requests between two servers
  • when one server suddenly stop working other should become a master (is it automatic action?)
  • is there SolrCloud features other than listed?

1条回答
ゆ 、 Hurt°
2楼-- · 2019-07-04 06:14

Read more about SolrCloud here..! https://wiki.apache.org/solr/SolrCloud

Couple of inputs from my experience.

If your application just reads data from SOLR and does not write to SOLR(in real time but you index using an ETL or so) then you can just go for Master Slave hierarchy.

Define one Master :- Point all writes to here. If this master is down you will no longer be able to index the data

Create 2(or more) Slaves :- This is an feature from SOLR and it will take care of synchronizing data from the master based on the interval we specify(Say every 20 seconds)

Create a load balancer based out of slaves and point your application to read data from load balancer.

Pros: With above setup, you don't have high availability for Master(Data writes) but you will have high availability for data until the last slave goes down.

Cons: Assume one slave went down and you bought it back after an hour, this slave will be behind the other slaves by one hour. So its manual task to check for data consistency among other slaves before adding back to ELB.

How about SolrCloud?

  1. No Master here, so you can achieve high availability for Writes too
  2. No need to worry about data inconsistency as I described above, SolrCloud architecture will take care of that.

What Suits Best for you.

  1. Define a external Zookeeper with 3 nodes Quorom
  2. Define at least 2 SOLR severs.
  3. Split your Current index to 2 shards (by default each shard will reside one each in 2 solr nodes defined in step #2
  4. Define replica as 2 (This will create replica for shards in each nodes)
  5. Define an LB to point to above solr nodes.
  6. Point your Solr input as well as application to point to this LB.

By above setup, you can sustain fail over for either nodes.

Let me know if you need more info on this.

Regards,

Aneesh N

-Let us learn together.

查看更多
登录 后发表回答