环境信息
os:CentOS Linux release 7.8.2003 (Core)
python:Python 3.6.5
redis:Redis server v=5.0.11
mysql:mysql  Ver 14.14 Distrib 5.7.33

1、安装Python和virtualenv
编译安装

# 安装依赖yum install wget gcc make zlib-devel openssl openssl-devel 
wget "https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz" tar -xvJf Python-3.6.5.tar.xz 
# 编译cd Python-3.6.5 
./configure prefix=/usr/local/python3 
make && make install 
ln -fs /usr/local/python3/bin/python3 /usr/bin/python3 
ln -fs /usr/local/python3/bin/pip3 /usr/bin/pip3 
# virtualenvpip3 install virtualenv -i https://mirrors.ustc.edu.cn/pypi/web/simple/ 
ln -fs /usr/local/python3/bin/virtualenv /usr/bin/virtualenv

2、准备虚拟环境

# 编译安装python的使用virtualenv venv4archery --python=python3# 切换python运行环境到虚拟环境source venv4archery/bin/activate

3、下载最新release包,安装依赖库

wget "https://github.com/hhyo/archery/archive/v1.8.0.tar.gz"tar -xzvf v1.8.0.tar.gz# 安装系统依赖yum -y install gcc gcc-c++ python-devel mysql-devel openldap-devel unixODBC-devel gettext# 安装依赖库cd archery-1.8.0
pip3 install -r requirements.txt -i https://mirrors.ustc.edu.cn/pypi/web/simple/ 

# 如果使用yum安装的python3,安装mysqlclient可能提示提示缺少Python.h,可安装yum -y install python36-devel

4、准备MySQL、Redis实例

  • MySQL推荐版本>=5.6
    手动创建db,dbname为archery
  • Redis提供任务队列和缓存

5、MySQL配置

建议MySQL版本5.6以上

DATABASES = {'default': {'ENGINE': 'django.db.backends.mysql','NAME': 'archery', # 数据库名称'USER': 'root', # 数据库用户'PASSWORD': '', # 数据库密码'HOST': '127.0.0.1', # 数据库HOST,如果是docker启动并且关联,可以使用容器名连接'PORT': '3306',  # 数据库端口'OPTIONS': {'init_command': "SET sql_mode='STRICT_TRANS_TABLES'", # SQL_MODE,为了兼容select * group by,可以按需调整'charset': 'utf8mb4'},'TEST': {'NAME': 'test_archery','CHARSET': 'utf8mb4',
        },
    }
}

6、缓存配置

缓存使用redis,可参考 django_redis 文档 http://django-redis-chs.readthedocs.io/zh_CN/latest/

CACHES = {"default": {"BACKEND": "django_redis.cache.RedisCache","LOCATION": "redis://127.0.0.1:6379/0", # redis://host:port/db"OPTIONS": {"CLIENT_CLASS": "django_redis.client.DefaultClient","PASSWORD": ""}
    }
}

7、启动准备

# 数据库初始化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

8、archery手动启动服务
runserver启动(仅作为本地测试)
source /opt/venv4archery/bin/activate
#启动Django-Q,需保持后台运行
python3 manage.py qcluster &
#启动服务
python3 manage.py runserver 0.0.0.0:9123  --insecure  &

访问地址:
http://ip:9123
如果启动成功,但无法访问,看一下防火墙是不是处于开启状态。
以上就是手动安装archery的quanguoc
ps:数据库初始化异常
手动配置的话,需要自己创建数据库
执行python3 manage.py migrate
出现数据库初始化异常
原因是数据库编码的问题,创建库的时候要设置编码
mysql> show global variables like '%character%';
mysql> drop database archery;
mysql> create database archery default character set utf8;

(venv4archery) [root@localhost Archery-1.8.0]# 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 auth.0012_alter_user_first_name_max_length... 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 django_q.0010_auto_20200610_0856... OK
  Applying django_q.0011_auto_20200628_1055... OK
  Applying django_q.0012_auto_20200702_1608... OK
  Applying django_q.0013_task_attempt_count... OK
  Applying sessions.0001_initial... OK
Traceback (most recent call last):
  File "/usr/local/src/archery/venv4archery/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/src/archery/venv4archery/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 73, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/src/archery/venv4archery/lib64/python3.6/site-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/usr/local/src/archery/venv4archery/lib64/python3.6/site-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/usr/local/src/archery/venv4archery/lib64/python3.6/site-packages/MySQLdb/connections.py", line 259, in query
    _mysql.connection.query(self, query)
MySQLdb._exceptions.OperationalError: (1366, "Incorrect string value: '\\xE6\\x85\\xA2\\xE6\\x97\\xA5...' for column 'name' at row 1")

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/src/archery/venv4archery/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "/usr/local/src/archery/venv4archery/lib/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/src/archery/venv4archery/lib/python3.6/site-packages/django/core/management/base.py", line 330, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/src/archery/venv4archery/lib/python3.6/site-packages/django/core/management/base.py", line 371, in execute
    output = self.handle(*args, **options)
  File "/usr/local/src/archery/venv4archery/lib/python3.6/site-packages/django/core/management/base.py", line 85, in wrapped
    res = handle_func(*args, **kwargs)
  File "/usr/local/src/archery/venv4archery/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 268, in handle
    self.verbosity, self.interactive, connection.alias, apps=post_migrate_apps, plan=plan,
  File "/usr/local/src/archery/venv4archery/lib/python3.6/site-packages/django/core/management/sql.py", line 54, in emit_post_migrate_signal
    **kwargs
  File "/usr/local/src/archery/venv4archery/lib/python3.6/site-packages/django/dispatch/dispatcher.py", line 179, in send
    for receiver in self._live_receivers(sender)
  File "/usr/local/src/archery/venv4archery/lib/python3.6/site-packages/django/dispatch/dispatcher.py", line 179, in <listcomp>
    for receiver in self._live_receivers(sender)
  File "/usr/local/src/archery/venv4archery/lib/python3.6/site-packages/django/contrib/auth/management/__init__.py", line 83, in create_permissions
    Permission.objects.using(using).bulk_create(perms)
  File "/usr/local/src/archery/venv4archery/lib/python3.6/site-packages/django/db/models/query.py", line 507, in bulk_create
    objs_without_pk, fields, batch_size, ignore_conflicts=ignore_conflicts,
  File "/usr/local/src/archery/venv4archery/lib/python3.6/site-packages/django/db/models/query.py", line 1277, in _batched_insert
    self._insert(item, fields=fields, using=self.db, ignore_conflicts=ignore_conflicts)
  File "/usr/local/src/archery/venv4archery/lib/python3.6/site-packages/django/db/models/query.py", line 1254, in _insert
    return query.get_compiler(using=using).execute_sql(returning_fields)
  File "/usr/local/src/archery/venv4archery/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 1397, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/src/archery/venv4archery/lib/python3.6/site-packages/django/db/backends/utils.py", line 98, in execute
    return super().execute(sql, params)
  File "/usr/local/src/archery/venv4archery/lib/python3.6/site-packages/django/db/backends/utils.py", line 66, in execute
    return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
  File "/usr/local/src/archery/venv4archery/lib/python3.6/site-packages/django/db/backends/utils.py", line 75, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/local/src/archery/venv4archery/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/src/archery/venv4archery/lib/python3.6/site-packages/django/db/utils.py", line 90, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/src/archery/venv4archery/lib/python3.6/site-packages/django/db/backends/utils.py", line 84, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/src/archery/venv4archery/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 73, in execute
    return self.cursor.execute(query, args)
  File "/usr/local/src/archery/venv4archery/lib64/python3.6/site-packages/MySQLdb/cursors.py", line 206, in execute
    res = self._query(query)
  File "/usr/local/src/archery/venv4archery/lib64/python3.6/site-packages/MySQLdb/cursors.py", line 319, in _query
    db.query(q)
  File "/usr/local/src/archery/venv4archery/lib64/python3.6/site-packages/MySQLdb/connections.py", line 259, in query
    _mysql.connection.query(self, query)
django.db.utils.OperationalError: (1366, "Incorrect string value: '\\xE6\\x85\\xA2\\xE6\\x97\\xA5...' for column 'name' at row 1")