Re-establishing MultiprocessingWriter Connection in influxdb_client After InfluxDB Restart


I’m currently using InfluxDB version 2.7.0 and interfacing with it using the influxdb_client Python package. My application utilizes MultiprocessingWriter for handling data writes. However, I’ve encountered an issue where, after restarting the InfluxDB service using sudo systemctl restart influxd, my program loses its connection to the database and reports an “unauthorized access” error.

I’m looking for a way to recover or re-establish the MultiprocessingWriter connection without having to restart my entire Python program. Is there a recommended method or best practice for handling such scenarios where the InfluxDB service is restarted, and the connection needs to be re-established in an already running MultiprocessingWriter instance?
Thanks in advance.

Hello @CDRW,
I’m not sure actually. I dont think that instance has any connection lost handling built in. You could modify your Python script to include exception handling specifically for connection errors. When the unauthorized access error is caught, you can implement a reconnection logic. Or retries. Is this for the v2 client library? I recommend also creating an issue in that repo too.

1 Like

Yes, this is concerning the v2 client library. Based on your recommendation, I’ll create an issue in the v2 client library’s repository to seek further assistance and possibly a more integrated solution.

I appreciate your input and guidance on this matter.

For those who encounter same problem, solution:
Handling “Unauthorized Access” Error with MultiprocessingWriter in InfluxDB Client After Service Restart · Issue #619 · influxdata/influxdb-client-python (