更新时间:2023-06-14 gmt 08:00
连接失败,提示:exception: login failed 以及 u-凯发k8国际娱乐官网入口
问题描述
使用如下命令连接dds实例时报错。
./mongo "mongodb://rwuser:xxxxxx@192.168.0.45:8635,192.168.0.96:8635/test?authsource=admin&replicaset=replica"
报错信息如下:
mongodb shell version v4.0.3 connecting to: mongodb://192.168.0.45:8635,192.168.0.96:8635/test?authsource=admin&replicaset=replica 2021-11-05t05:52:53.717 0000 i network [js] starting new replica set monitor for replica/192.168.0.45:8635,192.168.0.96:8635 2021-11-05t05:52:53.718 0000 i network [replicasetmonitor-taskexecutor] successfully connected to 192.168.0.45:8635 (1 connections now open to 192.168.0.45:8635 with a 5 second timeout) 2021-11-05t05:52:53.718 0000 i network [js] successfully connected to 192.168.0.96:8635 (1 connections now open to 192.168.0.96:8635 with a 5 second timeout) implicit session: session { "id" : uuid("5945d2a5-8275-4e3c-b06f-632f062a2ead") } mongodb server version: 4.0.3 2021-11-05t05:52:53.722 0000 i network [js] marking host 192.168.0.96:8635 as failed :: caused by :: location50692: can't authenticate against replica set node 192.168.0.96:8635 :: caused by :: error preflighting normalization: u_stringprep_prohibited_error 2021-11-05t05:52:53.722 0000 i network [js] successfully connected to 192.168.0.45:8635 (1 connections now open to 192.168.0.45:8635 with a 0 second timeout) 2021-11-05t05:52:53.723 0000 i network [js] marking host 192.168.0.45:8635 as failed :: caused by :: location50692: can't authenticate against replica set node 192.168.0.45:8635 :: caused by :: error preflighting normalization: u_stringprep_prohibited_error 2021-11-05t05:52:53.724 0000 i network [js] marking host 192.168.0.96:8635 as failed :: caused by :: location50692: can't authenticate against replica set node 192.168.0.96:8635 :: caused by :: error preflighting normalization: u_stringprep_prohibited_error 2021-11-05t05:52:53.725 0000 i network [js] marking host 192.168.0.45:8635 as failed :: caused by :: location50692: can't authenticate against replica set node 192.168.0.45:8635 :: caused by :: error preflighting normalization: u_stringprep_prohibited_error 2021-11-05t05:52:53.725 0000 e query [js] error: can't authenticate against replica set node 192.168.0.45:8635 :: caused by :: error preflighting normalization: u_stringprep_prohibited_error : db.prototype._authorthrow@src/mongo/shell/db.js:1685:20 @(auth):6:1 @(auth):1:2 exception: login failed
可能原因
输入的实例密码异常。
排查思路
- 检查设置的dds实例密码中是否有‘@’、‘%’和‘!’字符,如果有,需要转义。
- dds实例当前支持的特殊字符,有(~ !@ # % ^ * - _ = ?,其中使用%@需要转义)。
处理方法
方法一:修改dds实例的密码,新密码中不能包含‘@’、‘%’和‘!’字符。
方法二:连接dds实例时,需要分别将‘@’、‘%’和‘!’字符进行转义,替换为对应的十六进制的url编码(ascii码)“@”、“%”和“!”。
例如:密码为****@%***!,对应的url编码为****@%***!。
背景知识
‘@’、‘%’和‘!’字符在dds实例连接时会作为特殊的字符进行处理,如果设置的dds实例中使用了上述字符,在使用高可用连接地址连接dds实例时,需要对其进行转义处理,否则不能得到预期的解析。
意见反馈
文档内容是否对您有帮助?
提交成功!非常感谢您的反馈,我们会继续努力做到更好!
您可在查看反馈及问题处理状态。
系统繁忙,请稍后重试
如您有其它疑问,您也可以通过华为云社区问答频道来与我们联系探讨