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

多机部署后,无法查询数据 #109

Closed
cs1317 opened this issue Jul 19, 2023 · 17 comments
Closed

多机部署后,无法查询数据 #109

cs1317 opened this issue Jul 19, 2023 · 17 comments

Comments

@cs1317
Copy link
Contributor

cs1317 commented Jul 19, 2023

我参考https://www.secretflow.org.cn/docs/scql/latest/zh-Hans/getting_started/deployment#create-docker-compose-file
部署了两方的SCQLEngine以及SCDB,但在测试SCQL,使用scdbclient进行两方联合查询时,报错:
image
容器里可以单独查询数据:
image
但使用scdbclient就无法执行查询:
image

@jingshi-ant
Copy link
Contributor

从报错上看是SCQLEngine访问MySQL错误,辛苦check下SCQLEngine配置中的连接串相关配置是否正确,以及在该节点内能否访问到对应MySQL

@jingshi-ant
Copy link
Contributor

检索报错相关信息,也许能提供一些帮助:https://stackoverflow.com/questions/16325607/cant-connect-to-local-mysql-server-through-socket-tmp-mysql-sock

@cs1317
Copy link
Contributor Author

cs1317 commented Jul 19, 2023

各个SCQLEngine启动的容器(engine-alice和engine-bob)里,是可以正常查询本节点的数据的

@jingshi-ant
Copy link
Contributor

mysql监听的是localhost还是具体的ip呢,如果不涉及隐私的话,方便分享下SCQLEngine的具体配置吗?

@cs1317
Copy link
Contributor Author

cs1317 commented Jul 19, 2023

各个SCQLEngine监听的是localhost,alice 的gflags.conf:
--listen_port=8080
--datasource_router=embed
--enable_scdb_authorization=true
--engine_credential=credential_alice
--server_enable_ssl=false
--scdb_enable_ssl_as_client=false
--peer_engine_enable_ssl_as_client=false
--embed_router_conf={"datasources":[{"id":"ds001","name":"mysql db","kind":"MYSQL","connection_str":"db=alice;user=root;password=cs940303;host=localhost;auto-reconnect=true"}],"rules":[{"db":"","table":"","datasource_id":"ds001"}]}
这是我的SCQLEngine和SCDB配置
config.zip

@jingshi-ant
Copy link
Contributor

感觉可能是host的原因,建议尝试将配置中的host=localhost改为host=127.0.0.1

@cs1317
Copy link
Contributor Author

cs1317 commented Jul 19, 2023

host改成127.0.0.1仍然报错,是否应该换成实际的ip?
image

@jingshi-ant
Copy link
Contributor

嗯,也辛苦确认下mysql的port是不是默认的3306.

@cs1317
Copy link
Contributor Author

cs1317 commented Jul 19, 2023

换成实际的ip也不行,容器里检查了mysql端口号是3306
image

@jingshi-ant
Copy link
Contributor

"connection_str":"

能否展示下在SCQLEngine的container内部访问mysql的过程?
因为文档里的mysql是个独立容器,从描述里看,您是每个SCQLEngine配置了本地的mysql?

@cs1317
Copy link
Contributor Author

cs1317 commented Jul 19, 2023

我也是用了文档里的独立容器的
image
然后就是很正常的mysql -uroot -pcs940303,然后use alice; 然后select * from user_credit;
image

@jingshi-ant
Copy link
Contributor

jingshi-ant commented Jul 19, 2023

确认下:对于SCQLEngine Alice来说,MySQL是个独立的容器,而不是和SCQLEngine在同一个容器中?(确认下我理解的对不对。。)
那host应该填具体的容器名:mysql 即可

@cs1317
Copy link
Contributor Author

cs1317 commented Jul 19, 2023

确实是这个原因,问题得到解决

@cs1317
Copy link
Contributor Author

cs1317 commented Jul 19, 2023

"connection_str":"

能否展示下在SCQLEngine的container内部访问mysql的过程? 因为文档里的mysql是个独立容器,从描述里看,您是每个SCQLEngine配置了本地的mysql?

SCQLEngine能否直接配置本地的mysql,alice_init.sql这种形式限制了我们业务中使用scql

@jingshi-ant
Copy link
Contributor

"connection_str":"

能否展示下在SCQLEngine的container内部访问mysql的过程? 因为文档里的mysql是个独立容器,从描述里看,您是每个SCQLEngine配置了本地的mysql?

SCQLEngine能否直接配置本地的mysql,alice_init.sql这种形式限制了我们业务中使用scql

可以配置的,在SCQLEngine中填正确可访问的host、port即可。

@cs1317
Copy link
Contributor Author

cs1317 commented Jul 20, 2023

image
您的意思是:配置了正确可访问的host、port后,docker-compose.yaml 文件 红框中的部分就可以去掉了?因为不需要生成这样的一个容器了?

@jingshi-ant
Copy link
Contributor

是的,只要有可访问的mysql服务,这个就不需要了。

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

No branches or pull requests

2 participants