手动部署Archery-1.12.0
官方文档:https://archerydms.com/installation/docker/
手动部署地址:https://archerydms.com/installation/manual/
GitHub上的wiki:
https://github.com/hhyo/Archery.wiki.git
手动部署,系统:rockylinux9.6
1、安装Python和virtualenv
系统本身自带python3.9.21,只需要再安装pip即可
yum -y install libffi-devel wget gcc make zlib-devel openssl openssl-devel ncurses-devel openldap-devel gettext bzip2-devel xz-devel
yum -y install python3-pip
pip3 install virtualenv -i https://mirrors.ustc.edu.cn/pypi/web/simple/
ln -fs /usr/local/python3/bin/virtualenv /usr/bin/virtualenv
2、准备虚拟环境
virtualenv venv4archery --python=python3
source venv4archery/bin/activate
退出虚拟环境:deactivate
不安装MS SQL Server 驱动,ORACLE驱动,MongoDB驱动
3、下载最新release包,安装依赖库
yum install mariadb-devel --enablerepo=devel --nogpgcheck (代替:mysql-devel)
yum install krb5*
yum install unixODBC
yum -y install gcc gcc-c++ python-devel openldap-devel gettext (去掉unixODBC-devel)
mkdir /data
tar -xzvf Archery-1.12.0.tar.gz
cd Archery-1.12.0
source venv4archery/bin/activate
pip3 install -r requirements.txt -i https://mirrors.ustc.edu.cn/pypi/web/simple/
安装:mysql-community-client客户端,版本:8.0.43-1.el9
yum -y localinstall https://repo.mysql.com/mysql84-community-release-el9.rpm
# 注意:默认直接yum安装是8.x的最新版本:8.4。若是想安装8.0版本的,需要修改repo文件
vim mysql-community.repo
yum install mysql-community-client
准备MySQL、Redis实例
MySQL推荐版本>=5.7
Redis提供任务队列和缓存
修改配置
vi archery/settings.py
需要事先创建好数据库:archery
# 数据库初始化
python3 manage.py makemigrations sql
python3 manage.py migrate
# 数据初始化
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
admin
admin123,.
Gunicorn+Nginx启动
# nginx配置示例
server{
listen 9123; # 监听的端口
server_name localhost;
client_max_body_size 20M; # 处理Request Entity Too Large
proxy_read_timeout 600s; # 超时时间与Gunicorn超时时间设置一致,主要用于在线查询
location / {
proxy_pass http://127.0.0.1:8888;
proxy_set_header Host $host:9123; # 解决重定向404的问题,和listen端口保持一致,如果是docker则和宿主机映射端口保持一致
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /static {
alias /data/Archery-1.12.0/static; # 此处指向settings.py配置项STATIC_ROOT目录的绝对路径,用于nginx收集静态资源
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
# 启动
source /opt/venv4archery/bin/activate
bash startup.sh
访问¶
http://127.0.0.1:9123/ => http://10.16.16.21:9123
启动后配置
在启动后 Archery 有一些配置(如Inception , 资源组, 权限组等)需要按需配置, 请详细阅读 配置项说明 , 按照自己的需要进行配置。
https://archerydms.com/configuration/
安装Inception
https://github.com/hanchuanchuan/goInception/releases
https://github.com/hanchuanchuan/goInception/releases/download/v1.3.0/goInception-linux-v1.3.0-94-g2f06c61b95.tar.gz
cd /data
mkdir goInception
tar -zxv -f goInception-linux-v1.3.0-94-g2f06c61b95.tar.gz -C /data/goInception
cp config/config.toml.default config/config.toml
chown -R root:root /data/goInception
vim config/config.toml
[inc]
backup_host = "192.168.2.161"
backup_port = 3306
backup_user = "root"
backup_password = "jddHLW@jdd966"
需要事先创建好数据库:inception_bak
./goInception -config=config/config.toml
后台运行
# cat start.sh
#!/bin/bash
nohup /data/goInception/goInception -config=/data/goInception/config/config.toml &

浙公网安备 33010602011771号