hcymysql / pt-slave-repair

自动修复MySQL主从同步数据
35 stars 10 forks source link

多源复制的支持 #3

Open fengbao123 opened 7 months ago

fengbao123 commented 7 months ago

slave_status_dict = cursor.fetchone() # 这里是 fetchone

貌似不支持多源复制。

    def get_slave_status(self):
        cursor = self._connection.cursor(cursor=pymysql.cursors.DictCursor)  # 以字典的形式返回操作结果

        try:
            cursor.execute('SHOW SLAVE STATUS')
            slave_status_dict = cursor.fetchone()   # 这里是 fetchone
        except pymysql.Error as e:
            print("Error %d: %s" % (e.args[0], e.args[1]))
        finally:
            cursor.close()