How to force Laravel database layer to retry queries that have canceled because of replication error

Dimitrios Desyllas - Jan 20 '20 - - Dev Community

I have a postgresql server that I am unable to manage it. Though it has master-slave replication and I set up my laravel application with the correct connection credentials.

But sometimes replication comes up with unwanted errors. Therefore, how I can configure my Laravel application to recconect in case that replication-based sql errors happen?

I have a Laravel application that uses 2 PostgreSQL database replicas for reading data. The load balancing between these databases is happening via rotating DNS.

The application itself uses the DNS name to access the read-only replicas. But during the query execution I get the following error:

SQLSTATE[40001]: Serialization
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player