def get_master_mysql_major_version(instance):
""" Given an instance, determine the mysql major version for the master
of the replica set.
Args:
instance - a hostaddr object
Returns - A string similar to '5.5' or '5.6'
"""
zk = MysqlZookeeper()
master = zk.get_mysql_instance_from_replica_set(
instance.get_zk_replica_set()[0], repl_type=REPLICA_ROLE_MASTER)
try:
mysql_version = get_global_variables(master)['version'][:3]
except _mysql_exceptions.OperationalError:
raise Exception('Could not connect to master server {instance} in '
'order to determine MySQL version to launch with. '
'Perhaps run this script from there? This is likely '
'due to firewall rules.'
''.format(instance=instance.hostname))
return mysql_version
评论列表
文章目录