oms调用api新建数据源报错

社区版, oms版本4.2.2, oceanbase集群版本4.2.2
调用api接口, v2?Action=CreateOceanBaseDataSource的body内容是{
“type”: “OB_MYSQL_CE”,
“name”:“ob-src-cdc”,
“schema”: “”,
“ip”:“10.xxxx”,
“port”:2883,
“tenant”:"",
“cluster”:"",
“userName”:“用户@租户#集群名”,
“password”:“xxxxxxx”,
“region”:“default”
} 报错{
“success”: false,
“errorDetail”: null,
“code”: null,
“message”: “查询数据库 ob-src-cdc 的版本失败:Could not connect to address=(host=xxxxxxxx)(port=2883)(type=master) : (conn=688698) cluster not exist。”,
“advice”: null,
“requestId”: “041571bb-6988-4cf5-9267-328dd83d692b”,
“pageNumber”: null,
“pageSize”: null,
“totalCount”: null,
“cost”: null,
“data”: null
}

请求body是 {
“type”: “OB_MYSQL_CE”,
“name”:“ob-src-cdc1”,
“schema”: “”,
“ip”:“10.xxxxxx”,
“port”:2883,
“tenant”:“租户”,
“cluster”:“集群名”,
“userName”:“用户名”,
“password”:“xxxxxx”,
“region”:“default”
} 报错 {
“success”: false,
“errorDetail”: null,
“code”: null,
“message”: “查询数据库 ob-src-cdc1 的版本失败:Could not connect to address=(host=xxxxxxx)(port=2883)(type=master) : (conn=688946) Access denied for user ‘root’@‘xxx.xxx.xxx.xxx’ (using password: YES)。”,
“advice”: null,
“requestId”: “3e3275ff-7697-43ef-b161-85c9ecda2d1b”,
“pageNumber”: null,
“pageSize”: null,
“totalCount”: null,
“cost”: null,
“data”: null
}
应该如何解决呢,body的参数应该如何填写,在控制面新建数据源没问题

第二个看着是密码错误,这个确认密码没有填错吗

没有填错,用户名和密码都没有修改过

在oms容器中使用mysql客户端链接一下数据库看看,另外/home/admin/logs/ghana/Ghana下名的日志查看一下具体的异常信息

出现这个错误原因是,密码没有进行加密,在OMS管控中会进行Base64.decodeStr(password)解密,您需要将body中的password进行Base64加密即可:Base64.encode(password)

使用数据库连接无问题,在控制面添加数据源无问题,另外/home/admin/logs/ghana/Ghana下名的日志里面没有查到具体的异常信息,具体是哪个日志呢

加密了,我用的postman发的请求,postman的authorization采用的是basic auth

你那个是请求的权限的账密,是Headers里面的,我指的是你请求体body里面ob的密码,需要进行加密,而不是原生密码
image

可以了,谢谢

{
“type”: “OB_MYSQL_CE”,
“cluster”: “”,
“tenant”: “test”,
“name”:“ob-des”,
“ip”:“10.xxxxx”,
“port”:2881,
“userName”:“root”,
“password”:“xxxxxx”,
“region”:“default”
},password是base64编码的,我换成2881端口为什么就是校验不通过呢,在oms控制面可以,{
“success”: false,
“errorDetail”: null,
“code”: null,
“message”: “查询数据库 ob-des 的版本失败:Could not connect to address=(host=10.)(port=2881)(type=master) : (conn=3221600660) Access denied for user ‘root’@‘xxx.xxx.xxx.xxx’ (using password: YES)。”,
“advice”: null,
“requestId”: “846a6b98-9129-49fb-8b5e-5226c5e9f937”,
“pageNumber”: null,
“pageSize”: null,
“totalCount”: null,
“cost”: null,
“data”: null
}

Could not connect to address=(host=10.)(port=2881)(type=master) : (conn=3221600660) Access denied for user ‘root’@‘xxx.xxx.xxx.xxx’ (using password: YES)。

  1. 检查用户名和密码是否正确
  2. 检查访问权限:如果密码正确但仍然无法连接,可能是该用户没有从特定IP地址访问的权限。需要在数据库中为root 用户添加或修改对应的IP地址访问权限

我在数据库运行直连的机器和oms运行中的容器里面发送curl请求报错{“success”:false,“errorDetail”:null,“code”:null,“message”:“查询数据库 ob-src 的版本失败:Could not connect to address=(host=10.xxxxxx)(port=2881)(type=master) : (conn=3221672717) Access denied for user ‘root’@‘xxx.xxx.xxx.xxx’ (using password: YES)。”,“advice”:null,“requestId”:“97028f88-0f4a-4eb0-9f3f-867c9ccaa58e”,“pageNumber”:null,“pageSize”:null,“totalCount”:null,“cost”:null,“data”:null}, 但是可以用客户端直接连接oceanbase集群,你说的 需要在数据库中为root 用户添加或修改对应的IP地址访问权限这个应该怎么添加呢

那概率就是你的账号或者密码输入错误,请检查你的传参tenant,cluster,userName,password ,我从你的请求中看到cluster是空字符串,还有密码是否是正确的明文加密过后的

如果没有集群,就填null。不要填空字符串

api不带集群的时候创建数据源会有问题,集群填null 会有强校验不能集群为空,当填写空字符串时,在OMS后台管控逻辑中会将userName拼接得有问题,会变成:user@tenant#,导致用户不正确,这个问题会在下一个迭代修复,感谢你的反馈,您先页面上创建下数据源

不是说用2881直连集群的时候不能带集群名吗,还是一样的报错,postman发请求直连还是不可以。