mongodb - meteor 使用 Mongo Oplog 吗?

标签 mongodb meteor

如何检查 meteor 是否正在使用我的 mongo 的 oplog? 我有一个 mongo 集群,并为我的 meteor 设置了两个环境。

MONGO_URL=mongodb://mongo/app?replicaSet=rs0
MONGO_OPLOG_URL=mongodb://mongo/local?authSource=app

如何检查 opt 日志是否实际在使用中。 Meteor 可以回退到非常低效的查询轮询,但我想看看它是否与 oplog 一起正常工作。

有什么想法吗?

最佳答案

引用 Meteor 的 OplogObserveDriver docs 中的相关位:

How to tell if your queries are using OplogObserveDriver

For now, we only have a crude way to tell how many observeChanges calls are using OplogObserveDriver, and not which calls they are.

This uses the facts package, an internal Meteor package that exposes real-time metrics for the current Meteor server. In your app, run meteor add facts, and add the {{> serverFacts}} template to your app. If you are using the autopublish package, Meteor will automatically publish all metrics to all users. If you are not using autopublish, you will have to tell Meteor which users can see your metrics by calling Facts.setUserIdFilter in server code; for example:

Facts.setUserIdFilter(function (userId) {
  var user = Meteor.users.findOne(userId);
  return user && user.admin;
});

(When running your app locally, Facts.setUserIdFilter(function () { return true; }); may be good enough!)

Now look at your app. The facts template will render a variety of metrics; the ones we're looking for are observe-drivers-oplog and observe-drivers-polling in the mongo-livedata section. If observe-drivers-polling is zero or not rendered at all, then all of your observeChanges calls are using OplogObserveDriver!

关于mongodb - meteor 使用 Mongo Oplog 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39002192/

相关文章:

java - MongoDB $lookup 查询返回空字段

Python 字典 : removing u' chars

python - 在多线程应用程序中使用 mongodb 的正确方法

mongodb - 如何在 mongodb 中使用文本搜索跳过记录

meteor - 如何让手机屏幕一直亮着

javascript - Meteor:如何获取 useraccounts 包将新的用户文档写入远程集合​​?

javascript - 在meteorjs中过滤嵌套文档

javascript - 密码值返回未定义,但使用console.log显示时,用户可以看到

javascript - Mongo 运算符 $pull 不起作用(Meteor.js)

meteor + react : Server side routes?