#python3.6
yum -y install wget gcc make zlib-devel openssl openssl-devel ncurses-devel\
&& cd /opt \
&& 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 /opt/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 \
&& pip3 install virtualenv \
&& cd /opt \
&& ln -fs /usr/local/python3/bin/virtualenv /usr/bin/virtualenv \
&& virtualenv venv4archery --python=python3 \
&& rm -rf Python-3.6.5 \
&& rm -rf Python-3.6.5.tar.xz \
&& rm -rf /etc/localtime && ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& yum -y install kde-l10n-Chinese \
&& localedef -c -f UTF-8 -i zh_CN zh_CN.utf8
#编译错误 复制的其他编译好的文件
#sqladvisor
#&& yum -y install https://repo.percona.com/yum/percona-release-latest.noarch.rpm
#&& yum -y install Percona-Server-devel-56 Percona-Server-shared-56 Percona-Server-client-56
yum -y install epel-release \
&& yum -y install cmake bison gcc-c++ git mysql-devel libaio-devel libffi-devel glib2 glib2-devel \
&& cd /opt \
&& git clone https://github.com/hhyo/SQLAdvisor.git \
&& cd /opt/SQLAdvisor/ \
&& cmake -DBUILD_CONFIG=mysql_release -DCMAKE_BUILD_TYPE=debug -DCMAKE_INSTALL_PREFIX=/usr/local/sqlparser ./ \
&& make && make install \
&& cd sqladvisor/ \
&& cmake -DCMAKE_BUILD_TYPE=debug ./ \
&& make \
&& mv /opt/SQLAdvisor/sqladvisor/sqladvisor /opt \
&& rm -rf /opt/SQLAdvisor/
#schemasync
cd /opt \
&& virtualenv venv4schemasync --python=python2 \
&& source venv4schemasync/bin/activate \
&& install -y python-devel \
&& pip install schema-sync mysql-python
#soar
cd /opt \
&& wget https://github.com/XiaoMi/soar/releases/download/0.11.0/soar.linux-amd64 -O soar \
&& chmod a+x soar
#binlog2sql
cd /opt \
&& git clone https://github.com/danfengcao/binlog2sql.git \
&& mv binlog2sql/binlog2sql/ tmp_binlog2sql \
&& rm -rf binlog2sql
#msodbc
cd /opt \
&& curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/mssql-release.repo \
&& ACCEPT_EULA=Y yum -y install msodbcsql17 \
&& yum -y install unixODBC-devel
#oracle instantclient
yum -y install http://yum.oracle.com/repo/OracleLinux/OL7/oracle/instantclient/x86_64/getPackage/oracle-instantclient19.3-basiclite-19.3.0.0.0-1.x86_64.rpm
#archery
cd /opt \
&& yum -y install openldap-devel gettext nginx \
&& git clone https://github.com/hhyo/archery.git && cd archery && git checkout \
&& source /opt/venv4archery/bin/activate \
&& pip3 install -r /opt/archery/requirements.txt \
&& cp /opt/archery/src/docker/nginx.conf /etc/nginx/ \
&& mv /opt/sqladvisor /opt/archery/src/plugins/ \
&& mv /opt/soar /opt/archery/src/plugins/ \
&& mv /opt/tmp_binlog2sql /opt/archery/src/plugins/binlog2sql
vim /opt/archery/archery/settings.py
# 该项目本身的mysql数据库地址
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'archery',
'USER': 'archery',
'PASSWORD': 'archery',
'HOST': '192.168.10.73',
'PORT': '3306',
'OPTIONS': {
'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
'charset': 'utf8mb4'
},
'TEST': {
'NAME': 'test_archery',
'CHARSET': 'utf8mb4',
},
}
}
缓存配置
CACHES = {
"default": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://192.168.10.73:6000/0",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
"PASSWORD": ""
}
},
"dingding": {
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://192.168.10.73:6000/1",
"OPTIONS": {
"CLIENT_CLASS": "django_redis.client.DefaultClient",
"PASSWORD": ""
}
}
}
cd /opt/archery
# 数据库初始化
python3 manage.py makemigrations sql
python3 manage.py migrate
# 数据初始化
python3 manage.py loaddata initial_data.json
# 创建管理用户 和配置邮箱
python3 manage.py createsuperuser
启动Django-Q
source /opt/venv4archery/bin/activate
nohup python3 manage.py qcluster &
runserver启动
source /opt/venv4archery/bin/activate
nohup python3 manage.py runserver 0.0.0.0:9123 --insecure &
http://192.168.10.252:9123
MySQL数据库审计 archery
最新推荐文章于 2024-06-26 09:18:19 发布