ProxySQL

From VoIPmonitor.org
Jump to navigation Jump to search

ProxySQL

  • we are not experts in ProxySQL so this is only basic functional setting

Basic proxy configuration:

datadir="/var/lib/proxysql"
errorlog="/var/lib/proxysql/proxysql.log"

admin_variables=
{
	admin_credentials="admin:admin"
	mysql_ifaces="0.0.0.0:6032"
}

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="voip"
	monitor_password="test"
	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="127.0.0.1" , port=3306 , hostgroup=0, max_connections=1000}
)
mysql_users:
(
	{
		username = "user" # no default , required
		password = "pass" # default: 
	}
)
mysql_query_rules:
(
)
scheduler=
(
)
mysql_replication_hostgroups=
(
)

First start for ProxySQL initialization:

/usr/bin/proxysql --idle-threads -c /etc/proxysql.cnf -f --initial

Foreground start for testing:

/usr/bin/proxysql --idle-threads -c /etc/proxysql.cnf -f

Set the SET rule to avoid warnings:

root@vmmysql:~# mysql -h 127.0.0.1 -P 6032 -u admin -p
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.30 (ProxySQL Admin Module)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> INSERT INTO mysql_query_rules (rule_id, active, match_digest, multiplex) VALUES (1, 1, '^SET ', 1);
Query OK, 1 row affected (0.000 sec)

MySQL [(none)]> LOAD MYSQL QUERY RULES TO RUNTIME;
Query OK, 0 rows affected (0.000 sec)

MySQL [(none)]> SAVE MYSQL QUERY RULES TO DISK;
Query OK, 0 rows affected (0.006 sec)


  • sensor and GUI setting can be done by usual way