File: ndb_setup_slave.inc

package info (click to toggle)
mysql-5.1 5.1.73-1%2Bdeb6u1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze-lts
  • size: 197,132 kB
  • ctags: 93,377
  • sloc: cpp: 579,952; ansic: 429,462; perl: 49,053; sh: 21,692; pascal: 21,272; yacc: 12,801; makefile: 4,545; xml: 4,114; sql: 3,297; lex: 1,265; asm: 1,023
file content (27 lines) | stat: -rw-r--r-- 805 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#
# now setup replication to continue from last epoch
# 1. get ndb_apply_status epoch from slave
# 2. get corresponding _next_ binlog postition from master
# 3. change master on slave

# 1.
--connection slave
--replace_column 1 <the_epoch>
SELECT @the_epoch:=MAX(epoch) FROM mysql.ndb_apply_status;
--let $the_epoch= `select @the_epoch`

# 2.
--connection master
--replace_result $the_epoch <the_epoch>
--replace_column 1 <the_pos>
eval SELECT @the_pos:=Position,@the_file:=SUBSTRING_INDEX(FILE, '/', -1)
   FROM mysql.ndb_binlog_index WHERE epoch > $the_epoch ORDER BY epoch ASC LIMIT 1;
--let $the_pos= `SELECT @the_pos`
--let $the_file= `SELECT @the_file`

# 3.
--connection slave
--replace_result $the_pos <the_pos>
eval CHANGE MASTER TO
  master_log_file = '$the_file',
  master_log_pos = $the_pos ;