Yearning 是基于Inception的web可视化SQL审核平台,其本身只提供可视化交互页面并不具备sql审核的能力。所以必须搭配Inception一起使用。 Inception 安装参考 MySQL 审核工具 Inception。
从v1.3.0版本开始将采取docker运行的方式,不再提供普通安装教程,所以本次使用 Docker 部署。
【 Docker 安装 】
Docker 安装参考:https://docs.docker.com/install/linux/docker-ce/centos/#install-docker-ce
yum install -y docker #当前版本 Docker version 1.13.1, build 07f3374/1.13.1
docker --version
sed -i "s/--selinux-enabled/--selinux-enabled=false/g" /etc/sysconfig/docker
systemctl start docker
systemctl enable docker
【 Docker-Compose 安装 】
Docker-Compose 安装参考:https://docs.docker.com/compose/install/#master-builds
Docker-Compose下载:https://github.com/docker/compose/releases
curl -L "https://github.com/docker/compose/releases/download/1.23.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
docker-compose --version
【 Yearning 安装 】
wget https://github.com/cookieY/Yearning/archive/master.zip
unzip master.zip
mv Yearning-master /usr/local/yearning
cd /usr/local/yearning/install/yearning-docker-compose
vim docker-compose.yml
docker-compose up -d
其中, docker-compose.yml 配置文件设置如下。(因为我本地安装有3306及3307的MySQL实例,所以使用docker内部的MySQL把端口改为3305)
version: '2'
services:
db:
image: mysql:5.7
volumes:
- ./docker/etc/mysql/:/etc/mysql/conf.d/
- ./db_data/:/var/lib/mysql/
- ./init-sql/:/docker-entrypoint-initdb.d/
restart: always
ports:
- "3305:3306"
environment:
MYSQL_ROOT_PASSWORD: mysql
MYSQL_DATABASE: Yearning
MYSQL_USER: yearning
MYSQL_PASSWORD: yearning
yearning:
image: registry.cn-hangzhou.aliyuncs.com/cookie/yearning:v1.3.4
depends_on:
- db
ports:
- "8080:80"
- "8000:8000"
environment:
HOST: 10.10.10.10
MYSQL_PASSWORD: mysql
MYSQL_USER: root
MYSQL_ADDR: db
MYSQL_DATABASE: Yearning
# 默认账号:admin,默认密码:Yearning_admin
# 感谢 eacdy 张功震 贡献
打开网站:http://10.10.10.10:8080/ ,默认用户:admin ,密码: Yearning_admin 。登录后如下:
关联 Inception
部署完成,其他参考官方文档: https://supermancookie.com/Yearning-document/
其他:
=======================================================================
连接到 docker 中的MySQL:
mysql -h0.0.0.0 -P3305 -uroot -pmysql
=======================================================================
Docker 容器操作过程中可能出现以下错误:
Error response from daemon: Driver overlay2 failed to remove root filesystem a991d4cfc073de5f60f5593ebc990d26d71a4bfd57f2603f62f5e14a3ecd0a22: remove /var/lib/docker/overlay2/f5038276b673418fec899fe46ced58941fd45f1485d58e2315b63fea30992d06/merged: device or resource busy
解决:
grep docker /proc/*/mountinfo | grep a991d4cfc073de5f60f5593ebc990d26d71a4bfd57f2603f62f5e14a3ecd0a22 | awk -F ':' '{print $1}' | awk -F '/' '{print $3}' |xargs -I {} kill -9 {}
docker ps -a | grep Dead |awk '{print $1}' | xargs docker rm
=======================================================================