在 CouchDB Replicator 上设置 user_ctx 字段
"user_ctx": {
"name": "adminuser",
"role": "[\"_admin\"]"
},
"_replication_state": "error",
"_replication_state_time": "2011-08-30T15:09:03+00:00",
"_replication_id": "08fd9d6dcc5a0882fc9fd0d971b05938"
}
由于某种原因,我无法让我的复制器工作。日志继续显示“未经授权访问数据库”,指的是我的本地主机。我知道我需要设置 user_ctx,但由于某种原因它不喜欢工作。我从我的来源中复制了信息。我什至创建了新的管理员用户来尝试解决问题,但没有成功。我需要为用户指定更多角色吗?
另一个有很好的资源https://gist.github.com/832610,但是他设置的user_ctx在示例中不是管理员用户,它们似乎只是随机角色。
有人有 CouchDB 复制到本地主机的经验吗?
"user_ctx": {
"name": "adminuser",
"role": "[\"_admin\"]"
},
"_replication_state": "error",
"_replication_state_time": "2011-08-30T15:09:03+00:00",
"_replication_id": "08fd9d6dcc5a0882fc9fd0d971b05938"
}
For some reason, I can't get my replicator to work. The log continues to show "unauthorized to access database", referring to my localhost. I know I need to have user_ctx set, but for some reason it just doesn't like to work. I copied the info out of my source. I even created new admin users to try and fix the problem, none worked. Do I need to specify more roles for the user?
The other has a good resource https://gist.github.com/832610, but the user_ctx he set's in the example isn't the admin user, the appear to just be random roles.
Anyone have any experience with the CouchDB replicating to the localhost?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您以服务器管理员身份创建文档,则不需要此字段。我认为完全省略它会起作用。
如果您以普通用户身份创建文档,那么它应该与您的姓名和角色相匹配,您可以通过查询
/_session
获取这些信息。事实上,我认为您可以将会话响应中的 userCtx 字段直接复制到复制文档的 user_ctx 字段中。If you create the document as the server admin, then you do not need this field. I think omitting it completely will work.
If you create the document as a normal user, then it should match your name and roles which you can get by querying
/_session
. In fact, I think you can copy theuserCtx
field from the session response directly into theuser_ctx
field of the replication document.感谢 CouchDB Apache 邮件列表,了解我所做的事情。应该有“角色”而不是“角色”。
Found out what I did thanks to the CouchDB Apache Mailing Lists. Should have had "roles" instead of "role".