不同副本集成员上的不同索引 [英] Different indexes on different replica set members

查看:96
本文介绍了不同副本集成员上的不同索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为mongo集群的一部分,我们有一个隐藏的节点,人们可以使用该节点进行报告.他们的查询与针对我们的主应用程序进行了优化的查询有很大的不同.

As part of our mongo cluster, we have a hidden node that the analytics people use for reporting. Their queries are quite a bit different than the ones that our main application is optimized for.

我们可以通过添加某些索引来极大地提高其查询的性能,这些索引的计算成本相对较高,并且占用大量内存.在我们的主成员和辅助成员上运行的任何查询都不应使用这些索引,因此在主副本集成员上花费时间和内存来计算报告索引并将其保留在内存中似乎有些愚蠢.

We can improve the performance of their queries quite dramatically by adding certain indexes, which are relatively expensive to compute, and take a fair amount of memory. Those indexes should not be used by any of the queries running on our primary and secondary members, so it seems a bit silly to spend time and memory on the main replica set members to compute and keep the reporting indexes in memory.

是否有一种创建索引的方法,使其仅存在于单个副本集成员上?有没有办法告诉我的主节点和辅助节点不要计算或存储我知道它们将不使用的索引?

Is there a way to create an index so that it only exists on a single replica set member? Is there a way to tell my primary and secondary nodes to not compute or store the indexes I know they will not use?

推荐答案

是的-您可以对用于在副本集中创建新索引的策略使用变体,而无需停机.这将要求在创建索引时使隐藏成员脱机.

Yes - you can use a variation on the strategy used for creating a new index in a replica set without down time. This will require that the hidden member be taken off-line while the index(es) are created.

以下是该策略的链接: http://docs. mongodb.org/manual/tutorial/build-indexes-on-replica-sets/#procedure

Here is the link for the strategy: http://docs.mongodb.org/manual/tutorial/build-indexes-on-replica-sets/#procedure

在这种情况下,您将使隐藏的成员脱机并以独立模式重新启动(删除--replSet选项并使用其他端口号).成员隔离后,您可以调整索引(删除不需要的索引并添加新的索引).创建完索引后,请使用旧端口和--replSet选项重新启动成员.

In your case you will take the hidden member off-line and restart in a standalone mode (remove the --replSet option and use a different port number). Once the member is isolated you can adjust the indexes (remove un-needed ones and add new ones). Once the indexes are done being created restart the member with the old port and --replSet option.

隐藏的成员将重新同步到副本集,您已全部设置好.

The hidden member will resync to the replica set and you are all set.

这篇关于不同副本集成员上的不同索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆