美文网首页
Yearning容器部署

Yearning容器部署

作者: 随便写点什么就好 | 来源:发表于2020-05-28 16:43 被阅读0次

    Yearning是一个sql审核工具.已经支持容器化,没有道理我们不用.

    下载Yearning

    wget https://github-production-release-asset-2e65be.s3.amazonaws.com/107417113/fa97eb00-8876-11ea-92f1-bec577525cb9?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20200528%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20200528T075836Z&X-Amz-Expires=300&X-Amz-Signature=83146085eab313eeb028d0cde7630b0ea61442482c796f5eb89e4afe5d49e0a5&X-Amz-SignedHeaders=host&actor_id=30437397&repo_id=107417113&response-content-disposition=attachment%3B%20filename%3DYearning-2.2.1.linux-amd64.zip&response-content-type=application%2Foctet-stream
    

    解压包

    unzip Yearning-2.2.1.linux-amd64.zip
    cd Yearning-go
    [root@test Yearning-go]# ll
    total 9776
    -rw-r--r-- 1 root root     127 Aug  2  2019 conf.toml
    drwxr-xr-x 6 root root     116 Apr 27 11:02 dist
    -rw-r--r-- 1 root root     620 Jan  9 10:06 docker-compose.yml
    -rw-r--r-- 1 root root     597 Aug 21  2019 Dockerfile
    -rw-r--r-- 1 root root     177 Aug 23  2019 # README
    -rwxr--r-- 1 root root 9986324 Apr 27 11:02 Yearning
    -rw-r--r-- 1 root root     283 Jan 15 16:55 yearning.service
    
    

    可以看到Dockerfile和docker-compose.yml文件都有了,那就打包吧.

    docker build -t yearning-2.2.1:v2.2.1 .
    docker images
    
    
    image.png

    可以看到容器了


    image.png

    docker-compose文件

    考虑到mysql要持久化, 要外部连接mysql,要方便配置远程备份.自己修改了一下容器.

    [root@test data]# vim docker-compose.yml 
    version: '3'
    services:
      mysql:
        image: mysql:5.7.24
        container_name: 3346-mysql-yearning
        volumes:
          - /data/docker/mysql/3346/data/db:/var/lib/mysql/
          - /data/docker/var/run/mysql-3346.sock:/var/run/mysql.sock
          - /data/docker/mysql/3346/data/conf:/etc/mysql/conf.d
        ports:
          - 3346:3306
        command: --character-set-server=utf8 --collation-server=utf8_general_ci
        environment:
          MYSQL_ROOT_PASSWORD: xxxx #root管理员用户密码
          MYSQL_USER: yearning   #创建用户
          MYSQL_PASSWORD: xxxxxxxxxxx
          MYSQL_DATABASE: yearning
          TZ: Asia/Shanghai
    
      yearning:
        image: yearning-2.2.1:v2.2.1
        container_name: web-yearning
        environment:
          MYSQL_USER: yearning
          MYSQL_PASSWORD: xxxxxxxxxxxxxx
          MYSQL_DB: yearning
          MYSQL_ADDR: 192.168.13.11:3346
        ports:
          - 8000:8000
    
    #自定义mysql配置文件,先简单点
    
    [root@test data]# vim /data/docker/mysql/3346/data/conf/my.cnf 
    [mysqld]
    user=mysql
    default-storage-engine=INNODB
    max_connections=2000
    log-bin=mysql-bin
    server-id=1
    
    [client]
    default-character-set=utf8
    [mysql]
    default-character-set=utf8
    
    

    安装成功了


    image.png

    这样

    相关文章

      网友评论

          本文标题:Yearning容器部署

          本文链接:https://www.haomeiwen.com/subject/ivyaahtx.html