安装前一定要先检查以前是否安装过docker旧版本,不然安装不上最新版本,有安装就卸载
yum list installed | grep docker
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum list docker-ce --showduplicates | sort -r
yum install docker-ce -y
#启动docker服务
systemctl start docker
#激活docker服务
systemctl enable docker
#查看docker版本
docker version
pip install docker-compose
docker pull registry.cn-hangzhou.aliyuncs.com/lihuanhuan/archery
#下载地址
https://github.com/hhyo/archery/releases/
#下载解压后路径pwd
/usr/local/Archery-1.7.12
#启动
cd /usr/local/Archery-1.7.12/src/docker-compose
docker-compose -f docker-compose.yml 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
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
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
电子邮件地址: [email protected]
Password:
Password (again):
Superuser created successfully.
docker restart archery
docker logs archery -f --tail=50
输入你刚才设置的账号密码就可以登录到系统内。如下图。