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

scqlengine部署失败,msg=[Enforce fail at engine/auth/pkey.cc:43] fp. Failed to open file: #157

Closed
chansono opened this issue Oct 12, 2023 · 9 comments

Comments

@chansono
Copy link

参照“https://www.secretflow.org.cn/docs/scql/latest/zh-Hans/getting_started/deployment”进行scql部署。

  • 版本:latest
  • 问题:部署scqlengine(alice为例)时,engine容器启动失败。
  • docker ps 查看:
    image
  • docker logs 日志:
    image
  • 注:
    • latest与0.3.0b1版本相同报错;
    • 0.2.0b2可正常部署成功。
@jingshi-ant
Copy link
Contributor

您好,0.3.0b1版本因为去除了GRM,因此需要依赖公私钥来验证身份。
deployment还没有做及时的更新,因此新版无法正确部署。
建议:我们的 快速开始 文档的流程已经根据新版更新过了,建议您在我们更新deployment文档前,过一下 快速开始 (预计15min)并参照 快速开始 文档 的流程,修改补充engine的配置,以完成scql的多机部署。

@chansono
Copy link
Author

您好,0.3.0b1版本因为去除了GRM,因此需要依赖公私钥来验证身份。 deployment还没有做及时的更新,因此新版无法正确部署。 建议:我们的 快速开始 文档的流程已经根据新版更新过了,建议您在我们更新deployment文档前,过一下 快速开始 (预计15min)并参照 快速开始 文档 的流程,修改补充engine的配置,以完成scql的多机部署。

谢谢,已经成功部署了~~

@jingshi-ant
Copy link
Contributor

@chansono
赞~
另外如果您有兴趣,也非常欢迎您贡献更新 部署 文档,以帮助其它用户~

@chansono
Copy link
Author

chansono commented Oct 13, 2023

SCQL(0.3.0b1)多机部署

alice/bob的私钥生成与公钥交换

cd scql
examples/docker-compose/setup.sh

engine(alice为例)部署

1、alice相关测试文件拷贝到alice节点

  • 将“scql/examples/docker-compose/engine/alice”拷贝到alice节点,其中gflags.conf可能需要后续修改
  • 将“scql/examples/docker-compose/mysql/initdb/alice_init.sql”拷贝到alice节点
  • 部署文档中alice的“docker-compose.yaml”拷贝到alcie节点,并后续修改
    捕获

2、docker-compose.yaml 修改后如下

version: "3.8"
services:
  engine:
    cap_add:
      - NET_ADMIN
    command:
      - /home/admin/bin/scqlengine
      - --flagfile=/home/admin/engine/conf/gflags.conf
    restart: always
    image: secretflow/scql:latest
    ports:
      - 8080:8080
    volumes:
      - ./conf/gflags.conf:/home/admin/engine/conf/gflags.conf
      - ./conf/ed25519key.pem:/home/admin/engine/conf/ed25519key.pem
      - ./conf/authorized_profile.json:/home/admin/engine/conf/authorized_profile.json
  mysql:
    image: mysql:latest
    environment:
      - MYSQL_ROOT_PASSWORD=testpass
      - 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

3、gflags.conf 修改后如下

--listen_port=8080
--datasource_router=embed
--enable_scdb_authorization=false
#--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=testpass;host=mysql;auto-reconnect=true"}],"rules":[{"db":"*","table":"*","datasource_id":"ds001"}]}
# party authentication flags
--enable_self_auth=true
--enable_peer_auth=true
--private_key_pem_path=/home/admin/engine/conf/ed25519key.pem
--authorized_profile_path=/home/admin/engine/conf/authorized_profile.json

scdb部署

scdb相关文件拷贝到scdb节点

  • 将“scql/examples/docker-compose/mysql/initdb/scdb_init.sql”拷贝到scdb节点
  • 将“scql/examples/docker-compose/scdb/conf/config.yml”拷贝到scdb节点
  • 部署文档中scdb的“docker-compose.yaml”拷贝到scdb节点
    捕获1

@jingshi-ant 大概总结了下~~

@chansono
Copy link
Author

@chansono 赞~ 另外如果您有兴趣,也非常欢迎您贡献更新 部署 文档,以帮助其它用户~

查询时出现问题:

  • 前提:已参考快速使用文档完成所有库、表、用户的创建与CCL授权等
  • docker-compose.yaml:参考部署文档
  • config.yml:参考部署文档或快速使用文档时,出现如下相同问题
  • 问题:查询时提示“认证失败”
    image

@jingshi-ant
Copy link
Contributor

感觉是scdb的遗留状态导致的,升级新版scdb后,scdb用于存储状态的table结构等都会变化。
建议docker compose down清理环境(或者只清理scdb对应的mysql),重新配置试试

@sqh539
Copy link

sqh539 commented Oct 17, 2023

感觉是scdb的遗留状态导致的,升级新版scdb后,scdb用于存储状态的table结构等都会变化。 建议docker compose down清理环境(或者只清理scdb对应的mysql),重新配置试试

重新部署后,最后查询时报错:
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
Contributor

看报错是公钥验证的问题(重新配置后,公钥文件可能会重新生成,导致不匹配),可以登录mysql对应的container,看公钥信息来简单验证是否scdb存储的公钥信息(在mysql中)和engine alice/bob配置文件中的是否匹配:
----------查看配置文件的公钥
cat examples/docker-compose/engine/*/conf/authorized_profile.json
----------查看mysql的公钥
docker exec -it mysql-1 bash
mysql -u root -ptestpass
select * from mysql.user;

或者直接关闭engine的公钥验证,增加如下gflags:
--enable_self_auth=false
--enable_peer_auth=false
然后docker restart对应engine

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

3 participants