Installation and use of database auditing platform yearning

1. Install the yearning

1.1 Create a database

The database used by yearning is mysql5.7 and above, and sql_mode must be set to empty for 8.0 and above.
Create the yearning database and set the character set to UTF8mb4.
Insert picture description here

1.2 Download the installation package

Open the download address Yearning Download.
Find the stable version and download the zip file of Linux. (I have a relatively early version Yearning-2.1.6.1)
Insert picture description here

1.3 Change the database configuration

Unzip the installation package

unzip Yearning-2.1.6.1.linux-amd64.zip

Edit configuration file

vim conf.toml

Change the database configuration according to the actual situation

[Mysql]
Db = "Yearning"
Host = "127.0.0.1"
Port = "3306"
Password = "123456"
User = "root"

[General]#数据库加解密key,只可更改一次。
SecretKey =“dbcjqheupqjsuwsm”

SecretKey is the salt for token/database password encryption/decryption.
It is recommended that all users change the SecretKey before installing Yearning for the first time (no change will cause a security risk)
Format: Uppercase and lowercase letters are acceptable , and the length must be 16 digits. If the length is not 16 digits, it will be impossible to create a new data source.
Special attention:
this key is only It can be changed during the initial installation! It cannot be changed again afterwards! If it is changed again, the previously stored data source password cannot be decrypted, and eventually the relevant data source information cannot be obtained.

1.4 Initialize the database

cd Yearning-go/
./Yearning -m

1.5 Start the yearning

Start on port 8000 by default

./Yearning -s

Specify port 8080 to start

./Yearning -s -p "8080"

2. Set up nginx proxy

For various reasons, the yearning needs to use the same port as other services. So use nginx to proxy the
configuration file as follows:

http {

         #include   mime.types;
         #default_type   application/octet-stream;
         upstream aaa {
                 server 10.200.9.2:8087;
         }

        upstream bbb {
                server 127.0.0.1:8000;
        }
         server {
                 listen 36010 default_server;
                 server_name www.aaa.com ;
                 location / {
                        proxy_pass http://aaa/;
                        proxy_set_header  X-Real_IP  $remote_addr;
                        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                        client_max_body_size 300m;
                        client_body_buffer_size 128k;
                        proxy_connect_timeout 60;
                        proxy_read_timeout 180;
                        proxy_send_timeout 60;
                        proxy_buffer_size 64k;
                        proxy_buffers   4 32k;
                        proxy_busy_buffers_size 64k;
                        proxy_temp_file_write_size 64k;
                }


                error_page   500 502 503 504  /50x.html;
                location = /50x.html {
                root   html;
                }
         }
         server {
        listen 36010;
        server_name www.bbb.cn ;
        location / {
               proxy_pass http://bbb/;
               proxy_set_header  X-Real_IP  $remote_addr;
               proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
               client_max_body_size 300m;
               client_body_buffer_size 128k;
               proxy_connect_timeout 60;
               proxy_read_timeout 180;
               proxy_send_timeout 60;
               proxy_buffer_size 64k;
               proxy_buffers   4 32k;
               proxy_busy_buffers_size 64k;
               proxy_temp_file_write_size 64k;
       }
       error_page   500 502 503 504  /50x.html;
       location = /50x.html {
            root   html;
       }
    }

}

You can visit different projects by visiting two different domain names + the same port. If you need external network access, domain name mapping needs to be done.

Guess you like

Origin blog.csdn.net/xiguashixiaoyu/article/details/112694664