proxysql 学习二 admin-web 启用
proxysql 从1.4.4 开始内置了一个简单的http server,可以方便进行状态信息的查看,今天在
尝试通过配置参数以及update global_variables 没有生效,set 也没有生效,后边通过直接
修改proxysql sqlite 数据库成功,以下记录下
docker-compose 文件
version: "3"
services:
mysql2:
image: mysql:5.7.16
ports:
- 3308:3306
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
environment:
MYSQL_ROOT_PASSWORD: dalongrong
MYSQL_DATABASE: test
MYSQL_USER: rong
MYSQL_PASSWORD: demoapp
TZ: Asia/Shanghai
mysql:
image: mysql:5.7.16
ports:
- 3306:3306
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
environment:
MYSQL_ROOT_PASSWORD: dalongrong
MYSQL_DATABASE: test
MYSQL_USER: rong
MYSQL_PASSWORD: demoapp
TZ: Asia/Shanghai
# gitbase:
# image: srcd/gitbase:v0.24.0-beta1
# volumes:
# - "./git-codes:/opt/repos"
# environment:
# - "GITBASE_USER=rong"
# - "GITBASE_PASSWORD=demoapp"
# ports:
# - "3307:3306"
proxysql:
image: proxysql/proxysql:2.0.5
volumes:
- "./proxysql.cnf:/etc/proxysql.cnf"
- "./proxysql:/var/lib/proxysql"
ports:
- "6033:6033"
- "6032:6032"
- "6080:6080"
proxysql 配置
datadir="/var/lib/proxysql"
admin_variables=
{
admin_credentials="admin:admin;radmin:radmin"
mysql_ifaces="0.0.0.0:6032"
admin-web_enabled=true
}
mysql_variables=
{
threads=4
max_connections=2048
default_query_delay=0
default_query_timeout=36000000
have_compress=true
poll_timeout=2000
interfaces="0.0.0.0:6033"
default_schema="information_schema"
stacksize=1048576
server_version="5.5.30"
connect_timeout_server=3000
monitor_username="rong"
monitor_password="demoapp"
monitor_history=600000
monitor_connect_interval=60000
monitor_ping_interval=10000
monitor_read_only_interval=1500
monitor_read_only_timeout=500
ping_interval_server_msec=120000
ping_timeout_server=500
commands_stats=true
sessions_sort=true
connect_retries_on_failure=10
}
mysql_servers =
(
{
address="mysql"
port=3306
hostgroup=0
max_connections=200
},
{
address="mysql2"
port=3306
hostgroup=1
max_connections=200
}
)
mysql_users:
(
{
username = "root"
password = "dalongrong"
default_hostgroup = 0
max_connections=1000
default_schema="information_schema"
active = 1
},
{
username = "rong"
password ="demoapp"
default_hostgroup = 1
max_connections=1000
default_schema="information_schema"
active = 1
}
)
通过sqlite 工具修改配置
重启proxysql
docker-compose restart proxysql
登陆效果
默认账户密码 stats stats,可以通过修改
admin-stats_credentials
说明
直接通过配置不生效,可能是一个bug,或者配置参数位置有问题,还有待确定