配置mysql
1.GRANT REPLICATION SLAVE ON *.* TO 'replication'@'%' IDENTIFIED BY 'replpassword'; #配置复制账号
2.GRANT REPLICATION CLIENT ON *.* TO 'mmm_monitor'@'%' IDENTIFIED BY 'monpassword'; #配置监控账号
3.GRANT SUPER, REPLICATION CLIENT, PROCESS ON *.* TO 'mmm_agent'@'%' IDENTIFIED BY 'agentpassword'; #配置监控代理账号
4.FLUSH PRIVILEGES; #刷新权限
配置主host
log-bin=mysql-bin
binlog_format=mixed
server-id = 1
replicate-do-db=exam
replicate-ignore-db=
log-slave-updates
slave-skip-errors=all
sync_binlog=1
auto_increment_increment=2
auto_increment_offset=1
master-host = 10.3.1.25
master-user = replication
master-password = replpassword
master-port = 3306
配置slave主机
log-bin=mysql-bin
binlog_format=mixed
server-id = 2
replicate-do-db=exam
replicate-ignore-db=
log-slave-updates
slave-skip-errors=all
sync_binlog=1
auto_increment_increment=2
auto_increment_offset=2
master-host = 10.3.1.17
master-user = replication
master-password = replpassword
master-port = 3306
升级perl到5.12.2-----------此种方法失败
1、wget http://www.cpan.org/src/5.0/perl-5.12.2.tar.gz
2、tar -zxvf perl-5.12.2.tar.gz
3、cd perl-5.12.2
4、./Configure -des -Dprefix=/usr/local/perl -Duseithreads Configure #开启多线程,否则monitor不运行
5、make test
6、make install
7、mv /usr/bin/perl /usr/bin/perl.bak
8、ln -s /usr/local/perl/bin/perl /usr/bin/perl
更新perl模块
cpan -i Algorithm::Diff Class::Singleton DBI DBD::mysql Log::Dispatch Log::Log4perl Mail::Send Net::Ping Proc::Daemon Time::HiRes Params::Validate Net::ARP
安装mmm
1. cd /usr/local/
2. mkdir mmm
3. cd mmm
4. wget http://mysql-mmm.org/_media/:mmm2:mysql-mmm-2.2.1.tar.gz -O mysql-mmm-2.2.1.tar.gz
5. tar -xzvf mysql-mmm-2.2.1.tar.gz
6. cd mysql-mmm-2.2.1
7. make, make install
8. mv /MMM /usr/local/perl/lib/5.12.2/
9. cd /etc/mysql-mmm/
10.ls
------------------------------------- monitor 启动失败,需要perl支持多线程-------
使用 yum 搞定
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
yum install mysql-mmm* -y
11.修改配置文件
10.3.1.17 主数据库,mmm_common.conf:
active_master_role writer
<host default>
cluster_interface eth0
pid_path /var/run/mmm_agentd.pid
bin_path /usr/lib/mysql-mmm/
replication_user replication #对应上面mysql配置时的用户名
replication_password replpassword #对应上面mysql配置时的密码
agent_user mmm_agent #对应上面mysql配置时的用户名
agent_password agentpassword #对应上面mysql配置时的密码
</host>
<host db1>
ip 10.3.1.17 #实际ip
mode master
peer db2
</host>
<host db2>
ip 10.3.1.25 #实际ip
mode master
peer db1
</host>
<role writer>
hosts db1, db2
ips 10.3.1.110 #虚ip,程序调用虚ip,由mmmm负责转向实际ip
mode exclusive
</role>
<role reader>
hosts db1, db2
ips 10.3.1.111,10.3.1.112 #虚ip,程序读取时对应的ip ,这个配置可以用户读写分离
mode balanced
</role>
10.3.1.25,次数据库配置
mmm_common.conf同上
mmm_agent.conf:
include mmm_common.conf
this db2
10.3.1.24,监控器配置
include mmm_common.conf
<monitor>
ip 127.0.0.1
pid_path /var/run/mmm_mond.pid
bin_path /usr/lib/mysql-mmm/
status_path /var/lib/misc/mmm_mond.status
ping_ips 10.3.1.17, 10.3.1.25 #实际ip
</monitor>
<host default>
monitor_user mmm_monitor #对应上面的mysql账号
monitor_password monpassword
</host>
debug 0
启动
10.3.1.17:/etc/init.d/mysql-mmm-agent start
10.3.1.25:/etc/init.d/mysql-mmm-agent start
10.3.1.24:/etc/init.d/mysql-mmm-monitor start
自动启动
/sbin/chkconfig --del mysql-mmm-agent
/sbin/chkconfig --add mysql-mmm-agent
10.3.1.24:
mmm_control set_online db1
mmm_control set_online db2 #保证虚地址生效
mmm_control show
mmm_control checks
17/25需要打开9989端口
安装完成,测试一下,发现/etc/init.d/mysql-mmm-agent stop后再启动失败,需要重启服务器才能再次启动,没有找到原因,有可能是mmm还不是正式版的原因吧.看样子mmm还不能用于生产环境,回头试一下配置linux heartbeat.
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com