~chuck-bell/mysql-utilities/mysql-utilities

« back to all changes in this revision

Viewing changes to doc/man/mysqlreplicate.rst

  • Committer: chuck.bell at oracle
  • Date: 2011-09-29 14:14:38 UTC
  • Revision ID: chuck.bell@oracle.com-20110929141438-clzfl7m2769wt2jm
WL#5983 : allow user to specify binary log file and position (mysqlreplicate)

This patch adds new features to mysqlreplicate to permit starting replication
from the beginning, starting from a specific log file, and starting from a
specific log file and position.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
                 --slave=<user>[<passwd>]@<host>:[<port>][:<socket>]
14
14
                 [[--help | --version] | --quiet |
15
15
                 --verbose | --testdb=<test database> | --pedantic
16
 
                 --rpl_user=<uid:passwd>]
 
16
                 --rpl_user=<uid:passwd> | --master-log-file=<log_file> |
 
17
                 --master-log-pos=<pos> | --start-from-beginning]
17
18
 
18
19
DESCRIPTION
19
20
-----------
36
37
engine differs from the master and slave. Similarly, :option:`--pedantic`
37
38
requires the InnoDB storage engine to the be the same on the master and slave.
38
39
 
 
40
The utility will setup replication to start from the current binary log file
 
41
and position of the master. However, you can instruct the utility to start from
 
42
the beginning of recorded events by using the :option:`--start-from-beginning`
 
43
option. You can also provide a binary log file from the master with the
 
44
:option:`--master-log-file` option which will start replication from the first
 
45
event in that binary log file. Or you can start replication from a specific
 
46
binary log file and position with the :option:`--master-log-file` and
 
47
:option:`--master-log-pos` options. In summary, replication can be started
 
48
using one of the following strategies.
 
49
 
 
50
Start from current position (default)
 
51
  Start replication from last known binary log file and position from the
 
52
  master. The *SHOW MASTER STATUS* command is used to retrieve this
 
53
  information.
 
54
 
 
55
Start from the beginning
 
56
  Start replication from the first event recorded in the binary logging of the
 
57
  master.
 
58
  
 
59
Start from a binary log file
 
60
  Start replication at the first event in a specific binary log file.
 
61
  
 
62
Start from a specific event
 
63
  Start replication from a specific position (event) in a specific binary log
 
64
  file.
 
65
  
39
66
The :option:`-vv` option will also display any discrepancies among the storage
40
67
engines and InnoDB values with or without the :option:`--pedantic` option.
41
68
 
69
96
 
70
97
   database name to use in testing replication setup (optional)
71
98
 
 
99
.. option:: --master-log-file=<MASTER_LOG_FILE>
 
100
 
 
101
   use this master log file to initiate the slave.
 
102
 
 
103
.. option:: --master-log-pos=<MASTER_LOG_POS>
 
104
 
 
105
   use this position in the master log file to initiate the slave
 
106
 
 
107
.. option:: --start-from-beginning, -b
 
108
 
 
109
   start replication at the beginning of logged events. Not valid with
 
110
   --master-log-file or --master-log-pos
 
111
 
72
112
.. option:: --verbose, -v
73
113
 
74
114
   control how much information is displayed. For example, -v =
98
138
the default settings, use this command::
99
139
 
100
140
    $ mysqlreplicate --master=root@localhost:3306 \\
101
 
        --slave=root@localhost:3307 --rpl-user=rpl:rpl
 
141
      --slave=root@localhost:3307 --rpl-user=rpl:rpl
102
142
    # master on localhost: ... connected.
103
143
    # slave on localhost: ... connected.
104
144
    # Checking for binary logging on master...
128
168
    # Unlocking tables on master...
129
169
    # ...done.
130
170
 
 
171
The following command starts replication from the current position of the
 
172
master (default).::
 
173
 
 
174
   $ mysqlreplicate --master=root@localhost:3306 \\
 
175
        --slave=root@localhost:3307 --rpl-user=rpl:rpl
 
176
    # master on localhost: ... connected.
 
177
    # slave on localhost: ... connected.
 
178
    # Checking for binary logging on master...
 
179
    # Setting up replication...
 
180
    # ...done.
 
181
 
 
182
The following command tarts replication from the beginning of recorded events.::
 
183
 
 
184
   $ mysqlreplicate --master=root@localhost:3306 \\
 
185
        --slave=root@localhost:3307 --rpl-user=rpl:rpl \\
 
186
        --start-from-beginning
 
187
    # master on localhost: ... connected.
 
188
    # slave on localhost: ... connected.
 
189
    # Checking for binary logging on master...
 
190
    # Setting up replication...
 
191
    # ...done.
 
192
 
 
193
The following starts replication from the beginning of a specific binary log
 
194
file.::
 
195
 
 
196
   $ mysqlreplicate --master=root@localhost:3306 \\
 
197
        --slave=root@localhost:3307 --rpl-user=rpl:rpl \\
 
198
        --master-log-file=my_log.000003 
 
199
    # master on localhost: ... connected.
 
200
    # slave on localhost: ... connected.
 
201
    # Checking for binary logging on master...
 
202
    # Setting up replication...
 
203
    # ...done.
 
204
 
 
205
The following starts replication from an arbitrary binary log file and
 
206
position.::
 
207
 
 
208
   $ mysqlreplicate --master=root@localhost:3306 \\
 
209
        --slave=root@localhost:3307 --rpl-user=rpl:rpl \\
 
210
        --master-log-file=my_log.000001 --master-log-pos=96
 
211
    # master on localhost: ... connected.
 
212
    # slave on localhost: ... connected.
 
213
    # Checking for binary logging on master...
 
214
    # Setting up replication...
 
215
    # ...done.
 
216
 
 
217
 
131
218
RECOMMENDATIONS
132
219
---------------
133
220