def is_galera(self):
"""Check if local MySQL instance is a Galera cluster
:return: True if it's a Galera.
:rtype: bool
"""
try:
with self._cursor() as cursor:
cursor.execute("SELECT @@wsrep_on as wsrep_on")
row = cursor.fetchone()
return (str(row['wsrep_on']).lower() == "1" or
str(row['wsrep_on']).lower() == 'on')
except pymysql.InternalError as err:
error_code = err.args[0]
error_message = err.args[1]
if error_code == 1193:
LOG.debug('Galera is not supported or not enabled')
return False
else:
LOG.error(error_message)
raise
评论列表
文章目录