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 p2p部署好后执行查询,建立会话失败 #348

Open
yedoukk opened this issue Sep 3, 2024 · 4 comments
Open

scql p2p部署好后执行查询,建立会话失败 #348

yedoukk opened this issue Sep 3, 2024 · 4 comments

Comments

@yedoukk
Copy link

yedoukk commented Sep 3, 2024

./brokerctl run "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;" --project-id "demo" --host http://193.95.8.24:8084 --timeout 3
Error: run query: DoQuery response: {
"status": {
"code": 320,
"message": "RunExecutionPlan create session(bd2ac9f7-0139-11ef-b669-0242ac208902) failed, catch std::exception=[engine/link/mux_link_factory.cc:57] BrpcChannel init failed, ret=-1, remote_addr=http://193.95.8.25:8003, load_balancer=1, role=, protocol=baidu_std "
}
}

@wangzul
Copy link

wangzul commented Sep 3, 2024

可以提供一下SCQL版本。
双方节点的SCQLBroker,SCQLEngine 配置文件。

@yedoukk
Copy link
Author

yedoukk commented Sep 3, 2024

scql:latest(0.9.0b1)
全部配置如下:
-----alice-------

#config.yml
intra_server:
host: 0.0.0.0
port: 8084
inter_server:
port: 8081
log_level: debug
party_code: alice
session_expire_time: 24h
session_expire_check_time: 1m
party_info_file: "/home/admin/configs/party_info.json"
private_key_path: "/home/admin/configs/ed25519key.pem"
intra_host: broker:8084
engine:
timeout: 120s
protocol: http
content_type: application/json
uris:
- for_peer: http://193.95.8.24:8003
for_self: 193.95.8.24:8003
storage:
type: mysql
conn_str: "root:password123@tcp(mysql:3306)/brokeralice?charset=utf8mb4&parseTime=True&loc=Local&interpolateParams=true"
max_idle_conns: 10
max_open_conns: 100
conn_max_idle_time: 2m
conn_max_lifetime: 5m

#gflag.conf

--listen_port=8003
--datasource_router=embed
--enable_driver_authorization=false
--server_enable_ssl=false
--driver_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=password123;host=mysql;auto-reconnect=true"}],"rules":[{"db":"","table":"","datasource_id":"ds001"}]}

party authentication flags

--enable_self_auth=false
--enable_peer_auth=false

#docker-compose.yaml

version: '3.8'
services:
broker:
image: secretflow/scql:0.6.0b1
command:
- /home/admin/bin/broker
- -config=/home/admin/configs/config.yml
restart: always
ports:
- 8084:8084
- 8081:8081
volumes:
- ./config.yml:/home/admin/configs/config.yml
- ./party_info.json:/home/admin/configs/party_info.json
- ./ed25519key.pem:/home/admin/configs/ed25519key.pem
engine:
cap_add:
- NET_ADMIN
command:
- /home/admin/bin/scqlengine
- --flagfile=/home/admin/engine/conf/gflags.conf
image: secretflow/scql:0.6.0b1
ports:
- 8003:8003
volumes:
- ./gflags.conf:/home/admin/engine/conf/gflags.conf
mysql:
image: mysql:latest
environment:
- MYSQL_ROOT_PASSWORD=password123
- TZ=Asia/Shanghai
healthcheck:
retries: 10
test:
- CMD
- mysqladmin
- ping
- -h
- mysql
timeout: 20s
expose:
- "3306"
restart: always
volumes:
- ./alice_init.sql:/docker-entrypoint-initdb.d/alice_init.sql
- ./broker_init_alice.sql:/docker-entrypoint-initdb.d/broker_init_alice.sql

#创建参与方alice的密钥
openssl genpkey -algorithm ed25519 -out ed25519key.pem

#获取自己的公钥,以便给party_info.json中使用
openssl pkey -in ed25519key.pem -pubout -outform DER | base64

#party_info.json
{
"participants": [
{
"party_code": "alice",
"endpoint": "http://193.95.8.24:8081",
"pubkey": "MCowBQYDK2VwAyEA3Ijkj1iaGBtpTukw78vBr8j+IuuW3dohTMm9rO3wLOg="
},
{
"party_code": "bob",
"endpoint": "http://193.95.8.25:8081",
"pubkey": "MCowBQYDK2VwAyEAnRDPlvULRuuC9oIcQjBs6uHuonkdp1e+kP29cElocdo="
}
]
}

#启动服务
docker-compose -f docker-compose.yaml up -d

-------------bob------------------
#config.yml
intra_server:
host: 0.0.0.0
port: 8084
inter_server:
port: 8081
log_level: debug
party_code: bob
session_expire_time: 24h
session_expire_check_time: 1m
party_info_file: "/home/admin/configs/party_info.json"
private_key_path: "/home/admin/configs/ed25519key.pem"
intra_host: broker:8084
engine:
timeout: 120s
protocol: http
content_type: application/json
uris:
- for_peer: http://193.95.8.25:8003
for_self: 193.95.8.25:8003
storage:
type: mysql
conn_str: "root:password123@tcp(mysql:3306)/brokerbob?charset=utf8mb4&parseTime=True&loc=Local&interpolateParams=true"
max_idle_conns: 10
max_open_conns: 100
conn_max_idle_time: 2m
conn_max_lifetime: 5m

#gflags.conf
--listen_port=8003
--datasource_router=embed
--enable_driver_authorization=false
--server_enable_ssl=false
--driver_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=bob;user=root;password=password123;host=mysql;auto-reconnect=true"}],"rules":[{"db":"","table":"","datasource_id":"ds001"}]}

party authentication flags

--enable_self_auth=false
--enable_peer_auth=false

#docker-compose.yaml
version: '3.8'
services:
broker:
image: secretflow/scql:0.6.0b1
command:
- /home/admin/bin/broker
- -config=/home/admin/configs/config.yml
restart: always
ports:
- 8084:8084
- 8081:8081
volumes:
- ./config.yml:/home/admin/configs/config.yml
- ./party_info.json:/home/admin/configs/party_info.json
- ./ed25519key.pem:/home/admin/configs/ed25519key.pem
engine:
cap_add:
- NET_ADMIN
command:
- /home/admin/bin/scqlengine
- --flagfile=/home/admin/engine/conf/gflags.conf
image: secretflow/scql:0.6.0b1
ports:
- 8003:8003
volumes:
- ./gflags.conf:/home/admin/engine/conf/gflags.conf
mysql:
image: mysql:latest
environment:
- MYSQL_ROOT_PASSWORD=password123
- TZ=Asia/Shanghai
healthcheck:
retries: 10
test:
- CMD
- mysqladmin
- ping
- -h
- mysql
timeout: 20s
expose:
- "3306"
restart: always
volumes:
- ./bob_init.sql:/docker-entrypoint-initdb.d/bob_init.sql
- ./broker_init_bob.sql:/docker-entrypoint-initdb.d/broker_init_bob.sql

openssl genpkey -algorithm ed25519 -out ed25519key.pem

openssl pkey -in ed25519key.pem -pubout -outform DER | base64

#party_info.json
{
"participants": [
{
"party_code": "alice",
"endpoint": "http://193.95.8.24:8081",
"pubkey": "MCowBQYDK2VwAyEA3Ijkj1iaGBtpTukw78vBr8j+IuuW3dohTMm9rO3wLOg="
},
{
"party_code": "bob",
"endpoint": "http://193.95.8.25:8081",
"pubkey": "MCowBQYDK2VwAyEAnRDPlvULRuuC9oIcQjBs6uHuonkdp1e+kP29cElocdo="
}
]
}

@wangzul
Copy link

wangzul commented Sep 3, 2024

  1. docker-compose.yaml secretflow/scql:0.6.0b1 镜像版本最好使用和文档版本一致

  2. SCQLBroker. engine.uris - for_peer 去掉http:// 只使用ip:port 即可
    https://github.com/secretflow/scql/issues/286

@wangzul
Copy link

wangzul commented Sep 5, 2024

./brokerctl run "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;" --project-id "demo" --host http://193.95.8.24:8084 --timeout 3 Error: run query: DoQuery response: { "status": { "code": 320, "message": "RunExecutionPlan create session(bd2ac9f7-0139-11ef-b669-0242ac208902) failed, catch std::exception=[engine/link/mux_link_factory.cc:57] BrpcChannel init failed, ret=-1, remote_addr=http://193.95.8.25:8003, load_balancer=1, role=, protocol=baidu_std " } }

这个问题解决了吗

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