mysql HA 方案(3):MHA

aaqwsh發表於2012-04-28

1   ERROR 1045 (28000): Access denied for user 問題,查了好久,發現是有為null的user,刪除對應的記錄就好了

[root@db-181 ~]# mysql -u rep -p -h db-183
Enter password:
ERROR 1045 (28000): Access denied for user 'rep'@'db-181' (using password: YES)
[root@db-181 ~]# mysql -u root -p -h db-183  
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'db-181' (using password: YES)


mysql> select user,host from mysql.user;
+--------+------------+
| user   | host       |
+--------+------------+
| dba    | %          |
| rep    | %          |
| sbtest | %          |
| root   | 127.0.0.1  |
| root   | ::1        |
|        | db-181     |
| root   | db-181     |
| root   | db-182     |
| root   | db-183     |
|        | localhost  |
| rep    | localhost  |
| root   | localhost  |
+--------+------------+
13 rows in set (0.00 sec)

mysql> delete from mysql.user where user='' and host='db-181';
Query OK, 1 row affected (0.00 sec)


mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

2  A question about using MHA "purge_relay_logs script" :

    Thanks for the MHA and she  is very useful to us .
    But i have a question about using "purge_relay_logs script". 
    IN the "Requirements and Limitations" you write :
    It is recommended invoking cron at different time between slaves.
    If all slaves invoke purge_relay_logs at the same time, none of the slave might not have necessary relay log events at crash.
     It is no problem in most cases. But in an extreme scenario ,the Latest Slave has just switched relay log .
     After the point if i execute purge_relay_logs script. and the master crash at the same time.
     But other slaves haven't the lasted relay log (have some gap ) and  the dead master is unreachable via SSH.
     In the scenario , MHA(0.53) can recover the cluster or not ?
 
    我們目前的想法是relay log通過我們的定時任務進行清除,同時維護relay index。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/758322/viewspace-722418/,如需轉載,請註明出處,否則將追究法律責任。

相關文章