influxdata/influxdb-php

example of reliable connection

mtnbrit opened this issue · 1 comments

Hi I'm looking for an example of how to wrap the client in a try catch to detect if the database has gone away, and to attempt to reconnect if so. My php app is a daemon and right now it simply stops executing with no error if influxdb is restarted, e.g. for a simple config file update (I wish it had SIGHUP) which is obviously less than ideal, thanks.

@mtnbrit did you attempt running your app with supervisord? http://supervisord.org/. You could do $database->exists() call every n seconds to verify the connection. It will fail when it cannot connect to influxDB.