Setup question: 2 masters, 2 slaves

3 views
Skip to first unread message

Bubba

unread,
Jan 4, 2008, 3:30:41 PM1/4/08
to MySQL Multi Master Manager Development
I have four databases setup as follows:
db01 - db02 = master-master connection (db01 = writer, db02 =
failover)
db03 = slave to db01
db04 = slave to db01

If db01 fails (I turn it off), mmm has db02 take over as the writer
(great!) but replication breaks on db03 and db04 because they are
pointing to db01 for replication.

I would like if db01 fails, that db03 and db04 automatically point to
db02 (the writer) so replication doesn't break.

Any ideas on how to configure db03 and db04?

Ryan Liebenberg

unread,
Jan 4, 2008, 6:54:29 PM1/4/08
to mmm-...@googlegroups.com
On Jan 4, 2008 12:30 PM, Bubba <bryce....@gmail.com> wrote:
>
> I have four databases setup as follows:
> db01 - db02 = master-master connection (db01 = writer, db02 =
> failover)
> db03 = slave to db01
> db04 = slave to db01


Is there any reason you wouldn't slave db03 and db04 to db02?

Seem like this would solve your issue as well as take a little load
off the write master.

Ryan

Alexey Kovyrin

unread,
Jan 4, 2008, 10:26:56 PM1/4/08
to mmm-...@googlegroups.com

Hm, Actually this is what mmm is created for - move writer ip to
failover node AND switch all slaves to new master.
The only problem which can't be solved is that if your master crashed
and mmm fails over after the crash, you just can't be sure that you
slave would not lose some inserts/updates because you do not know what
position you need to switch to on the second master. But if you
manually move writer role, slaves will be switched to new master
gracefully (at least I hope they will).

--
Alexey Kovyrin
http://kovyrin.info/

Bubba

unread,
Jan 7, 2008, 3:41:50 PM1/7/08
to MySQL Multi Master Manager Development
I could easily connect db03 and db04 to db02, but if db02 failed, then
I am in the same position.


On Jan 4, 3:54 pm, "Ryan Liebenberg" <rliebenb...@gmail.com> wrote:

Bubba

unread,
Jan 7, 2008, 3:43:38 PM1/7/08
to MySQL Multi Master Manager Development
Should the slaves be pointed to the writer IP or the db01 IP?
I did a quick test last week, but I had db03 and db04 pointing to db01
IP.


On Jan 4, 7:26 pm, "Alexey Kovyrin" <ale...@kovyrin.net> wrote:

Bubba

unread,
Jan 7, 2008, 7:13:14 PM1/7/08
to MySQL Multi Master Manager Development
I did another test, and it seems replication is not auto-switching
like I expect.

I set db03, db04 slaves to point to the writer IP on db01.
1. I changed writers from db01 to db02: mmm_control move_role writer
db02
- db03 and db04 still pointed to dbwriter, but the master_log_file and
master_log_pos pointed to db01, replication was broken (not reading
from active writer)

2. I reset the config, then I turned off mysql on db01
- db02 took over as writer
- db03 and db04 still pointed to dbwriter, but the master_log_file and
master_log_pos pointed to db01, replication was broken (not reading
from active writer)

Alexey Kovyrin

unread,
Jan 7, 2008, 9:48:54 PM1/7/08
to mmm-...@googlegroups.com
Do you have mmm-agent configured and running on your slaves? Do you
have them configured in main mmmd_conf file?

--
Alexey Kovyrin
http://kovyrin.info/

Bubba

unread,
Jan 8, 2008, 5:24:58 PM1/8/08
to MySQL Multi Master Manager Development
I've setup the configs as in the examples (see below.)
I'm wondering if I missed an option somewhere?

"mmm_control show" output:

Config file: mmm_mon.conf
Daemon is running!
Servers status:
db01(192.168.28.211): master/ONLINE. Roles: reader(192.168.28.244;),
writer(192.168.28.240;)
db02(192.168.28.212): master/ONLINE. Roles: reader(192.168.28.243;)
db03(192.168.28.213): slave/ONLINE. Roles: reader(192.168.28.241;)
db04(192.168.28.214): slave/ONLINE. Roles: reader(192.168.28.242;)

My mmmd_agent on each slave is: (with correct server for "this", in
this case db03)
--------------------------------------------------
#
# 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 db03
mode slave

# For masters
#peer db02

# Cluster hosts addresses and access params
host db01
ip 192.168.28.211
port 3306
user bubba
password butters

host db02
ip 192.168.28.212
port 3306
user bubba
password butters

host db03
ip 192.168.28.213
port 3306
user bubba
password butters

host db04
ip 192.168.28.214
port 3306
user bubba
password butters
--------------------------------------------------

My mmmd_conf is:
--------------------------------------------------
#
# 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


# 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 db01
ip 192.168.28.211
port 3306
user rep_monitor
password RepMonitor
mode master
peer db02

host db02
ip 192.168.28.212
port 3306
user rep_monitor
password RepMonitor
mode master
peer db01

host db03
ip 192.168.28.213
port 3306
user rep_monitor
password RepMonitor
mode slave

host db04
ip 192.168.28.214
port 3306
user rep_monitor
password RepMonitor
mode slave


#
# Define roles
#

active_master_role writer

# Mysql Reader role
role reader
mode balanced
servers db01, db02, db03, db04
ip 192.168.28.241, 192.168.28.242, 192.168.28.243, 192.168.28.244

# Mysql Writer role
role writer
mode exclusive
servers db01, db02
ip 192.168.28.240

#
# Checks parameters
#

# Ping checker
check ping
check_period 1
trap_period 5
timeout 2

# Mysql checker
check mysql
check_period 1
trap_period 2
timeout 2

# Mysql replication backlog checker
check rep_backlog
check_period 5
trap_period 10
max_backlog 60
timeout 2

# Mysql replication threads checker
check rep_threads
check_period 1
trap_period 5
timeout 2

--------------------------------------------------


On Jan 7, 6:48 pm, "Alexey Kovyrin" <ale...@kovyrin.net> wrote:
> Do you have mmm-agent configured and running on your slaves? Do you
> have them configured in main mmmd_conf file?
>

Bubba

unread,
Jan 11, 2008, 1:32:36 PM1/11/08
to MySQL Multi Master Manager Development
Would it be because I am using MySQL 4.1 and its for MySQL 5+?

Alexey Kovyrin

unread,
Jan 14, 2008, 9:27:26 AM1/14/08
to mmm-...@googlegroups.com
On Jan 11, 2008 1:32 PM, Bubba <bryce....@gmail.com> wrote:
>
> Would it be because I am using MySQL 4.1 and its for MySQL 5+?

No, I do not think so, but will check it thoroughly today.

Bubba

unread,
Jan 21, 2008, 2:05:33 PM1/21/08
to MySQL Multi Master Manager Development
Did you determine anything? Did it work correctly in your test
environment?

On Jan 14, 6:27 am, "Alexey Kovyrin" <ale...@kovyrin.net> wrote:

Alexey Kovyrin

unread,
Jan 21, 2008, 6:26:01 PM1/21/08
to mmm-...@googlegroups.com
Yes, I've tested it, but due to high load (lots of work) forgot to
answer. I've tested mmm on 4.0, 4.1 and 5.0 (master-master pairs) and
it works fine. You just need to use the same mysql version on both
masters, but this is kinda obvious because you need the same versions
to start replication.

--
Alexey Kovyrin
http://kovyrin.info/

RobO

unread,
Mar 19, 2008, 10:11:04 PM3/19/08
to MySQL Multi Master Manager Development
I am in the same situation (2masters 2 slaves, all v4.1 ). Works
great between masters but the slaves are not getting updates. I have
my 2 slaves set to the writer IP, when I switch writer role to the
standby the slaves still have the original writer's MAC address
associated with the writer's IP address.

From a first glance it seems to be an arp caching issue, are the
slaves treated different than the masters w/r/t ip failover?

On Jan 21, 7:26 pm, "Alexey Kovyrin" <ale...@kovyrin.net> wrote:
> Yes, I've tested it, but due to high load (lots of work) forgot to
> answer. I've tested mmm on 4.0, 4.1 and 5.0 (master-master pairs) and
> it works fine. You just need to use the same mysql version on both
> masters, but this is kinda obvious because you need the same versions
> to start replication.
>

RobO

unread,
Mar 19, 2008, 10:24:30 PM3/19/08
to MySQL Multi Master Manager Development

RobO

unread,
Mar 19, 2008, 10:33:09 PM3/19/08
to MySQL Multi Master Manager Development
Works beautifully. Thanks!!!

On Mar 19, 10:24 pm, RobO <rob....@gmail.com> wrote:
> This threadhttp://groups.google.com/group/mmm-devel/browse_thread/thread/2af93a9...
Reply all
Reply to author
Forward
0 new messages