We have a python application running with uwsgi, nginx.
We have a fallback mechanism for DBs. ie., if one server refuses to connect, we connect to the other server. But the issue is that the connection takes more than 60s to timeout.
As nginx times out in 60s, it displays the nginx error page. Where can we change the timeout for connecting to mysql servers so that we can make three attempts of connection to mysql in the given 60s nginx timeout period?
We use Web2py and default DAL object with pymysql adapter
you're talking about the option connect_timeout
?
conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='', db='mysql', connect_timeout=20)
in DAL terms this option will be something about this (not tested)
db = DAL('mysql://username:password@localhost/test', driver_args={connect_timeout=20})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With