Closed Paulius11 closed 11 months ago
Hi @Paulius11,
Thank you for providing detailed information about the issue you're encountering with InfluxDB and your Python application. Based on your description, it appears that the problem stems from the way authentication is handled after the InfluxDB service restarts.
When you use username
and password
for authentication, it typically relies on an HTTP session
to maintain the authorization state. Restarting the InfluxDB service invalidates this session, leading to the "unauthorized access" error you are encountering. This is why your application is unable to automatically re-establish the connection and requires a manual restart.
To resolve this issue, I recommend switching to token-based authentication. Token-based authentication is more robust and better suited for long-running tasks like the ones you are managing with your application. Unlike session-based authentication, tokens do not depend on the state of the server session, so they remain valid even after the server restarts, ensuring a smoother and more reliable reconnection process.
Regards
Specifications
After restarting the InfluxDB service (using
sudo systemctl restart influxd
), my Python application loses its connection to the InfluxDB instance. Subsequently, it throws an “unauthorized access” error. This issue arises specifically in the context of using MultiprocessingWriter for handling data writes.Code sample to reproduce problem
Expected behavior
After the InfluxDB service is restarted (using sudo systemctl restart influxd), the Python application using the influxdb_client package and MultiprocessingWriter should automatically re-establish the connection to the InfluxDB instance. The reconnection should occur without the need to restart the entire Python application, ensuring continuous data writes through the MultiprocessingWrite
Actual behavior
Additional info
No response