def tryReconnect(self):
helper.internalLogger.info("Try reconnection to database" + self.dbname)
try:
"""Instantiate a connection to the InfluxDB."""
self.client = InfluxDBClient(self.host, self.port, self.user, self.password,self.dbname)
helper.internalLogger.info("Create database: " + self.dbname)
self.client.create_database(self.dbname)
helper.internalLogger.info("Create a retention policy")
self.client.create_retention_policy('awesome_policy', '3d', 3,default=True)
helper.internalLogger.info("Switch user: " + self.dbuser)
self.client.switch_user(self.dbuser, self.dbpss)
except KeyboardInterrupt:
print("Ok ok, quitting")
sys.exit(1)
except Exception as e:
e = sys.exc_info()[0]
helper.internalLogger.error('Unexpected error attempting to access to BD. It will be retried later.')
helper.einternalLogger.exception(e)
评论列表
文章目录