Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCQL API接口调用报错 #161

Closed
sqh539 opened this issue Oct 16, 2023 · 16 comments
Closed

SCQL API接口调用报错 #161

sqh539 opened this issue Oct 16, 2023 · 16 comments

Comments

@sqh539
Copy link

sqh539 commented Oct 16, 2023

我调用 /public/submit_and_get 接口报错
{"status":{"code":101,"message":"user root authentication failed","details":[]},"out_columns":[],"scdb_session_id":"","affected_rows":"0","warnings":[]}

我的入参是这样的:
{
"user": {
"user": {
"account_system_type": "NATIVE_USER",
"native_user": { "name": "root", "password": "testpass" }
}
},
"query": "show databases;",
"biz_request_id": "123455",
"db_name": "scdb"
}

@sqh539
Copy link
Author

sqh539 commented Oct 17, 2023

另外,我用客户端工具是可以连接并查询的
image

@sqh539
Copy link
Author

sqh539 commented Oct 17, 2023

这是postman调用:
image

@jingshi-ant
Copy link
Collaborator

scdbclient默认的用户名密码在对应的配置文件里,用里面的账密试试:cmd/scdbclient/users.json

@jingshi-ant
Copy link
Collaborator

另外补充问下:你们是修改了系统的默认密码吗?所以手动指定了root的账密

@sqh539
Copy link
Author

sqh539 commented Oct 17, 2023

另外补充问下:你们是修改了系统的默认密码吗?所以手动指定了root的账密

没改,用root账号测试了下,命令行用alice账号也是会报错:
image
容器内日志是这样的:
image
2023-10-17 13:21:20.10171 ERROR privileges.go:70 get user privilege record fail: user alice, host %
2023-10-17 13:21:20.10171 ERROR submit_handler.go:90 |RequestID:|SessionID:|ActionName:SCDBQueryHandler@/public/submit_query|CostTime:949.054?s|Reason:InvalidRequest|ErrorMsg:user alice authentication failed|Request:user:{user:{account_system_type:NATIVE_USER native_user:{name:"alice"}}} query:"asdfsd"|ClientIP:192.168.0.163
2023-10-17 13:21:20.10171 INFO server.go:162 |GIN|status=200|method=POST|path=/public/submit_query|ip=192.168.0.163|latency=1.397226ms|

@jingshi-ant
Copy link
Collaborator

可能是因为alice用户还没有创建? 用户需要创建后才能提交任务,系统默认刚刚启动的时候只有root用户,root可以用于创建其它user。

另外,启动scdbclient的时候,无需指定userName、passwd,可以通过switch root; switch alice; 来使用配置文件cmd/scdbclient/users.json里记录的账密

@sqh539
Copy link
Author

sqh539 commented Oct 17, 2023

可能是因为alice用户还没有创建? 用户需要创建后才能提交任务,系统默认刚刚启动的时候只有root用户,root可以用于创建其它user。

另外,启动scdbclient的时候,无需指定userName、passwd,可以通过switch root; switch alice; 来使用配置文件cmd/scdbclient/users.json里记录的账密

用户按快速开始上的sql 创建了,不创建用户是没办法切换用户的。
现在最后一步的联合查询报错了,好像是alice和bob之间调用公钥不对。
下面是报错内容:
bob> switch alice
alice> use demo
[demo]alice> SELECT ta.credit_rank, COUNT(*) as cnt, AVG(ta.income) as avg_income, AVG(tb.order_amount) as avg_amount FROM ta INNER JOIN tb ON ta.ID = tb.ID WHERE ta.age >= 20 AND ta.age <= 30 AND tb.is_active=1 GROUP BY ta.credit_rank;
[fetch]err: Code: 320, message:RunExecutionPlan create session(94a8a6b0-6ce4-11ee-b447-0242ac1f0002) failed, catch std::exception=[Enforce fail at engine/auth/authenticator.cc:55] self_public_key_ == pi.pub_key. self public key mismatched
Stacktrace:
#0 scql::engine::EngineServiceImpl::VerifyPublicKeys()+0x55d5caa91488
#1 scql::engine::EngineServiceImpl::RunExecutionPlan()+0x55d5caa9750c
#2 brpc::policy::ProcessHttpRequest()+0x55d5cd290321
#3 brpc::ProcessInputMessage()+0x55d5cd23ab97
#4 brpc::InputMessenger::InputMessageClosure::~InputMessageClosure()+0x55d5cd23b5f1
#5 brpc::InputMessenger::OnNewMessages()+0x55d5cd23c0a1
#6 brpc::Socket::ProcessEvent()+0x55d5cd3369fe
#7 bthread::TaskGroup::task_runner()+0x55d5cd390497
#8 bthread_make_fcontext+0x55d5cd37bb01

@jingshi-ant
Copy link
Collaborator

有报错信息吗,如果是公钥不匹配,可以参考这里:#157 (comment)

@jingshi-ant
Copy link
Collaborator

另外补充问下:你们是修改了系统的默认密码吗?所以手动指定了root的账密

没改,用root账号测试了下,命令行用alice账号也是会报错: image 容器内日志是这样的: image 2023-10-17 13:21:20.10171 ERROR privileges.go:70 get user privilege record fail: user alice, host % 2023-10-17 13:21:20.10171 ERROR submit_handler.go:90 |RequestID:|SessionID:|ActionName:SCDBQueryHandler@/public/submit_query|CostTime:949.054?s|Reason:InvalidRequest|ErrorMsg:user alice authentication failed|Request:user:{user:{account_system_type:NATIVE_USER native_user:{name:"alice"}}} query:"asdfsd"|ClientIP:192.168.0.163 2023-10-17 13:21:20.10171 INFO server.go:162 |GIN|status=200|method=POST|path=/public/submit_query|ip=192.168.0.163|latency=1.397226ms|

另外,这里的问题是怎么解决的呀~

@sqh539
Copy link
Author

sqh539 commented Oct 17, 2023

有报错信息吗,如果是公钥不匹配,可以参考这里:#157 (comment)

好的,谢谢

@sqh539
Copy link
Author

sqh539 commented Oct 17, 2023

另外补充问下:你们是修改了系统的默认密码吗?所以手动指定了root的账密

没改,用root账号测试了下,命令行用alice账号也是会报错: image 容器内日志是这样的: image 2023-10-17 13:21:20.10171 ERROR privileges.go:70 get user privilege record fail: user alice, host % 2023-10-17 13:21:20.10171 ERROR submit_handler.go:90 |RequestID:|SessionID:|ActionName:SCDBQueryHandler@/public/submit_query|CostTime:949.054?s|Reason:InvalidRequest|ErrorMsg:user alice authentication failed|Request:user:{user:{account_system_type:NATIVE_USER native_user:{name:"alice"}}} query:"asdfsd"|ClientIP:192.168.0.163 2023-10-17 13:21:20.10171 INFO server.go:162 |GIN|status=200|method=POST|path=/public/submit_query|ip=192.168.0.163|latency=1.397226ms|

另外,这里的问题是怎么解决的呀~

没有解决,之前是单独部署

另外补充问下:你们是修改了系统的默认密码吗?所以手动指定了root的账密

没改,用root账号测试了下,命令行用alice账号也是会报错: image 容器内日志是这样的: image 2023-10-17 13:21:20.10171 ERROR privileges.go:70 get user privilege record fail: user alice, host % 2023-10-17 13:21:20.10171 ERROR submit_handler.go:90 |RequestID:|SessionID:|ActionName:SCDBQueryHandler@/public/submit_query|CostTime:949.054?s|Reason:InvalidRequest|ErrorMsg:user alice authentication failed|Request:user:{user:{account_system_type:NATIVE_USER native_user:{name:"alice"}}} query:"asdfsd"|ClientIP:192.168.0.163 2023-10-17 13:21:20.10171 INFO server.go:162 |GIN|status=200|method=POST|path=/public/submit_query|ip=192.168.0.163|latency=1.397226ms|

另外,这里的问题是怎么解决的呀~

没解决,这个是我参考 #157 (comment) 多机部署的方式,在一台机器尝试部署的,后面换成单机版部署了。现在还有多机部署的方式吗?ip要怎么配置?

@jingshi-ant
Copy link
Collaborator

重构去除grm后,多机部署的文档还没及时更新(之前的 部署 文档),需要参考单机的配置文件,对engine增加公私钥对应的额外配置才能拉起来。 ip配置没有特殊邀请。

@sqh539
Copy link
Author

sqh539 commented Oct 18, 2023

重构去除grm后,多机部署的文档还没及时更新(之前的 部署 文档),需要参考单机的配置文件,对engine增加公私钥对应的额外配置才能拉起来。 ip配置没有特殊邀请。

没能理解,如果我在多个物理机器上部署,scdb、alice-engine、bob-engine容器安装在三台机器上,scdb是如何跟两台engine通信的呢?是在创建用户时写ip端口吗?
是类似这样吗:alter user alice with ENDPOINT 'ALICE_ENGINE_IP:ALICE_PORT'
ALICE_ENGINE_IP 是alice-engine的物理机ip,__ALICE_PORT__是容器部署时alice-engine暴漏的服务端口。

@jingshi-ant
Copy link
Collaborator

不好意思,有错字: ip配置没有特殊要求。
您理解是对的,通过alter可以指定不同参与方的engine的ip。

@sqh539
Copy link
Author

sqh539 commented Oct 18, 2023

不好意思,有错字: ip配置没有特殊要求。 您理解是对的,通过alter可以指定不同参与方的engine的ip。

好的,谢谢

Copy link

Stale issue message. Please comment to remove stale tag. Otherwise this issue will be closed soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants