-
Notifications
You must be signed in to change notification settings - Fork 999
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Let proxysql makes sure that only one server in the writer group #2019
base: v1.4.16
Are you sure you want to change the base?
Conversation
proxysql makes sure that only one server in the writer group
Hi @Mount565 . |
Automated message: PR pending admin approval for build testing |
Hi @renecannao, You're right. proxysql cannot determine which writer is right. At most, It can only make sure the first writer it found is in the writer group. The first must be the right. let's explore it a little deeper. In what situation does proxysql needs to determine the right writer? On proxysql start(or proxysql crash and restart) and there are multiple servers with read_only =0. In this case,the configuration in So, there is a writer in writer group online, all other writers later detected will be banned. Suppose a slave's read_only is changed to 0 by mistake. proxysql will prevent this server from being moved into the writer group, and print warning logs like:
If DBA find this situation in time and correct the read_only on slave, data inconsistency can be avoided. If not, some day,the original writer in the writer group down for some reason, this slave will be moved into the writer group. However, this slave may not be ready for writing because of replication lag. So there is still a little chance of causing data problem. But it is caused by misconfiguration, and proxysql has tried hard to point it out. So there is still the risk of writing to slave . but it is under control now. We got time to correct the mistake before writing to slave really happens. In practice, we can monitor the warning log using Zabbix to find the mistake timely. |
it's a good and important recommendation |
I'm going to use the proposed solution in a live environment, because I need it. |
Hi ! |
Can one of the admins verify this patch? |
ProxySQL determine Write/Read role by the variable
read_only
.if
read_only=0|OFF
, the server is writable, proxysql make sure it is in the writer's groupif
read_only=1|ON
, the server is only readable, proxysql put it in the reader's groupWell, the side effect of this design is that, if a server is a slave , it's
read_only
variable is changed to 0|OFF by mistake, it will be put in the writer's group by proxysql.It's very dangerous and will cause data inconsistent between master and slave.
How about this ? Let proxysql makes sure that there 's at most one server in the writer's group.
If proxysql detect a server with
read_only=0|OFF
, and not in the writer's group, it should judge if there's already one server in the corresponding writer's group, if so, instead of performing a swap, it print a warning log and break out.