Add proxysql
This commit is contained in:
51
proxysql
Normal file
51
proxysql
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
proxysql:
|
||||||
|
image: proxysql/proxysql:2.5.5
|
||||||
|
container_name: proxysql
|
||||||
|
restart: unless-stopped
|
||||||
|
|
||||||
|
ports:
|
||||||
|
- "6032:6032"
|
||||||
|
- "6033:6033"
|
||||||
|
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
set -e
|
||||||
|
|
||||||
|
proxysql -f &
|
||||||
|
PID=$!
|
||||||
|
|
||||||
|
for i in $(seq 1 30); do
|
||||||
|
mysql -uadmin -padmin -h127.0.0.1 -P6032 -e "SELECT 1" >/dev/null 2>&1 && break
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
mysql -uadmin -padmin -h127.0.0.1 -P6032 <<SQL
|
||||||
|
SET mysql-enable_cleartext_auth=1;
|
||||||
|
LOAD MYSQL VARIABLES TO RUNTIME;
|
||||||
|
SAVE MYSQL VARIABLES TO DISK;
|
||||||
|
|
||||||
|
DELETE FROM mysql_servers;
|
||||||
|
INSERT INTO mysql_servers (hostgroup_id, hostname, port) VALUES
|
||||||
|
(10,'192.168.19.90',3306),
|
||||||
|
(10,'192.168.19.91',3306),
|
||||||
|
(10,'192.168.19.92',3306);
|
||||||
|
LOAD MYSQL SERVERS TO RUNTIME;
|
||||||
|
SAVE MYSQL SERVERS TO DISK;
|
||||||
|
|
||||||
|
DELETE FROM mysql_users;
|
||||||
|
INSERT INTO mysql_users (
|
||||||
|
username,password,default_hostgroup,
|
||||||
|
active,frontend,backend
|
||||||
|
) VALUES (
|
||||||
|
'testuser','testpass123',10,1,1,1
|
||||||
|
);
|
||||||
|
LOAD MYSQL USERS TO RUNTIME;
|
||||||
|
SAVE MYSQL USERS TO DISK;
|
||||||
|
SQL
|
||||||
|
|
||||||
|
wait $PID
|
||||||
Reference in New Issue
Block a user