LinuxでArcheryと関連する環境構成をインストールします

序文

ArcheryはSQL監査クエリプラットフォーム上にあり、DBAの作業効率を改善し、SQLオンラインと複数のデータベースのクエリをサポートし、豊富なMySQL操作およびメンテナンス機能をサポートすることを目的としています。すべての機能はモバイル端末操作と互換性があります。

 

公式サイト https://archerydms.com/

GitHub  https://github.com/hhyo/Archery

 

準備オーケー

1.Python36をインストールしてアップグレードします

yum install wget gcc make zlib-devel openssl openssl-devel
yum install epel-release
yum install python36 python36-pip

2. Python venv環境を作成します(Python> = 3.6.5、仮想環境を使用することをお勧めします)

cd /opt
pip3.6 install virtualenv -i https://mirrors.ustc.edu.cn/pypi/web/simple/
virtualenv venv4archery --python=python3
virtualenv venv4archery --python=python3.6
source /opt/venv4archery/bin/activate

  非アクティブ化すると、venv環境を終了できます

 

3.SeLinuxを閉じます

vim /etc/sysconfig/selinux

  英語の入力状態で、iを押して挿入モードに入り、次の構成を変更します 

SELINUX=disabled

  escを押して次のように入力します :wqを 保存して終了します

 

正式な手順

 1.ソースコードをダウンロードします

  方法1リンク:https  ://pan.baidu.com/s/1WHBAI7b7xloUUjstStEBEwパスワード:/ optディレクトリに配置されたfh43

  方法2 

cd /opt
wget https://github.com/hhyo/archery/archive/v1.8.0.tar.gz

2.ソースコードを解凍します

#解压包方式
tar -zxvf Archery-1.8.0.tar.gz
#wget方式
tar -zxvf v1.8.0.tar.gz 

 3.関連する依存関係をインストールします

yum -y install gcc gcc-c++ python-devel mysql-devel openldap-devel unixODBC-devel gettext
yum -y install python36-devel
cd Archery-1.8.0
pip3 install -r requirements.txt -i https://mirrors.ustc.edu.cn/pypi/web/simple/

4.Mysqlをインストールします

  https://blog.csdn.net/javanbme/article/details/111825296

5.Percona-Toolkitsをインストールします 

  https://blog.csdn.net/javanbme/article/details/112515533

6.goInceptionをインストールします

https://blog.csdn.net/javanbme/article/details/112607083

7.SOARをインストールします

https://blog.csdn.net/javanbme/article/details/112620976

8.Nginxをインストールします

https://blog.csdn.net/javanbme/article/details/111560356

インストール後、次のnginx構成を使用してディレクトリに入ります

cd /opt/tengine/conf/servers
touch archery.conf
vi archery.conf

   英語入力状態でiを押して挿入モードに入り、次の構成を追加します

server{
        listen 9123; # 监听的端口
        server_name archery;
        client_max_body_size 20M; # 处理Request Entity Too Large
        proxy_read_timeout 600s;  # 超时时间与Gunicorn超时时间设置一致,主要用于在线查询
 
        location / {
          proxy_pass http://127.0.0.1:8000;
          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 /opt/Archery-1.8.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 {
        }
} 

   escを押して次のように入力します :wqを 保存して終了します

9.nginx構成を更新します

 nginx -s reload

10.アーチェリーの構成

cd /opt/Archery-1.8.0/archery
vi settings.py

  英語の入力状態で、iを押して挿入モードに入ります。次の構成を変更します。ファイルの内容が多すぎます。変更をここに投稿してください。 

# 关闭debug模式
DEBUG = False

# 该项目本身的mysql数据库地址
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'archery',
        'USER': 'root',
        'PASSWORD': 'newpass',
        'HOST': '127.0.0.1',
        '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://127.0.0.1:6379/0",
        "OPTIONS": {
            "CLIENT_CLASS": "django_redis.client.DefaultClient",
            "PASSWORD": "newpass"
        }
    },
    "dingding": {
        "BACKEND": "django_redis.cache.RedisCache",
        "LOCATION": "redis://127.0.0.1:6379/1",
        "OPTIONS": {
            "CLIENT_CLASS": "django_redis.client.DefaultClient",
            "PASSWORD": "newpass"
        }
    }
}

  escを押して次のように入力します :wqを 保存して終了します

11.データベースを作成します

mysql -h 127.0.0.1  -u root -p

 注:パスワードの入力を求められます。入力するだけです。

create database archery default character set=utf8mb4;

12.データベースの初期化 

cd /opt/Archery-1.8.0
source /opt/venv4archery/bin/activate
python3 manage.py makemigrations sql
python3 manage.py migrate

13.データの初期化

python3 manage.py dbshell<sql/fixtures/auth_group.sql
python3 manage.py dbshell<src/init_sql/mysql_slow_query_review.sql

14.管理ユーザーを作成します

python3 manage.py createsuperuser

  このとき、Webページログイン用のユーザー名とパスワードの入力を求められます

  ユーザー名:admin
  メールアドレス:[email protected]
  パスワード:adminpassword

15.開始

source /opt/venv4archery/bin/activate
cd /opt/Archery-1.8.0
#启动
./startup.sh &

16.アクセス

ファイアウォールポートを開く

http:// ip:9123

ユーザー名とパスワードを入力してくださいadmin / adminpasswordホームページに入るには、

17.ドキュメントを使用する

https://blog.csdn.net/javanbme/article/details/113050284

 

質問集

1.ファイル "/ usr / bin / yum"、KeyboardInterruptを除く30行目、e:

/ usr / bin / yumファイル#!/ usr / bin /python2.7の最初の行を変更します 

2.警告:pipバージョン20.1.1を使用していますが、バージョン20.2.3を使用できます。

pip input python -m pip install -Upipをアップグレードします

3.依存パッケージmysql-develインストールエラー

方法1

cd /etc/yum.repos.d/
rpm -ivh http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
yum install mysql-devel

方法2

最初にMysqlをインストールしてから、依存パッケージをインストールします

 

 

 

 

おすすめ

転載: blog.csdn.net/javanbme/article/details/112480484