Archery 定位于 SQL 审核查询平台,旨在提升 DBA 的工作效率,支持主流数据库的 SQL 上线和查询,同时支持丰富的 MySQL 运维功能
SQL 审核平台使用说明:
1. 安装【docker】
1. 安装docker docker-compose
yum install docker-ce docker-compose -y
2. 在线克隆 Archery文件,解压后进入docker-compose文件夹
git clone https://gitee.com/rtttte/Archery.git
3. 导入所需镜像
[root@rancher sql]# docker load -i hanchuanchuan.tar.gz
6b27de954cca: Loading layer [==================================================>] 5.857MB/5.857MB
87af49f9d15b: Loading layer [==================================================>] 42.75MB/42.75MB
9ab995984754: Loading layer [==================================================>] 8.704kB/8.704kB
e207ae07e188: Loading layer [==================================================>] 57.86kB/57.86kB
e8a9b13a1623: Loading layer [==================================================>] 430.1kB/430.1kB
515230ce1d90: Loading layer [==================================================>] 43.15MB/43.15MB
Loaded image: hanchuanchuan/goinception:latest
[root@rancher sql]# docker load -i hhyo.tar.gz
77b174a6a187: Loading layer [==================================================>] 211.2MB/211.2MB
d85ccd18552f: Loading layer [==================================================>] 94.56MB/94.56MB
98cb08f7cdae: Loading layer [==================================================>] 609.5MB/609.5MB
625c7084291b: Loading layer [==================================================>] 301.3MB/301.3MB
981b2a13b43c: Loading layer [==================================================>] 2.048kB/2.048kB
835ddf2cbbae: Loading layer [==================================================>] 27.05MB/27.05MB
759bbab96d33: Loading layer [==================================================>] 384.7MB/384.7MB
Loaded image: hhyo/archery:1.7.4
[root@rancher sql]# docker load -i hhyo11.tar.gz
d69483a6face: Loading layer [==================================================>] 209.5MB/209.5MB
20b417831e9a: Loading layer [==================================================>] 495.1MB/495.1MB
Loaded image: hhyo/inception:latest
[root@rancher sql]# docker load -i mysql.tar.gz
814c70fdae62: Loading layer [==================================================>] 58.51MB/58.51MB
25575e327c84: Loading layer [==================================================>] 338.4kB/338.4kB
61cb1c0dec27: Loading layer [==================================================>] 10.44MB/10.44MB
955b4c88a6e8: Loading layer [==================================================>] 4.472MB/4.472MB
fef9e518b701: Loading layer [==================================================>] 1.536kB/1.536kB
cf6a13051478: Loading layer [==================================================>] 46.15MB/46.15MB
2a60eb850753: Loading layer [==================================================>] 34.3kB/34.3kB
400dd8938406: Loading layer [==================================================>] 3.584kB/3.584kB
17d2117d1ff3: Loading layer [==================================================>] 321.7MB/321.7MB
ce4569bf481c: Loading layer [==================================================>] 15.87kB/15.87kB
ab91c8a5ef0a: Loading layer [==================================================>] 1.536kB/1.536kB
Loaded image: mysql:5.7
[root@rancher sql]# docker load -i redis.tar.gz
556c5fb0d91b: Loading layer [==================================================>] 72.48MB/72.48MB
2b21d53de9f8: Loading layer [==================================================>] 338.4kB/338.4kB
5fdf945168fa: Loading layer [==================================================>] 4.082MB/4.082MB
6e6898adda20: Loading layer [==================================================>] 24.67MB/24.67MB
b70080a68e79: Loading layer [==================================================>] 1.536kB/1.536kB
605f3ee488e1: Loading layer [==================================================>] 3.584kB/3.584kB
Loaded image: redis:5
2. 启动
[root@rancher ~]# cd Archery/src/docker-compose/
[root@rancher docker-compose]# docker-compose -f docker-compose.yml up -d
Creating network "dockercompose_default" with the default driver
Creating inception ... done
Creating inception ...
Creating mysql ...
Creating redis ...
Creating archery ...
3. 表结构初始化
[root@rancher docker-compose]# docker exec -ti archery /bin/bash
[root@c27b504bf61d archery]# cd /opt/archery/
[root@c27b504bf61d archery]# source /opt/venv4archery/bin/activate
(venv4archery) [root@c27b504bf61d archery]# python3 manage.py makemigrations sql
Migrations for 'sql':
sql/migrations/0001_initial.py
- Create model SlowQuery
- Create model SlowQueryHistory
- Create model Users
- Create model Config
- Create model DataMaskingRules
- Create model Instance
- Create model InstanceTag
- Create model Permission
- Create model QueryLog
- Create model ResourceGroup
- Create model SqlWorkflow
- Create model WorkflowAuditDetail
- Create model WorkflowLog
- Create model WorkflowAuditSetting
- Create model WorkflowAudit
- Create model SqlWorkflowContent
- Create model ResourceGroup2User
- Create model ResourceGroup2Instance
- Add field instances to resourcegroup
- Add field users to resourcegroup
- Create model QueryPrivilegesApply
- Create model ParamTemplate
- Create model ParamHistory
- Create model InstanceTagRelations
- Add field instances to instancetag
- Create model DataMaskingColumns
- Create model AliyunRdsConfig
- Create model QueryPrivileges
- Create model InstanceDatabase
- Create model InstanceAccount
(venv4archery) [root@c27b504bf61d archery]# python3 manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, django_q, sessions, sql
Running migrations:
Applying contenttypes.0001_initial... OK
Applying contenttypes.0002_remove_content_type_name... OK
Applying auth.0001_initial... OK
Applying auth.0002_alter_permission_name_max_length... OK
Applying auth.0003_alter_user_email_max_length... OK
Applying auth.0004_alter_user_username_opts... OK
Applying auth.0005_alter_user_last_login_null... OK
Applying auth.0006_require_contenttypes_0002... OK
Applying auth.0007_alter_validators_add_error_messages... OK
Applying auth.0008_alter_user_username_max_length... OK
Applying auth.0009_alter_user_last_name_max_length... OK
Applying auth.0010_alter_group_name_max_length... OK
Applying auth.0011_update_proxy_permissions... OK
Applying sql.0001_initial... OK
Applying admin.0001_initial... OK
Applying admin.0002_logentry_remove_auto_add... OK
Applying admin.0003_logentry_add_action_flag_choices... OK
Applying django_q.0001_initial... OK
Applying django_q.0002_auto_20150630_1624... OK
Applying django_q.0003_auto_20150708_1326... OK
Applying django_q.0004_auto_20150710_1043... OK
Applying django_q.0005_auto_20150718_1506... OK
Applying django_q.0006_auto_20150805_1817... OK
Applying django_q.0007_ormq... OK
Applying django_q.0008_auto_20160224_1026... OK
Applying django_q.0009_auto_20171009_0915... OK
Applying sessions.0001_initial... OK
4. 数据初始化
(venv4archery) [root@c27b504bf61d archery]# python3 manage.py loaddata initial_data.json
Installed 2 object(s) from 1 fixture(s)
5. 创建管理用户
(venv4archery) [root@c27b504bf61d archery]# python3 manage.py createsuperuser
用户名: chengyinwu
电子邮件地址: 991540698@qq.com
Password:
Password (again):
密码长度太短。密码必须包含至少 9 个字符。
这个密码太常见了。
密码只包含数字。
Bypass password validation and create user anyway? [y/N]: y
Superuser created successfully.
6. 重启服务
(venv4archery) [root@c27b504bf61d archery]# exit
exit
[root@rancher docker-compose]# docker restart archery
archery
检查9123端口
[root@rancher docker-compose]# lsof -i:9123
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
docker-pr 53588 root 4u IPv6 247471 0t0 TCP *:grcp (LISTEN)
7. 日志查看和问题排查
8. 访问http://10.0.0.201:9123即可
来源:CSDN
作者:寻花之梦~~
链接:https://blog.csdn.net/chengyinwu/article/details/103964205