我们使用具有2个分片的分片MongoDB配置。有几个前端应用程序,它们通过mongos服务(安装在每个应用程序服务器上)检索数据。
问题是,从应用程序服务器#1运行相同的查询有时会返回空集合,而从应用程序服务器#3运行相同的查询则会返回正确的结果。
在运行flush命令之前,问题仍然存在于应用程序服务器1上。如文档所述:
“仅需在movePrimary已运行后运行flushRouterConfig 运行或手动清除巨型块标记后。”
但是主要对象没有移动,也没有清除标志。
任何想法为什么会发生这种情况?
配置文件
# mongos.conf
# for documentation of all options, see:
# http://docs.mongodb.org/manual/reference/configuration-options/
# where to write logging data.
systemLog:
destination: file
logAppend: false
logRotate: rename
path: /var/log/mongos.log
# how the process runs
processManagement:
fork: true # fork and run in background
pidFilePath: /var/run/mongos.pid # location of pidfile
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1,94.130.167.133,192.168.0.1 # Listen to local interface only, comment to listen on all interfaces.
security:
keyFile: /var/lib/database/mongos/.keyfile
sharding:
configDB: myproject-config/192.168.0.15:27027,192.168.0.16:27017,192.168.0.17:27017
printShardingStatus()
MongoDB shell version: 3.2.8
connecting to: cron0.myproject.smapps.org:27017/test
config.locks collection empty or missing. be sure you are connected to a mongos
--- Sharding Status ---
sharding version: {
"_id" : 1,
"minCompatibleVersion" : 5,
"currentVersion" : 6,
"clusterId" : ObjectId("2c5bc3fd9b2385s9613b0la5")
}
shards:
{ "_id" : "myproject0", "host" : "myproject0/192.168.0.11:27017,192.168.0.12:27017", "state" : 1, "tags" : [ ] }
{ "_id" : "myproject1", "host" : "myproject1/192.168.0.13:27017,192.168.0.18:27017", "state" : 1, "tags" : [ "game" ] }
{ "_id" : "myproject2", "host" : "myproject2/192.168.0.26:27017,192.168.0.28:27017", "state" : 1, "tags" : [ "game" ] }
active mongoses:
"4.0.6" : 14
balancer:
Currently enabled: yes
Currently running: no
Failed balancer rounds in last 5 attempts: 0
Migration Results for the last 24 hours:
8 : Success
databases:
{ "_id" : "myproject", "primary" : "myproject0", "partitioned" : true, "version" : { "uuid" : BinData(4,"+YxjwrKzTuekDlKutwT1IA=="), "lastMod" : 1 } }
...