Skip to content

Can't connect to MySQL server. #393

Description

@kloostermanw
  • TwinDB Backup version: 3.1.1
  • Operating System: Ubuntu 22.04
  • Mysql: 8.0.30
  • Percona-xtrabackup-80: 8.0.30

Description

When I run

twindb-backup --xtrabackup-binary=/usr/bin/xtrabackup --xbstream-binary=/usr/bin/xbstream backup hourly

I get the following error message:

ERROR: mysql_source.get_connection():541: Can't connect to MySQL server on 127.0.0.1
ERROR: mysql_source.get_connection():541: Can't connect to MySQL server on 127.0.0.1

But the backup is running fine.

What I Did

I investigated what was causing the message. So I update the log line in mysql_source on line 543 as following

except OperationalError as err:
LOG.error(
"Can't connect to MySQL server on %s",
self._connect_info.hostname,
)

LOG.error(
    "Can't connect to MySQL server on %s",
    str(err),
)

And this give me the following error message.

ERROR: mysql_source.get_connection():541: Can't connect to MySQL server on (1193, "Unknown system variable 'wsrep_on'")

I think for some reason the check in is_galera bubbles up as an error message.

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,
OperationalError,
MySQLSourceError,
) 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions