Use Primary DB when conection to read replica is refused. #4433
Unanswered
LaurinBrechter
asked this question in
Q&A
Replies: 1 comment
-
|
I encountered this issue as well. I just followed the documentation. and there's no automatic fallback to the primary. When my replica hits its connection limit, it just throws an error. It's not ideal. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am using drizzle with a primary cloud db and a read replica that is co-located with my server. I am doing something like this to set up the connection:
Now, the problem is that when my local db goes down I get an error for read operations. This would be manageable for queries that I make myself since I could make a wraper function that checks for an
ECONNREFUSEDerror when making the query and then switches to the primary. But there's external libraries likebetter-authornext-authto which you can only pass thedbobject.Is there an option for drizzle to detect that the read replica is down and then switch to the primary? Another option I see is that one checks in the callback that decides which db to use if the read replica is still there:
Beta Was this translation helpful? Give feedback.
All reactions