MySQL审核平台archery安装部署系统环境
Centos7.6
Docker19.03.12
Archery1.7.12
1.安装Docker
安装前⼀定要先检查以前是否安装过docker旧版本,不然安装不上最新版本,有安装就卸载yum list installed |grep docker
1.1安装yum管理⼯具
yum install -y yum-utils device-mapper-persistent-data lvm2
1.2添加docker的yum源
yum-config-manager --add-repo download.docker/linux/po
1.3查看可安装的版本(此步骤可跳过)
yum list docker-ce --showduplicates |sort -r
1.4安装docker-ce
yum install docker-ce -y
1.5查看版本和激活服务
#启动docker服务
systemctl start docker
#激活docker服务
systemctl enable docker
#查看docker版本
docker version
2.安装Archery
pip install docker-compose
docker pull registry-hangzhou.aliyuncs/lihuanhuan/archery
下载Archery-1.7.12.zip
#下载地址
github/hhyo/archery/releases/
#下载解压后路径pwd
/usr/local/Archery-1.7.12
#启动
cd /usr/local/Archery-1.7.12/src/docker-compose
docker-compose -l up -d
#由于⽹络问题可能会失败,多尝试⼏次
#安装后可以⽤命令查看docker ps
CONTAINER ID        IMAGE                      COMMAND                  CREATED            STATUS              PORTS                              NAMES
8abc468500bd        mysql:5.7                  "docker-entrypoint.s…"  2 hours ago        Up 2 hours          0.0.0.0:3306->3306/tcp, 33060/tcp  mysql b9ffa8710c65        hanchuanchuan/goinception  "/usr/local/bin/dumb…"  2 hours ago        Up 2 hours          4000/tcp                            goinception 5ebbaa722433        redis:5                    "docker-entrypoint.s…"  2 hours ago        Up 2 hours          6379/tcp                            redis
718e83ed00e6        hhyo/archery:1.7.12        "dockerize -wait tcp…"  2 hours ago        Up 2 hours          0.0.0.0:9123->9123/tcp              archery c77fb994581b        hhyo/inception              "/bin/sh -c 'nohup /…"  2 hours ago        Up 2 hours          6669/tcp                            inception
表结构初始化
#先创建数据库archery 字符集为UTF8。这样后去执⾏表结构初始化的时候才不会报错。
docker exec -it mysql bash mysql -uroot -p123456 CREATE DATABASE  archery;
docker exec -ti archery /bin/bash
cd /opt/archery
source /opt/venv4archery/bin/activate
python3 manage.py makemigrations sql
python3 manage.py migrate
执⾏成功如下
(venv4archery)[root@718e83ed00e6 archery]# python3 manage.py makemigrations sql
Migrations for'sql':
sql/migrations/0001_initial.py
- Create model SlowQuery
- Create model SlowQueryHistory
-
Create model ArchiveConfig
- Create model CloudAccessKey
- 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 Tunnel
-
Create model WorkflowAuditDetail
- Create model WorkflowLog
- Create model WorkflowAuditSetting
- Create model WorkflowAudit
- Create model SqlWorkflowContent
- Create model QueryPrivilegesApply
- Create model ParamTemplate
- Create model ParamHistory
- Add field instance_tag to instance
- Add field resource_group to instance
- Add field tunnel to instance
-
Create model DataMaskingColumns
- Create model ArchiveLog
- Add field dest_instance to archiveconfig
- Add field resource_group to archiveconfig
- Add field src_instance to archiveconfig
- Create model AliyunRdsConfig
- Create model Users
- Create model QueryPrivileges
- Create model InstanceDatabase
- Create model InstanceAccount
(venv4archery)[root@718e83ed00e6 archery]# python3 manage.py migrate
Operations to perform:
Apply all migrations: admin, auth, contenttypes, django_q, sessions, sql
mysql下载的zip版本安装步骤Apply all migrations: admin, auth, contenttypes, django_q, sessions, sql
Running migrations:
Applying contenttypes. OK
Applying contenttypes.0002_remove_content_ OK
Applying auth. OK
Applying auth.0002_alter_permission_name_ OK
Applying auth.0003_alter_user_email_ OK
Applying auth.0004_alter_user_ OK
Applying auth.0005_alter_user_last_ OK
Applying auth.0006_require_ OK
Applying auth.0007_alter_validators_add_ OK
Applying auth.0008_alter_user_username_ OK
Applying auth.0009_alter_user_last_name_ OK
Applying auth.0010_alter_group_name_ OK
Applying auth.0011_update_ OK
Applying sql. OK
Applying admin. OK
Applying admin.0002_logentry_remove_ OK
Applying admin.0003_logentry_add_action_ OK
Applying django_q. OK
Applying django_q.0002_auto_ OK
Applying django_q.0003_auto_ OK
Applying django_q.0004_auto_ OK
Applying django_q.0005_auto_ OK
Applying django_q.0006_auto_ OK
Applying django_q. OK
Applying django_q.0008_auto_ OK
Applying django_q.0009_auto_ OK
Applying sessions. OK
数据初始化
python3 manage.py dbshell<sql/fixtures/auth_group.sql
python3 manage.py dbshell<src/init_sql/mysql_slow_query_review.sql
创建管理⽤户
python3 manage.py createsuperuser
(venv4archery)[root@718e83ed00e6 archery]# python3 manage.py createsuperuser ⽤户名: testadmin
电⼦邮件地址: testadmin@test
Password:
Password (again):
Superuser created successfully.
重启
docker restart archery
⽇志查看和问题排查
docker logs archery -f --tail=50
在浏览器中输⼊⽹址IP:9123/
输⼊你刚才设置的账号密码就可以登录到系统内。如下图。

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。