保持 Solr 从站同步 [英] Keep Solr slaves in sync
问题描述
我们有一个运行 Solr 6.5.0 的主从设置.有一个 24/7 全天候运行的后端进程将其数据推送到主服务器.在 master 上没有提交.Web 前端正在访问从站.复制轮询间隔为 1 小时.
We have a master-slave setup running Solr 6.5.0. There is a backend process running 24/7 which pushes its data towards the master server. No commit is done on master. The web frontend is accessing the slave. Replication poll interval is 1 hour.
到目前为止一切都很好,但是现在随着流量的增长,slave 上的 CPU 负载非常高.我认为最好的办法是向主服务器添加第二个从服务器,并让 Web 服务器通过现有的负载均衡器连接到两台 Solr 从服务器.我认为两个 Solr 从站将独立处理它们的复制,每个从站将在另一个时间轮询主站.
All is fine so far, but now as the traffic grows, the CPU load on slave is really high. I thought the best thing would be to add a second slave to the master and let the web servers connect via existing load balancers to the two Solr slave machines. I think that the two Solr slaves will handle their replication independently and each slave will poll the master at another time.
当主机接收 24/7 新数据时,我担心两台机器没有相同的数据集/版本.是否有一种管理工作量低的解决方案来强制两个从站同时从主站轮询新数据?(即,我试图避免设置真正的 Solr 集群,因为多个从服务器将满足我们的需求.)
As the master receives 24/7 new data I'm worried that both machines do not have the same data set/version. Is there a solution with low administration effort to force both slaves polling new data from master at the same time? (I.e. I'm trying to avoid setting up a real Solr cluster as multiple slaves will fit our needs.)
推荐答案
这里的问题是,在轮询间隔期间,您的从站可能不同步.在您的情况下,您有 1 小时的间隔.
The problem here is following, during your poll interval, potentially, your slaves could be out-of-sync. In your case you have 1 hour interval.
可以用最少的努力完成的事情是以下,您可以通过调用命令强制在从属服务器上同时进行复制:
The thing which could be done with minimal effort is following, you could force replication on slaves at the same time by calling the command:
http://slave_host:port/solr/core_name/replication?command=fetchindex
但是,我不确定您可以多久调用一次此命令,因为很可能您无法每分钟左右调用一次.
However, I'm not sure how often you could call this command, since most likely you couldn't do it every minute or so.
另一种可能性是在主索引上执行提交时触发复制.您可以通过添加配置来做到这一点:
Another possibility is to trigger replication whenever a commit is performed on the master index. You could do this by adding configuration:
<str name="replicateAfter">commit</str>
有关它的更多信息,请查看这里
For more information about it take a look here
这篇关于保持 Solr 从站同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!