心 涯

NET&JAVA&PHP(要跨界,你不只要跨「脑」的界限,更要跨越「心」的界限,不怕改变,不怕再学习!)

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

一、软件包

a) perl-Proc-Daemon-0.03-1.el5.noarch.rpm

b) perl-DBI-1.52-1.fc6.i386.rpm

c) perl-Algorithm-Diff-1.1902-2.el5.noarch.rpm

d) DBD-mysql-4.018.tar.gz

e) mysql-master-master-1.2.6.tar.gz

f) mysql-5.0.27.tar.gz

二、安装步骤

a) Nod1 ip 59.64.30.118 vip 59.64.30.103(read)

b) Node2 ip 59.64.30.107 vip 59.64.30.102(read)

c) Vip 59.64.30.101(writer)

d) Mgr 59.64.28.92(管理节点)

e) 首先安装好MYSQL软件,配置好MYSQL主主同步。(可以正常主主同步数据)

f) Cd /var/local/software

g) rpm -ivh perl-Proc-Daemon-0.03-1.el5.noarch.rpm

h) rpm -ivh perl-DBI-1.52-1.fc6.i386.rpm

i) ln -s /usr/local/mysql/lib/mysql/libmysqlclient.so.15 /bin/libmysqlclient.so.15

j) ln -s /usr/local/mysql/lib/mysql/libmysqlclient.so.15 /usr/bin/libmysqlclient.so.15

k) ln -s /usr/local/mysql/lib/mysql/libmysqlclient.so.15 /usr/lib/libmysqlclient.so.15

l) ln -s /usr/local/mysql/lib/mysql/libmysqlclient.so.15 /usr/sbin/libmysqlclient.so.15

m) ln -s /usr/local/mysql/lib/mysql/libmysqlclient.so.15 /sbin/libmysqlclient.so.15

n) tar zxvf DBD-mysql-4.018.tar.gz

o) cd DBD-mysql-4.018

p) perl Makefile.PL --with-mysql=/usr/local/mysql --mysql_config=/usr/local/mysql/bin/mysql_config

q) make && make test && make install

r) cd ../

s) rpm -ivh perl-Algorithm-Diff-1.1902-2.el5.noarch.rpm

t) tar zxvf mysql-master-master-1.2.6.tar.gz

u) cd mysql-master-master-1.2.6

v) ./install.pl

w) Cd /usr/local/mmm/etc/examples/

x) cp mmm_agent.conf.example mmm_agent.conf

y) >mmm_agent.conf

#

# Master-Master Manager config (agent)

#

# Debug mode

debug no

# Paths

pid_path /usr/local/mmm/var/mmmd_agent.pid

bin_path /usr/local/mmm/bin

# Logging setup

log mydebug

file /usr/local/mmm/var/mmm-debug.log

level debug

log mytraps

file /usr/local/mmm/var/mmm-traps.log

level trap

# MMMD command socket tcp-port and ip

bind_port 9989

# Cluster interface

cluster_interface eth0

# Define current server id

this db1

mode master

# For masters

peer db2

# Cluster hosts addresses and access params

host db1

ip 59.64.30.118

port 3306

user rep_agent

password 123456

z) Mv mmm_agent.conf ../

aa) 同步方法安装mysql_mmm另一台服务器

bb) Vi /usr/local/mmm/etc/mmm_agent.conf

#

# Master-Master Manager config (agent)

#

# Debug mode

debug no

# Paths

pid_path /usr/local/mmm/var/mmmd_agent.pid

bin_path /usr/local/mmm/bin

# Logging setup

log mydebug

file /usr/local/mmm/var/mmm-debug.log

level debug

log mytraps

file /usr/local/mmm/var/mmm-traps.log

level trap

# MMMD command socket tcp-port and ip

bind_port 9989

# Cluster interface

cluster_interface eth0

# Define current server id

this db2

mode master

# For masters

peer db1

# Cluster hosts addresses and access params

host db1

ip 59.64.30.118

port 3306

user rep_agent

password 123456

a1) 两个节点服务器MYSQL同时增加如下用户。

GRANT ALL PRIVILEGES on *.* to 'rep_agent'@'%' identified by '123456' WITH GRANT OPTION;

GRANT ALL PRIVILEGES on *.* to 'rep_monitor'@'%' identified by '123456' WITH GRANT OPTION;

a2) 同步方法安装mysql_mmm管理节点

a3) vi /usr/local/mmm/etc/mmm_mon.conf

# Master-Master Manager config (monitor)

#

# Debug mode

debug no

# Paths

pid_path /usr/local/mmm/var/mmmd.pid

status_path /usr/local/mmm/var/mmmd.status

bin_path /usr/local/mmm/bin

# Logging setup

log mydebug

file /usr/local/mmm/var/mmm-debug.log

level debug

log mytraps

file /usr/local/mmm/var/mmm-traps.log

level trap

email root@localhost

# MMMD command socket tcp-port

bind_port 9988

agent_port 9989

monitor_ip 127.0.0.1

# Cluster interface

cluster_interface eth0

# Cluster hosts addresses and access params

host db1

ip 59.64.30.118

port 3306

user rep_monitor

password 123456

mode master

peer db2

host db2

ip 59.64.30.107

port 3306

user rep_monitor

password 123456

mode master

peer db1

#

# Define roles

#

active_master_role writer

# Mysql Reader role

role reader

mode balanced

servers db1, db2

ip 59.64.30.103,59.64.30.102 //这里是虚拟IP

# Mysql Writer role

role writer

mode exclusive

servers db1, db2

ip 59.64.30.101 //这里是虚拟IP

#

# Checks parameters

#

# Ping checker

check ping

check_period 1

trap_period 5

timeout 2

# Mysql checker

# (restarts after 10000 checks to prevent memory leaks)

check mysql

check_period 1

trap_period 2

timeout 2

restart_after 10000

# Mysql replication backlog checker

# (restarts after 10000 checks to prevent memory leaks)

check rep_backlog

check_period 5

trap_period 10

max_backlog 60

timeout 2

restart_after 10000

# Mysql replication threads checker

# (restarts after 10000 checks to prevent memory leaks)

check rep_threads

check_period 1

trap_period 5

timeout 2

restart_after 10000

a4) 启动node1 /usr/local/mmm/sbin/mmmd_agent

a5) 启动node2 /usr/local/mmm/sbin/mmmd_agent

a6) 启动mgr /usr/local/mmm/sbin/mmm_mon start

a7) 设置db1在线mmm_control set_online db1

a8) 设置db2在线mmm_control set_online db2

a9) 查看状态mmm_control show

MySQL Multi-Master Replication Manager

Version: 1.2.6

Config file: mmm_mon.conf

Daemon is running!

===============================

Cluster failover method: AUTO

===============================

Servers status:

db1(59.64.30.118): master/ONLINE. Roles: reader(59.64.30.103;), writer(59.64.30.101 //这里是虚拟IP;)

db2(59.64.30.107): master/ONLINE. Roles: reader(59.64.30.102 //这里是虚拟IP;)

三、附加

a) 因为主主同步我没在意,都是NO,所以在show过程中状态老报错,最后一直查到修复主主看看,show才正常。警告配置时首先一定要保证MYSQL主主同步是正常的。配置就不会有什么问题。

b) 安装过程中装perl包真麻烦。找了好多包。郁闷死。

posted on 2010-11-14 16:34  witer666  阅读(327)  评论(0编辑  收藏  举报