How to setup Solr Cloud with two search servers?

别来无恙 提交于 2019-12-10 18:50:49

问题


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:


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.



来源:https://stackoverflow.com/questions/31766474/how-to-setup-solr-cloud-with-two-search-servers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!