一.前言
1.1 简介
Yearning 面向中小型企业的轻量级MySQL SQL语句审核平台.提供查询审计,SQL审核等多种功能.
二.安装
2.1 下载压缩包
解压文件
unzip Yearning-2.3.5-linux-amd64.zip
查看帮助
./Yearning --help
Yearning Mysql数据审核平台 (Version: 2.3.4 Neptune)
Usage:
./Yearning [Global Options...] {command} [--option ...] [argument ...]
Global Options:
-h, --help Display the help information
--no-color Disable color when outputting message
--no-interactive Disable interactive confirmation operations
--no-progress Disable display progress message
--verbose Set error reporting level(quiet 0 - 4 debug) (default 1)
-V, --version Display app version information
Available Commands:
genac Generate auto complete scripts for current application (alias: gen-ac)
install Yearning安装及数据初始化
migrate 破坏性版本升级修复
reset_super 重置超级管理员密码
run 启动Yearning
help Display help information
Use "./Yearning {COMMAND} -h" for more information about a command
2.2 配置数据库
[Mysql]
Db = "Yearning" #服务连接所需要连接的数据库
Host = "192.168.0.10" #mysql地址
Port = "3306" #端口
Password = "123456" #密码
User = "root" #用户
[General]
SecretKey = "FtUDyUgelhkDWtHi" #加密解密所需要的key
Hours = 4
2.3 制作镜像
FROM alpine:3.12
LABEL maintainer="HenryYee-2020/11/16"
EXPOSE 8000
COPY Yearning /opt/Yearning
COPY conf.toml /opt/conf.toml
RUN echo "http://mirrors.ustc.edu.cn/alpine/v3.12/main/" > /etc/apk/repositories && \
apk add --no-cache tzdata libc6-compat && \
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && \
echo "Asia/Shanghai" >> /etc/timezone && \
echo 'hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4' >> /etc/nsswitch.conf
WORKDIR /opt
CMD /opt/Yearning install && /opt/Yearning run
docker build . -t yearning:1.0
2.4 交付k8s
Deployment
apiVersion: apps/v1 # for versions before 1.8.0 use apps/v1beta1
kind: Deployment
metadata:
name: yearning
labels:
app: yearning
spec:
replicas: 1
selector:
matchLabels:
app: yearning
template:
metadata:
labels:
app: yearning
spec:
containers:
- name: yearning
image: yearning:1.0
ports:
- containerPort: 8000
livenessProbe:
httpGet:
path: /
port: 8000
initialDelaySeconds: 30
timeoutSeconds: 5
periodSeconds: 5
readinessProbe:
httpGet:
path: /
port: 8000
initialDelaySeconds: 5
timeoutSeconds: 1
periodSeconds: 5
svc
apiVersion: v1
kind: Service
metadata:
name: yearning #TODO: to specify your service name
namespace: ops
labels:
app: yearning
spec:
selector:
app: yearning #TODO: change label selector to match your backend pod
ports:
- protocol: TCP
name: http
targetPort: 8000
type: NodePort
kubectl apply -f .
三.访问测试
默认用户名密码
admin/Yearning_admin