您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

MHA+非root用户SSH等效性配置

2025/4/16 10:24:24发布16次查看
环境:centos5.8 mysql5.5.17 实验:搭建mha高可用架构(非root用户ssh等效性配置)ssh等效性用户配置的是:concert 端口:1314 mha配置文件 [concert@mhamanager mha]$ more /etc/masterha_default.cnf [server default] user = root password = mysql_admi
环境:centos5.8
mysql5.5.17
实验:搭建mha高可用架构(非root用户ssh等效性配置)ssh等效性用户配置的是:concert 端口:1314
mha配置文件
[concert@mhamanager mha]$ more /etc/masterha_default.cnf
[server default]
user = root
password = mysql_admin
ssh_user = concert
ssh_port = 1314
repl_user = repl
repl_password = repl_pwd
ping_interval = 3
ping_type = select
[concert@mhamanager mha]$ more /etc/appl.cnf
[server default]
manager_workdir = /mha/appl
manager_log = /mha/appl/manager.log
remote_workdir = /mha/appl
[server1]
hostname = 192.168.66.88
master_binlog_dir = /data/lib/mysql
candidate_master = 1
[server2]
hostname = 192.168.66.89
master_binlog_dir = /data/lib/mysql
candidate_master = 1
[server3]
hostname = 192.168.66.120
no_master = 1
port = 3307
问题:配置好非root用户ssh等效性后,通过masterha_check_ssh检查没有问题
[concert@mhamanager ~]$ /usr/bin/masterha_check_ssh --conf=/etc/appl.cnf
tue sep 2 15:06:01 2014 - [info] reading default configuratoins from /etc/masterha_default.cnf..
tue sep 2 15:06:01 2014 - [info] reading application default configurations from /etc/appl.cnf..
tue sep 2 15:06:01 2014 - [info] reading server configurations from /etc/appl.cnf..
tue sep 2 15:06:01 2014 - [info] starting ssh connection tests..
tue sep 2 15:06:01 2014 - [debug]
tue sep 2 15:06:01 2014 - [debug] connecting via ssh from concert@192.168.66.88(192.168.66.88:1314) to concert@192.168.66.89(192.168.66.89:1314)..
tue sep 2 15:06:01 2014 - [debug] ok.
tue sep 2 15:06:01 2014 - [debug] connecting via ssh from concert@192.168.66.88(192.168.66.88:1314) to concert@192.168.66.120(192.168.66.120:1314)..
tue sep 2 15:06:01 2014 - [debug] ok.
tue sep 2 15:06:02 2014 - [debug]
tue sep 2 15:06:01 2014 - [debug] connecting via ssh from concert@192.168.66.89(192.168.66.89:1314) to concert@192.168.66.88(192.168.66.88:1314)..
tue sep 2 15:06:01 2014 - [debug] ok.
tue sep 2 15:06:01 2014 - [debug] connecting via ssh from concert@192.168.66.89(192.168.66.89:1314) to concert@192.168.66.120(192.168.66.120:1314)..
tue sep 2 15:06:02 2014 - [debug] ok.
tue sep 2 15:06:02 2014 - [debug]
tue sep 2 15:06:02 2014 - [debug] connecting via ssh from concert@192.168.66.120(192.168.66.120:1314) to concert@192.168.66.88(192.168.66.88:1314)..
tue sep 2 15:06:02 2014 - [debug] ok.
tue sep 2 15:06:02 2014 - [debug] connecting via ssh from concert@192.168.66.120(192.168.66.120:1314) to concert@192.168.66.89(192.168.66.89:1314)..
tue sep 2 15:06:02 2014 - [debug] ok.
tue sep 2 15:06:02 2014 - [info] all ssh connection tests passed successfully.
但通过masterha_check_repl检查则不通过
[concert@mhamanager ~]$ /usr/bin/masterha_check_repl --conf=/etc/appl.cnf
tue sep 2 17:10:08 2014 - [info] reading default configuratoins from /etc/masterha_default.cnf..
tue sep 2 17:10:08 2014 - [info] reading application default configurations from /etc/appl.cnf..
tue sep 2 17:10:08 2014 - [info] reading server configurations from /etc/appl.cnf..
tue sep 2 17:10:08 2014 - [info] mha::mastermonitor version 0.55.
tue sep 2 17:10:08 2014 - [info] dead servers:
tue sep 2 17:10:08 2014 - [info] alive servers:
tue sep 2 17:10:08 2014 - [info] 192.168.66.88(192.168.66.88:3306)
tue sep 2 17:10:08 2014 - [info] 192.168.66.89(192.168.66.89:3306)
tue sep 2 17:10:08 2014 - [info] 192.168.66.120(192.168.66.120:3307)
tue sep 2 17:10:08 2014 - [info] alive slaves:
tue sep 2 17:10:08 2014 - [info] 192.168.66.89(192.168.66.89:3306) version=5.5.17-log (oldest major version between slaves) log-bin:enabled
tue sep 2 17:10:08 2014 - [info] replicating from 192.168.66.88(192.168.66.88:3306)
tue sep 2 17:10:08 2014 - [info] primary candidate for the new master (candidate_master is set)
tue sep 2 17:10:08 2014 - [info] 192.168.66.120(192.168.66.120:3307) version=5.5.17-log (oldest major version between slaves) log-bin:enabled
tue sep 2 17:10:08 2014 - [info] replicating from 192.168.66.88(192.168.66.88:3306)
tue sep 2 17:10:08 2014 - [info] not candidate for the new master (no_master is set)
tue sep 2 17:10:08 2014 - [info] current alive master: 192.168.66.88(192.168.66.88:3306)
tue sep 2 17:10:08 2014 - [info] checking slave configurations..
tue sep 2 17:10:08 2014 - [info] checking replication filtering settings..
tue sep 2 17:10:08 2014 - [info] binlog_do_db= , binlog_ignore_db=
tue sep 2 17:10:08 2014 - [info] replication filtering check ok.
tue sep 2 17:10:08 2014 - [info] starting ssh connection tests..
tue sep 2 17:10:10 2014 - [error][/usr/lib/perl5/vendor_perl/mha/mastermonitor.pm, ln386] error happend on checking configurations. ssh configuration check failed!
at /usr/lib/perl5/vendor_perl/mha/mastermonitor.pm line 341
tue sep 2 17:10:10 2014 - [error][/usr/lib/perl5/vendor_perl/mha/mastermonitor.pm, ln482] error happened on monitoring servers.
tue sep 2 17:10:10 2014 - [info] got exit code 1 (not master dead).
mysql replication health is not ok!
解决方案:
1、增加remote_workdir(运行mysql实例的服务器)的工作目录权限,其中会生成日志文件,将该目录拥有者设为concert
[root@master88 ~]# chown -r concert:concert /mha/
2、添加concert为mysql同组用户,使其有读取mysql binary/relay log文件和relay_log.info文件的权限,以及日志目录的写权限
[root@bakmaster ~]# usermod -g mysql concert
再次检查
[concert@mhamanager mha]$ /usr/bin/masterha_check_repl --conf=/etc/appl.cnf
wed sep 3 22:27:41 2014 - [info] reading default configuratoins from /etc/masterha_default.cnf..
wed sep 3 22:27:41 2014 - [info] reading application default configurations from /etc/appl.cnf..
wed sep 3 22:27:41 2014 - [info] reading server configurations from /etc/appl.cnf..
wed sep 3 22:27:41 2014 - [info] mha::mastermonitor version 0.55.
wed sep 3 22:27:41 2014 - [info] dead servers:
wed sep 3 22:27:41 2014 - [info] alive servers:
wed sep 3 22:27:41 2014 - [info] 192.168.66.88(192.168.66.88:3306)
wed sep 3 22:27:41 2014 - [info] 192.168.66.89(192.168.66.89:3306)
wed sep 3 22:27:41 2014 - [info] 192.168.66.120(192.168.66.120:3307)
wed sep 3 22:27:41 2014 - [info] alive slaves:
wed sep 3 22:27:41 2014 - [info] 192.168.66.89(192.168.66.89:3306) version=5.5.17-log (oldest major version between slaves) log-bin:enabled
wed sep 3 22:27:41 2014 - [info] replicating from 192.168.66.88(192.168.66.88:3306)
wed sep 3 22:27:41 2014 - [info] primary candidate for the new master (candidate_master is set)
wed sep 3 22:27:41 2014 - [info] 192.168.66.120(192.168.66.120:3307) version=5.5.17-log (oldest major version between slaves) log-bin:enabled
wed sep 3 22:27:41 2014 - [info] replicating from 192.168.66.88(192.168.66.88:3306)
wed sep 3 22:27:41 2014 - [info] not candidate for the new master (no_master is set)
wed sep 3 22:27:41 2014 - [info] current alive master: 192.168.66.88(192.168.66.88:3306)
wed sep 3 22:27:41 2014 - [info] checking slave configurations..
wed sep 3 22:27:41 2014 - [info] checking replication filtering settings..
wed sep 3 22:27:41 2014 - [info] binlog_do_db= , binlog_ignore_db=
wed sep 3 22:27:41 2014 - [info] replication filtering check ok.
wed sep 3 22:27:41 2014 - [info] starting ssh connection tests..
wed sep 3 22:27:42 2014 - [info] all ssh connection tests passed successfully.
wed sep 3 22:27:42 2014 - [info] checking mha node version..
wed sep 3 22:27:43 2014 - [info] version check ok.
wed sep 3 22:27:43 2014 - [info] checking ssh publickey authentication settings on the current master..
wed sep 3 22:27:43 2014 - [info] healthcheck: ssh to 192.168.66.88 is reachable.
wed sep 3 22:27:43 2014 - [info] master mha node version is 0.54.
wed sep 3 22:27:43 2014 - [info] checking recovery script configurations on the current master..
wed sep 3 22:27:43 2014 - [info] executing command: save_binary_logs --command=test --start_pos=4 --binlog_dir=/data/lib/mysql --output_file=/mha/appl/save_binary_logs_test --manager_version=0.55 --start_file=mysql-bin.000004
wed sep 3 22:27:43 2014 - [info] connecting to concert@192.168.66.88(192.168.66.88)..
creating /mha/appl if not exists.. ok.
checking output directory is accessible or not..
ok.
binlog found at /data/lib/mysql, up to mysql-bin.000004
wed sep 3 22:27:43 2014 - [info] master setting check done.
wed sep 3 22:27:43 2014 - [info] checking ssh publickey authentication and checking recovery script configurations on all alive slave servers..
wed sep 3 22:27:43 2014 - [info] executing command : apply_diff_relay_logs --command=test --slave_user='root' --slave_host=192.168.66.89 --slave_ip=192.168.66.89 --slave_port=3306 --workdir=/mha/appl --target_version=5.5.17-log --manager_version=0.55 --relay_log_info=/data/lib/mysql/relay-log.info --relay_dir=/data/lib/mysql/ --slave_pass=xxx
wed sep 3 22:27:43 2014 - [info] connecting to concert@192.168.66.89(192.168.66.89:1314)..
checking slave recovery environment settings..
opening /data/lib/mysql/relay-log.info ... ok.
relay log found at /data/lib/mysql, up to mysql-relay-bin.000006
temporary relay log file is /data/lib/mysql/mysql-relay-bin.000006
testing mysql connection and privileges.. done.
testing mysqlbinlog output.. done.
cleaning up test file(s).. done.
wed sep 3 22:27:43 2014 - [info] executing command : apply_diff_relay_logs --command=test --slave_user='root' --slave_host=192.168.66.120 --slave_ip=192.168.66.120 --slave_port=3307 --workdir=/mha/appl --target_version=5.5.17-log --manager_version=0.55 --relay_log_info=/data/lib/mysqlb/relay-log.info --relay_dir=/data/lib/mysqlb/ --slave_pass=xxx
wed sep 3 22:27:43 2014 - [info] connecting to concert@192.168.66.120(192.168.66.120:1314)..
checking slave recovery environment settings..
opening /data/lib/mysqlb/relay-log.info ... ok.
relay log found at /data/lib/mysqlb, up to mysql-relay-bin.000005
temporary relay log file is /data/lib/mysqlb/mysql-relay-bin.000005
testing mysql connection and privileges.. done.
testing mysqlbinlog output.. done.
cleaning up test file(s).. done.
wed sep 3 22:27:44 2014 - [info] slaves settings check done.
wed sep 3 22:27:44 2014 - [info]
192.168.66.88 (current master)
+--192.168.66.89
+--192.168.66.120
wed sep 3 22:27:44 2014 - [info] checking replication health on 192.168.66.89..
wed sep 3 22:27:44 2014 - [info] ok.
wed sep 3 22:27:44 2014 - [info] checking replication health on 192.168.66.120..
wed sep 3 22:27:44 2014 - [info] ok.
wed sep 3 22:27:44 2014 - [warning] master_ip_failover_script is not defined.
wed sep 3 22:27:44 2014 - [warning] shutdown_script is not defined.
wed sep 3 22:27:44 2014 - [info] got exit code 0 (not master dead).
mysql replication health is ok.
ok!问题解决。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product