cjbottaro
Automatic Ecto/Postgrex recovery after Aurora failover
Are there any callbacks that I can hook into to reconnect, including redoing DNS resolution?
We’ve having some strange issues with Aurora. Not sure exactly what’s going on, but it looks like it’s failing over. When this happens, the primaries become read only and all our Ecto connections start raising exceptions about the database being read only.
ERROR 25006 (read_only_sql_transaction) cannot execute UPDATE in a read-only transaction
Restarting all our pods fixes the issue because we get fresh new connections.
Looking for a way to automatically handle this scenario. Currently we get alerted to all the failures, then we manually cycle out our pods.
Thanks for the help.
Marked As Solved
maartenvanvliet
Did you explore the options Postgrex has to handle failovers?
E.g. * :disconnect_on_error_codes, which can me combined with multiple endpoints for dealing with failover
Also Liked
adw632
Postgrex disconnect_all might help.
Also review your setup using pgbouncer:
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








