我有一个Sitecore 8测试环境,有三个用于xDB的mongo 2.6.5实例。这些配置为使用具有两个服务器的密钥文件的复制集' mongotest1' &安培; ' mongotest2'和一个仲裁者' mongotest3'已在mongo中为Web应用程序创建了非管理员帐户,该帐户存储在管理数据库中,并在所有五个xDB数据库中具有readWrite权限。我的sitecore连接字符串格式为:
connectionString="mongodb://webapp:password@mongotest1:27018,mongotest2.local:27019/sc8-tracking-history?replicaSet=repSet1&authSource=admin
请注意,仲裁器未在连接字符串中指定,这是正常的。
rs.status()给出以下看似正确的内容:
"date" : ISODate("2015-07-23T16:47:08Z"),
"myState" : 2,
"syncingTo" : "mongotest1.local:27018",
"members" : [
{
"_id" : 0,
"name" : "mongotest1.local:27018",
"health" : 1,
"state" : 1,
"stateStr" : "PRIMARY",
"uptime" : 93,
"optime" : Timestamp(1437668096, 1),
"optimeDate" : ISODate("2015-07-23T16:14:56Z"),
"lastHeartbeat" : ISODate("2015-07-23T16:47:07Z"),
"lastHeartbeatRecv" : ISODate("2015-07-23T16:47:08Z"),
"pingMs" : 0,
"electionTime" : Timestamp(1437669503, 1),
"electionDate" : ISODate("2015-07-23T16:38:23Z")
},
{
"_id" : 1,
"name" : "mongotest2.local:27019",
"health" : 1,
"state" : 2,
"stateStr" : "SECONDARY",
"uptime" : 93,
"optime" : Timestamp(1437668096, 1),
"optimeDate" : ISODate("2015-07-23T16:14:56Z"),
"infoMessage" : "syncing to: mongotest1.local:27018",
"self" : true
},
{
"_id" : 2,
"name" : "mongotest3.local:27020",
"health" : 1,
"state" : 7,
"stateStr" : "ARBITER",
"uptime" : 91,
"lastHeartbeat" : ISODate("2015-07-23T16:47:07Z"),
"lastHeartbeatRecv" : ISODate("2015-07-23T16:47:07Z"),
"pingMs" : 0
}
],
"ok" : 1
启动三个mongo实例时,会观察到正常的日志输出。但是,在Sitecore Web应用程序连接到mongo后,我看到使用' webapp'仲裁服务失败的帐户,因为仲裁服务器没有定义任何用户帐户的管理数据库。如果我关闭mongotest1和mongotest2实例,频率会增加。如果我关闭Sitecore,连接尝试将停止。
2015-07-23T18:02:42.741+0100 [conn699] end connection 127.0.0.1:62206 (2 connections now open)
2015-07-23T18:02:43.610+0100 [conn689] end connection 127.0.0.1:62193 (1 connection now open)
2015-07-23T18:02:43.611+0100 [initandlisten] connection accepted from 127.0.0.1:62207 #700 (3 connections now open)
2015-07-23T18:02:43.613+0100 [conn700] authenticate db: local { authenticate: 1, nonce: "xxx", user: "__system", key: "xxx" }
2015-07-23T18:02:43.890+0100 [initandlisten] connection accepted from 127.0.0.1:62208 #701 (3 connections now open)
2015-07-23T18:02:43.891+0100 [conn701] authenticate db: admin { authenticate: 1, user: "webapp", nonce: "xxx", key: "xxx" }
2015-07-23T18:02:43.891+0100 [conn701] Failed to authenticate webapp@admin with mechanism MONGODB-CR: AuthenticationFailed UserNotFound Could not find
user webapp@admin
为什么会这样?仲裁者不应该接收来自客户端的任何连接尝试。它好像副本集正在共享与Web应用程序的仲裁连接,然后调用某些连接尝试。
答案 0 :(得分:0)
这是一个众所周知的c-sharp驱动程序问题,请参阅https://jira.mongodb.org/browse/CSHARP-851
情况的某些方面是Sitecore发布特定的 - 捆绑驱动程序(v1.8.3.9)似乎稍微早于v2.6.5发布的驱动程序,这意味着它早于修复。
Sitecore 8更新5更新Mongo并包含修复程序。或者,可以通过upgrading the bundled MongoDB.Driver.dll to v1.9实现最小修复,并将程序集重定向添加到web.config。
我在http://blog.paulgeorge.co.uk/2016/01/26/sitecore-mongo-arbiter-shows-failed-authentication-attempts/
上写了一篇更详细的答案