Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

execute masterha_master_switch, Got Error: user account was not correctly passed. #122

Open
hqlswc opened this issue Jun 2, 2019 · 1 comment

Comments

@hqlswc
Copy link

hqlswc commented Jun 2, 2019

[HELP] When I execute masterha_master_switch, always got error

[root@slave-248212 ~]# masterha_master_switch --conf=/etc/masterha/app1.cnf --master_state=alive --new_master_host=10.5.248.211 --orig_master_is_new_slave

Sun Jun  2 22:30:05 2019 - [info] MHA::MasterRotate version 0.58.
Sun Jun  2 22:30:05 2019 - [info] Starting online master switch..
Sun Jun  2 22:30:05 2019 - [info]
Sun Jun  2 22:30:05 2019 - [info] * Phase 1: Configuration Check Phase..
Sun Jun  2 22:30:05 2019 - [info]
Sun Jun  2 22:30:05 2019 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Sun Jun  2 22:30:05 2019 - [info] Reading application default configuration from /etc/masterha/app1.cnf..
Sun Jun  2 22:30:05 2019 - [info] Reading server configuration from /etc/masterha/app1.cnf..
Sun Jun  2 22:30:06 2019 - [info] GTID failover mode = 0
Sun Jun  2 22:30:06 2019 - [info] Current Alive Master: 10.5.248.212(10.5.248.212:3306)
Sun Jun  2 22:30:06 2019 - [info] Alive Slaves:
Sun Jun  2 22:30:06 2019 - [info]   10.5.248.211(10.5.248.211:3306)  Version=5.7.22-log (oldest major version between slaves) log-bin:enabled
Sun Jun  2 22:30:06 2019 - [info]     Replicating from 10.5.248.212(10.5.248.212:3306)
Sun Jun  2 22:30:06 2019 - [info]     Primary candidate for the new Master (candidate_master is set)

It is better to execute FLUSH NO_WRITE_TO_BINLOG TABLES on the master before switching. Is it ok to execute on 10.5.248.212(10.5.248.212:3306)? (YES/no): yes
Sun Jun  2 22:30:09 2019 - [info] Executing FLUSH NO_WRITE_TO_BINLOG TABLES. This may take long time..
Sun Jun  2 22:30:09 2019 - [info]  ok.
Sun Jun  2 22:30:09 2019 - [info] Checking MHA is not monitoring or doing failover..
Sun Jun  2 22:30:09 2019 - [info] Checking replication health on 10.5.248.211..
Sun Jun  2 22:30:09 2019 - [info]  ok.
Sun Jun  2 22:30:09 2019 - [info] 10.5.248.211 can be new master.
Sun Jun  2 22:30:09 2019 - [info]
From:
10.5.248.212(10.5.248.212:3306) (current master)
 +--10.5.248.211(10.5.248.211:3306)

To:
10.5.248.211(10.5.248.211:3306) (new master)
 +--10.5.248.212(10.5.248.212:3306)

Starting master switch from 10.5.248.212(10.5.248.212:3306) to 10.5.248.211(10.5.248.211:3306)? (yes/NO): yes
Sun Jun  2 22:30:11 2019 - [info] Checking whether 10.5.248.211(10.5.248.211:3306) is ok for the new master..
Sun Jun  2 22:30:11 2019 - [info]  ok.
Sun Jun  2 22:30:11 2019 - [info] 10.5.248.212(10.5.248.212:3306): SHOW SLAVE STATUS returned empty result. To check replication filtering rules, temporarily executing CHANGE MASTER to a dummy host.
Sun Jun  2 22:30:11 2019 - [info] 10.5.248.212(10.5.248.212:3306): Resetting slave pointing to the dummy host.
Sun Jun  2 22:30:11 2019 - [info] ** Phase 1: Configuration Check Phase completed.
Sun Jun  2 22:30:11 2019 - [info]
Sun Jun  2 22:30:11 2019 - [info] * Phase 2: Rejecting updates Phase..
Sun Jun  2 22:30:11 2019 - [info]
Sun Jun  2 22:30:11 2019 - [info] Executing master ip online change script to disable write on the current master:
Sun Jun  2 22:30:11 2019 - [info]   /etc/masterha/master_ip_online_change --command=stop --orig_master_host=10.5.248.212 --orig_master_ip=10.5.248.212 --orig_master_port=3306 --orig_master_user='root' --new_master_host=10.5.248.211 --new_master_ip=10.5.248.211 --new_master_port=3306 --new_master_user='root' --orig_master_ssh_user=root --new_master_ssh_user=root   --orig_master_is_new_slave --orig_master_password=xxx --new_master_password=xxx
orig master ssh user: root
new master ssh user: root
Got Error: user account was not correctly passed.

Sun Jun  2 22:30:11 2019 - [error][/usr/local/share/perl5/MHA/ManagerUtil.pm, ln177] Got ERROR:  at /usr/local/bin/masterha_master_switch line 53.

I'm sure the SSH configuration and account info absolute correct
[root@slave-248212 ~]# masterha_check_ssh --conf=/etc/masterha/app1.cnf

Sun Jun  2 22:50:51 2019 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Sun Jun  2 22:50:51 2019 - [info] Reading application default configuration from /etc/masterha/app1.cnf..
Sun Jun  2 22:50:51 2019 - [info] Reading server configuration from /etc/masterha/app1.cnf..
Sun Jun  2 22:50:51 2019 - [info] Starting SSH connection tests..
Sun Jun  2 22:50:51 2019 - [debug]
Sun Jun  2 22:50:51 2019 - [debug]  Connecting via SSH from root@10.5.248.211(10.5.248.211:22) to root@10.5.248.212(10.5.248.212:22)..
Sun Jun  2 22:50:51 2019 - [debug]   ok.
Sun Jun  2 22:50:52 2019 - [debug]
Sun Jun  2 22:50:51 2019 - [debug]  Connecting via SSH from root@10.5.248.212(10.5.248.212:22) to root@10.5.248.211(10.5.248.211:22)..
Sun Jun  2 22:50:51 2019 - [debug]   ok.
Sun Jun  2 22:50:52 2019 - [info] All SSH connection tests passed successfully.

This is MHA configure
[root@slave-248212 ~]# cat /etc/masterha/app1.cnf

[server default]
# MYSQL USER
user=root
password=xxx
# SSH USER
ssh_user=root
# BINLOG
master_binlog_dir=/data/mysql3306
# MHA WORKDIR
manager_workdir=/var/log/masterha/app1
manager_log=/var/log/masterha/app1/app1.log
remote_workdir=/var/log/masterha/app1
# SWITCH
master_ip_failover_script=/etc/masterha/master_ip_failover
master_ip_online_change_script=/etc/masterha/master_ip_online_change
# REPLICATION USER
repl_user=repl
repl_password=xxx
# PING
ping_interval=1

[server1]
hostname=10.5.248.211
candidate_master=1
check_repl_delay=0

[server2]
hostname=10.5.248.212
candidate_master=1
check_repl_delay=0
@hqlswc
Copy link
Author

hqlswc commented Jun 3, 2019

modify master_ip_online_change, the problem has been sloved.
Image 1

but there are two question:

  1. why the ssh_user must be no root user?
  2. $orig_master_password ne "msandbox" , what's the meaning of "msandbox"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant