Unix Technical Forum

starting a second slave from a first slave's dump

This is a discussion on starting a second slave from a first slave's dump within the MySQL General forum forums, part of the MySQL category; --> Scenario: host a is the master host b is a replication slave host c is to become a second ...


Go Back   Unix Technical Forum > Database Server Software > MySQL > MySQL General forum

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 06:48 AM
Ofer Inbar
 
Posts: n/a
Default starting a second slave from a first slave's dump

Scenario:
host a is the master
host b is a replication slave
host c is to become a second replication slave
there's no full dump from host a

Normally, to start a new slave, I'd restore a dump from host a, and
start slaving using the master data in that dump. In this situation,
however, running a full mysqldump on a would cause it to be unresponsive
for a while, and the app is depending on it (mostly MyISAM so can't run
the dump as a transaction).

I can temporarily make the front-end application not read from host b,
and while host b is not in use, run a full mysqldump there of the same
db, and restore that dump onto host c.

.... but how do I find the master data to start host c slaving with?

The dump file will have master data referring to host b's binlogs,
which are mostly empty because it's a replication slave. I need to
know what position in host a's binlogs to start host c slaving from.

One possibility I can think of:
- stop slave on host b
- run the dump on host b
- note its position in host a's binlogs using "show slave status"
- restore the dump on host c
- start c slaving using the binlog name and position from "show slave status"

Will that work?

Is there a way to do this *without* stopping replication on host b?
-- Cos
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 06:48 AM
Baron Schwartz
 
Posts: n/a
Default Re: starting a second slave from a first slave's dump

Hi

Ofer Inbar wrote:
> Scenario:
> host a is the master
> host b is a replication slave
> host c is to become a second replication slave
> there's no full dump from host a

[snip]
> One possibility I can think of:
> - stop slave on host b
> - run the dump on host b
> - note its position in host a's binlogs using "show slave status"
> - restore the dump on host c
> - start c slaving using the binlog name and position from "show slave status"
>
> Will that work?


Yes.

> Is there a way to do this *without* stopping replication on host b?


No, unless you have a snapshot-capable file system like LVM, and even then there
are caveats. Just be aware of which columns of SHOW SLAVE STATUS mean what --
there are three sets of binlog coordinates in that output. (There's a note on
the online manual that should make it clear).

Baron
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 06:48 AM
Ofer Inbar
 
Posts: n/a
Default Re: starting a second slave from a first slave's dump

Baron Schwartz <baron@xaprb.com> wrote:
> Ofer Inbar wrote:
> > host a is the master
> > host b is a replication slave
> > host c is to become a second replication slave
> > there's no full dump from host a


> >One possibility I can think of:
> > - stop slave on host b
> > - run the dump on host b
> > - note its position in host a's binlogs using "show slave status"
> > - restore the dump on host c
> > - start c slaving using the binlog name and position from "show slave status"
> >
> >Will that work?

>
> Yes.


For the benefit of future readers of the archive: yes, it worked easily.

> Just be aware of which columns of SHOW SLAVE STATUS
> mean what -- there are three sets of binlog coordinates in that output.
> (There's a note on the online manual that should make it clear).


The columns I used were:

Master_Log_File: binlog.000008
Read_Master_Log_Pos: 150484312

-- Cos
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:08 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com