10.10.10.20:监控端
10.10.10.21:主
10.10.10.22:主
10.10.10.23:从
10.10.10.24:从
yum -y install mysql mysql-server
service mysqld start
yum -y install mysql-mmm*
useradd --comment "MMM Script owner" --shell /sbin/nologin mmmd
yum -y install perl-Time-HiRes*
GRANT REPLICATION CLIENT ON *.* TO 'mmm_monitor'@'10.10.10.%' IDENTIFIED BY 'monitor_password';
GRANT SUPER, REPLICATION CLIENT, PROCESS ON *.* TO 'mmm_agent'@'10.10.10.%' IDENTIFIED BY 'agent_password';
GRANT REPLICATION SLAVE ON *.* TO 'replication'@'10.10.10.%' IDENTIFIED BY 'replication_password';
CHANGE MASTER TO master_host='10.10.10.21', master_port=3306, master_user='replication',master_password='replication_password', master_log_file='mysql-bin.000001', master_log_pos=98;
CHANGE MASTER TO master_host = '10.10.10.22', master_port=3306, master_user='replication',master_password='replication_password', master_log_file='mysql-bin.000001', master_log_pos=1146;
[iyunv@node4 ~]# egrep -v "^#|^$" /etc/mysql-mmm/mmm_common.conf
active_master_role writer
<host default>
cluster_interface eth0
pid_path /var/run/mmmd_agent.pid
bin_path /usr/lib/mysql-mmm/
replication_user replication
replication_password replication_password
agent_user mmm_agent
agent_password agent_password
</host>
<host db1>
ip 10.10.10.21
mode master
peer db2
</host>
<host db2>
ip 10.10.10.22
mode master
peer db1
</host>
<host db3>
ip 10.10.10.23
mode slave
</host>
<host db4>
ip 10.10.10.24
mode slave
</host>
<role writer>
hosts db1, db2
ips 10.10.10.100
mode exclusive
</role>
<role reader>
hosts db1, db2, db3, db4
ips 10.10.10.101,10.10.10.102
mode balanced
</role>
[iyunv@node4 ~]#
[iyunv@node4 ~]# egrep -v "^#|^$" /etc/mysql-mmm/mmm_agent.conf
include mmm_common.conf
this db4
[iyunv@localhost ~]# egrep -v "^#|^$|^\s+#" /etc/mysql-mmm/mmm_mon.conf
include mmm_common.conf
<monitor>
ip 10.10.10.20
pid_path /var/run/mysql-mmm/mmm_mond.pid
bin_path /usr/libexec/mysql-mmm
status_path /var/lib/mysql-mmm/mmm_mond.status
ping_ips 10.10.10.1,10.10.10.21,10.10.10.22,10.10.10.22,10.10.10.23,10.10.10.24
auto_set_online 60
</monitor>
<host default>
monitor_user mmm_monitor
monitor_password monitor_password
</host>
debug 0
[iyunv@localhost ~]#
[iyunv@localhost ~]# mmm_control show
db1(10.10.10.21) master/ONLINE. Roles:
db2(10.10.10.22) master/ONLINE. Roles: writer(10.10.10.100)
db3(10.10.10.23) slave/ONLINE. Roles: reader(10.10.10.101)
db4(10.10.10.24) slave/ONLINE. Roles: reader(10.10.10.102)
[iyunv@localhost ~]#
[iyunv@node4 ~]# egrep -v "^#|^$" /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
server_id = 4
log_bin = /var/log/mysql/mysql-bin.log
log_bin_index = /var/log/mysql/mysql-bin.log.index
relay_log = /var/log/mysql/mysql-relay-bin
relay_log_index = /var/log/mysql/mysql-relay-bin.index
expire_logs_days = 10
max_binlog_size = 100M
log_slave_updates = 1
auto_increment_increment = 2
auto_increment_offset = 1
skip-name-resolve
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[iyunv@node4 ~]#
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com