-
Notifications
You must be signed in to change notification settings - Fork 50
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中心化部署中 如何导入外部数据库 #355
Comments
mysql中是否初始化了employees. departments |
请问mysql中初始化 |
先确认下你的mysql中是否有这个db和table |
我运行 root> show databases;
[fetch]
1 rows in set: (3.381651ms)
+----------+
| Database |
+----------+
| demo |
+----------+ 但是我同样无法看到 CREATE DATABASE IF NOT EXISTS `alice`;
USE `alice`;
DROP TABLE IF EXISTS `user_credit`;
CREATE TABLE `user_credit` (
`ID` varchar(64) NOT NULL,
`credit_rank` int NOT NULL,
`income` int NOT NULL,
`age` int NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
LOCK TABLES `user_credit` WRITE;
INSERT INTO `user_credit` VALUES ("id0001", 6, 100000, 20);
INSERT INTO `user_credit` VALUES ("id0002", 5, 90000, 19);
INSERT INTO `user_credit` VALUES ("id0003", 6, 89700, 32);
INSERT INTO `user_credit` VALUES ("id0005", 6, 607000, 30);
INSERT INTO `user_credit` VALUES ("id0006", 5, 30070, 25);
INSERT INTO `user_credit` VALUES ("id0007", 6, 12070, 28);
INSERT INTO `user_credit` VALUES ("id0008", 6, 200800, 50);
INSERT INTO `user_credit` VALUES ("id0009", 6, 607000, 30);
INSERT INTO `user_credit` VALUES ("id0010", 5, 30070, 25);
INSERT INTO `user_credit` VALUES ("id0011", 5, 12070, 28);
INSERT INTO `user_credit` VALUES ("id0012", 6, 200800, 50);
INSERT INTO `user_credit` VALUES ("id0013", 5, 30070, 25);
INSERT INTO `user_credit` VALUES ("id0014", 5, 12070, 28);
INSERT INTO `user_credit` VALUES ("id0015", 6, 200800, 18);
INSERT INTO `user_credit` VALUES ("id0016", 5, 30070, 26);
INSERT INTO `user_credit` VALUES ("id0017", 5, 12070, 27);
INSERT INTO `user_credit` VALUES ("id0018", 6, 200800, 16);
INSERT INTO `user_credit` VALUES ("id0019", 6, 30070, 25);
INSERT INTO `user_credit` VALUES ("id0020", 5, 12070, 28);
UNLOCK TABLES; |
mysql中看,不是在scql中。应该起的有一个mysql容器 |
麻烦请教一下,怎么在MySQL中看呢?有文档可以参考吗 |
查询mysql容器的id,然后进入该容器 [wwh@gbase8c-72 ~]$ sudo docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b92dfa0e78ef mysql:latest "docker-entrypoint.s…" 12 days ago Up 12 days (healthy) 3306/tcp, 33060/tcp scdb-tutorial_mysql_1 但是在该mysql容器中好像没办法用root登陆,不知道要怎么在这个MySQL容器中查看数据库内容。 [wwh@gbase8c-72 ~]$ sudo docker exec -it b92dfa0e78ef bash
bash-5.1# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
bash-5.1# mysql -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) |
Stale issue message. Please comment to remove stale tag. Otherwise this issue will be closed soon. |
目前的想法是使用本地mysql数据库,而不是mysql镜像。修改docker-compose.yml version: '3.3'
services:
scdb:
image: secretflow/scql:latest
command:
- /home/admin/bin/scdbserver
- -config=/home/admin/configs/config.yml
restart: always
ports:
- mode: host
protocol: tcp
published: ${SCDB_PORT:-8080}
target: 8080
volumes:
- ./scdb/conf/:/home/admin/configs/
engine_alice:
cap_add:
- NET_ADMIN
command:
- /home/admin/bin/scqlengine
- --flagfile=/home/admin/engine/conf/gflags.conf
image: secretflow/scql:latest
volumes:
- ./engine/alice/conf/gflags.conf:/home/admin/engine/conf/gflags.conf
- ./engine/alice/conf/ed25519key.pem:/home/admin/engine/conf/ed25519key.pem
- ./engine/alice/conf/authorized_profile.json:/home/admin/engine/conf/authorized_profile.json
engine_bob:
cap_add:
- NET_ADMIN
command:
- /home/admin/bin/scqlengine
- --flagfile=/home/admin/engine/conf/gflags.conf
image: secretflow/scql:latest
volumes:
- ./engine/bob/conf/gflags.conf:/home/admin/engine/conf/gflags.conf
- ./engine/bob/conf/ed25519key.pem:/home/admin/engine/conf/ed25519key.pem
- ./engine/bob/conf/authorized_profile.json:/home/admin/engine/conf/authorized_profile.json
# mysql:
# image: mysql:latest
# environment:
# - MYSQL_ROOT_PASSWORD=gIr4h6BtVWEZ8
# - TZ=Asia/Shanghai
# healthcheck:
# retries: 10
# test:
# - CMD
# - mysqladmin
# - ping
# - -h
# - mysql
# timeout: 20s
# expose:
# - "3306"
# restart: always
# volumes:
# - ./mysql/initdb:/docker-entrypoint-initdb.d 但是发现注释掉mysql的部分之后,scdb容器无法成功启动,一直在restarting。 [wwh@gbase8c-72 scdb-tutorial]$ sudo docker ps -a | more
[sudo] password for wwh:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
NAMES
2d3b9c734517 secretflow/scql:latest "/home/admin/bin/scd…" 12 minutes ago Restarting (1) 8 seconds ago
scdb-tutorial_scdb_1
c13ea811bf7d secretflow/scql:latest "/home/admin/bin/scq…" 12 minutes ago Up 12 minutes
scdb-tutorial_engine_alice_1
3923680a3727 secretflow/scql:latest "/home/admin/bin/scq…" 12 minutes ago Up 12 minutes
scdb-tutorial_engine_bob_1 |
Stale issue message. Please comment to remove stale tag. Otherwise this issue will be closed soon. |
我按照官网的 基于中心化部署的快速开始 在单机上部署的SCQL系统。
注意到该手册的步骤中有一步是由alice创建了表格ta,指令如下:
通过查看文件我发现
mysql/initdb/
目录下的alice_init.sql
文件,该文件创建了一个表格alice.user_credit
并且在该表格中插入了一些数据。上述指令在创建表格demo.ta
时使用REF_TABLE
将这两个表格关联到了一起。我希望在SCQL中进行大数据集测试,而现有的
demo.ta
和demo.tb
不能满足我的需求,因此我在想如何能够将外部数据库导入到SCQL中。 我选取的数据库是 https://github.com/datacharmer/test_db.git,在该数据库的根目录下我找到了employees.sql
配置文件和储存数据的.dump
文件,并将他们移动到mysql/initdb/
目录下,如下图所示:其中
employees.sql
文件的部分内容如下:参考前文创建表格
demo.ta
语法格式,我切换到用户alice创建了表格demo.departments
:并且赋予了用户 alice 响应CCL权限
此时可以使用
DESCRIBE demo.departments
查看到该表信息但是最后在使用alice对该表进行查询时却无法成功,它提示我找不到数据库
employees
这里我不知道应该如何解决,不知道还有哪些细节没有做好呢The text was updated successfully, but these errors were encountered: