Add listener port without restarting proxysql

Hi.
Is there a way to add listener port without restarting proxysql service?

I’m trying this scenario without success :frowning: :
1.
update global_variables set variable_value=‘0.0.0.0.:6033;0.0.0.0:6034;0.0.0.0:6035’ where variable_name=‘mysql-interfaces’;
save mysql variables to disk;
load mysql variables to runtime;

  1. update global_variables set variable_value=‘0.0.0.0.:6033;0.0.0.0:6034;0.0.0.0:6035’ where variable_name=‘mysql-interfaces’;
    save mysql variables to disk;
    load mysql variables to runtime;
    proxysql restart;

  2. update global_variables set variable_value=‘0.0.0.0.:6033;0.0.0.0:6034;0.0.0.0:6035’ where variable_name=‘mysql-interfaces’;
    save mysql variables to disk;
    proxysql stop;
    load mysql variables to runtime;
    proxysql start;

  3. Changing in proxysql config file “interfaces=” variable and after save
    proxysql --reload
    After login to proxysql admin module:
    proxysql restart;

Thanks in advanced for help.

2 Likes

@mariaczi, you must restart proxysql service to add additional listing ports.

2 Likes

Hi @mariaczi , building on @matthewb’s answer: Another option if you absolutely must avoid restarting ProxySQL is to launch multiple proxysqld instances, each listening on different ports.

1 Like

@matthewb OK, thanks. But to avoid unavailability of our proxy, I’m thinking if it’s possible to run more than one (for example two) proxysqld processes which will use the same configuration - could have datadir in the same directory? Of course, config file must be separate for each one (admin agent must listen on different ports). What do you think about that?

2 Likes

@mariaczi , ProxySQL does not use config files; the configuration is stored within an SQLite3 database located in the datadir of proxysql (/var/lib/proxysql). I’m not sure if you can run multiple proxysqld instances, pointing at the same datadir.
You could certainly run multiple instances on multiple ports with different datadir for each instance. But in honesty, that sorta goes against the nature of proxysql since it can listen on multiple interfaces/ports by design.
A restart of proxysql should take about 3 seconds.
If you want to run proxysql in a more HA configuration, have 2 instances of proxysql running on two different hosts and utilize a VIP between the two servers. This will allow you to take one proxysql down and traffic will continue to the other server because of the VIP (which is what applications use).

2 Likes

One possibility would be to run a clustered setup and use docker, then you could launch a new container and map to the port you want to on it. The new container should load into the cluster seemlessly.

1 Like