mysql_source.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:backup 作者: twindb 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号