Merge lp:~hrvojem/percona-xtrabackup/docfix into lp:percona-xtrabackup/2.0
- docfix
- Merge into 2.0
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Approved by: | Alexey Kopytov | ||||||||
Approved revision: | no longer in the source branch. | ||||||||
Merged at revision: | 379 | ||||||||
Proposed branch: | lp:~hrvojem/percona-xtrabackup/docfix | ||||||||
Merge into: | lp:percona-xtrabackup/2.0 | ||||||||
Diff against target: |
452 lines (+163/-94) 8 files modified
doc/source/conf.py (+3/-1) doc/source/glossary.rst (+4/-4) doc/source/howtos/recipes_ibkx_inc.rst (+1/-1) doc/source/howtos/setting_up_replication.rst (+150/-85) doc/source/howtos/ssh_server.rst (+1/-1) doc/source/innobackupex/innobackupex_option_reference.rst (+2/-1) doc/source/innobackupex/preparing_a_backup_ibk.rst (+1/-1) doc/source/xtrabackup_bin/preparing_the_backup.rst (+1/-0) |
||||||||
To merge this branch: | bzr merge lp:~hrvojem/percona-xtrabackup/docfix | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alexey Kopytov (community) | Approve | ||
Review via email: mp+88670@code.launchpad.net |
Commit message
Description of the change
Fixed some errors that were reporting when building the html docs
Fixed bug #914422
Hrvoje Matijakovic (hrvojem) wrote : | # |
On 16.01.2012 14:35, Alexey Kopytov wrote:
> Review: Needs Fixing
>
> Hrvoje,
>
> The changes look generally good to me. I just had a number of minor comments/questions:
>
> 1. |Percona Toolkit| is defined as a macro for ":term:`Percona Toolkit`", but is not actually used anywhere?
>
> There's also an inconsistency. |XtraBackup| and |Percona Server| are defined as just emphasized text rather than terms. Shouldn't |Percona Toolkit| be defined in the same way?
>
fixed
> 2. s/reffer/refer/g ?
fixed
>
> 3. Please keep "innobackupex" in examples and not replace it with "innobackupex-
fixed
>
> 4. Any specific reasons for removing streaming backups from the replication setup guidelines? It's not like it's wrong, I'm just curious.
>
No special reason. I somehow figured out this was more simple solution.
But I can make another one with streaming or put it back as it was.
> 5. I'm not sure "mv /path/to/
root@arrakis:/# mv /tmp/2012-
root@arrakis:/# ls -lah /tmp/test/mysql
total 31M
drwxr-xr-x 6 root root 4,0K Sij 16 11:19 .
drwxr-xr-x 3 root root 4,0K Sij 16 14:41 ..
-rw-r--r-- 1 root root 324 Sij 16 11:14 backup-my.cnf
drwxr-xr-x 2 root root 4,0K Sij 16 11:15 cacti
-rw-r--r-- 1 root root 18M Sij 16 11:19 ibdata1
-rw-r--r-- 1 root root 5,0M Sij 16 11:19 ib_logfile0
-rw-r--r-- 1 root root 5,0M Sij 16 11:19 ib_logfile1
>
> 6. Shouldn't we make it clear somehow that TIMESTAMP in examples should not be typed literally, but replaced with the actual directory name?
I've changed it to $TIMESTAMP and added the short note: You need to
select path where your snapshot has been taken, for example
/home/backups/
>
> 7. s/slights variation/slight variations/ ? (I know it's not your text, but might be a good idea to fix spelling once you are touching that line)
fixed
>
> 8. s/previuos/
fixed
>
> 9. Please don't reuse branches for different MPs. As a result, this MP now contains fixes for both bug #878457 and bug #914422. Which makes it harder to manage and review.
yeah sorry about that one.
Alexey Kopytov (akopytov) wrote : | # |
Looks good now.
Alexey Kopytov (akopytov) wrote : | # |
Changing to In Progress to take additional notes in bug #914422 into account.
Preview Diff
1 | === modified file 'doc/source/conf.py' | |||
2 | --- doc/source/conf.py 2011-09-24 04:42:37 +0000 | |||
3 | +++ doc/source/conf.py 2012-01-17 09:06:25 +0000 | |||
4 | @@ -44,7 +44,7 @@ | |||
5 | 44 | 44 | ||
6 | 45 | # General information about the project. | 45 | # General information about the project. |
7 | 46 | project = u'Percona XtraBackup' | 46 | project = u'Percona XtraBackup' |
9 | 47 | copyright = u'2011, Percona Inc' | 47 | copyright = u'2012, Percona Inc' |
10 | 48 | 48 | ||
11 | 49 | # The version info for the project you're documenting, acts as replacement for | 49 | # The version info for the project you're documenting, acts as replacement for |
12 | 50 | # |version| and |release|, also used in various other places throughout the | 50 | # |version| and |release|, also used in various other places throughout the |
13 | @@ -100,6 +100,8 @@ | |||
14 | 100 | 100 | ||
15 | 101 | .. |MyISAM| replace:: :term:`MyISAM` | 101 | .. |MyISAM| replace:: :term:`MyISAM` |
16 | 102 | 102 | ||
17 | 103 | .. |Percona Toolkit| replace:: *Percona Toolkit* | ||
18 | 104 | |||
19 | 103 | .. |LSN| replace:: :term:`LSN` | 105 | .. |LSN| replace:: :term:`LSN` |
20 | 104 | 106 | ||
21 | 105 | .. |XtraBackup| replace:: *XtraBackup* | 107 | .. |XtraBackup| replace:: *XtraBackup* |
22 | 106 | 108 | ||
23 | === modified file 'doc/source/glossary.rst' | |||
24 | --- doc/source/glossary.rst 2011-07-07 05:32:50 +0000 | |||
25 | +++ doc/source/glossary.rst 2012-01-17 09:06:25 +0000 | |||
26 | @@ -18,7 +18,7 @@ | |||
27 | 18 | or start the server with ``--innodb_file_per_table``. | 18 | or start the server with ``--innodb_file_per_table``. |
28 | 19 | 19 | ||
29 | 20 | innodb_expand_import | 20 | innodb_expand_import |
31 | 21 | This feature of |Percona Server| implements the abililty to import arbitrary :term:`.ibd` files exported using the |XtraBackup| :option:`--export` option. | 21 | This feature of |Percona Server| implements the ability to import arbitrary :term:`.ibd` files exported using the |XtraBackup| :option:`--export` option. |
32 | 22 | 22 | ||
33 | 23 | See the `the full documentation <http://www.percona.com/docs/wiki/percona-server:features:innodb_import_table_from_xtrabackup?redirect=2>`_ for more information. | 23 | See the `the full documentation <http://www.percona.com/docs/wiki/percona-server:features:innodb_import_table_from_xtrabackup?redirect=2>`_ for more information. |
34 | 24 | 24 | ||
35 | @@ -55,7 +55,7 @@ | |||
36 | 55 | innodb_buffer_pool_size=8MB | 55 | innodb_buffer_pool_size=8MB |
37 | 56 | 56 | ||
38 | 57 | InnoDB | 57 | InnoDB |
40 | 58 | Storage engine which provides ACID-compilant transactions and foreing key support, among others improvements over :term:`MyISAM`. It is the default engine for |MySQL| as of the 5.5 series. | 58 | Storage engine which provides ACID-compliant transactions and foreign key support, among others improvements over :term:`MyISAM`. It is the default engine for |MySQL| as of the 5.5 series. |
41 | 59 | 59 | ||
42 | 60 | MyISAM | 60 | MyISAM |
43 | 61 | Previous default storage engine for |MySQL| for versions prior to 5.5. It doesn't fully support transactions but in some scenarios may be faster than :term:`InnoDB`. Each table is stored on disk in 3 files: :term:`.frm`, :term:`.MYD`, :term:`.MYI` | 61 | Previous default storage engine for |MySQL| for versions prior to 5.5. It doesn't fully support transactions but in some scenarios may be faster than :term:`InnoDB`. Each table is stored on disk in 3 files: :term:`.frm`, :term:`.MYD`, :term:`.MYI` |
44 | @@ -91,10 +91,10 @@ | |||
45 | 91 | Each table using the :program:`MERGE` storage engine, besides of a :term:`.frm` file, will have :term:`.MRG` file containing the names of the |MyISAM| tables associated with it. | 91 | Each table using the :program:`MERGE` storage engine, besides of a :term:`.frm` file, will have :term:`.MRG` file containing the names of the |MyISAM| tables associated with it. |
46 | 92 | 92 | ||
47 | 93 | .TRG | 93 | .TRG |
49 | 94 | File containing the TRiGgers associated to a table, e.g. `:file:`mytable.TRG`. With the :term:`.TRN` file, they represent all the Trigger definitions. | 94 | File containing the Triggers associated to a table, e.g. `:file:`mytable.TRG`. With the :term:`.TRN` file, they represent all the Trigger definitions. |
50 | 95 | 95 | ||
51 | 96 | .TRN | 96 | .TRN |
53 | 97 | File containing the TRiggers' Names associated to a table, e.g. `:file:`mytable.TRN`. With the :term:`.TRG` file, they represent all the Trigger definitions. | 97 | File containing the Triggers' Names associated to a table, e.g. `:file:`mytable.TRN`. With the :term:`.TRG` file, they represent all the Trigger definitions. |
54 | 98 | 98 | ||
55 | 99 | .ARM | 99 | .ARM |
56 | 100 | Each table with the :program:`Archive Storage Engine` has ``.ARM`` file which contains the metadata of it. | 100 | Each table with the :program:`Archive Storage Engine` has ``.ARM`` file which contains the metadata of it. |
57 | 101 | 101 | ||
58 | === modified file 'doc/source/howtos/recipes_ibkx_inc.rst' | |||
59 | --- doc/source/howtos/recipes_ibkx_inc.rst 2011-07-07 05:32:50 +0000 | |||
60 | +++ doc/source/howtos/recipes_ibkx_inc.rst 2012-01-17 09:06:25 +0000 | |||
61 | @@ -38,7 +38,7 @@ | |||
62 | 38 | 38 | ||
63 | 39 | *The final data will be in the base backup directory*, not in the incremental one. In this example, ``/path/to/backup/dir/2011-12-24_23-01-00`` or ``$FULLBACKUP``. | 39 | *The final data will be in the base backup directory*, not in the incremental one. In this example, ``/path/to/backup/dir/2011-12-24_23-01-00`` or ``$FULLBACKUP``. |
64 | 40 | 40 | ||
66 | 41 | If you want to apply more incremental backups, repeat this step with the next one. It is important that you do this in the chronological order in where the the backups were done. | 41 | If you want to apply more incremental backups, repeat this step with the next one. It is important that you do this in the chronological order in where the backups were done. |
67 | 42 | 42 | ||
68 | 43 | You can check the file xtrabackup_checkpoints at the directory of each one. | 43 | You can check the file xtrabackup_checkpoints at the directory of each one. |
69 | 44 | 44 | ||
70 | 45 | 45 | ||
71 | === modified file 'doc/source/howtos/setting_up_replication.rst' | |||
72 | --- doc/source/howtos/setting_up_replication.rst 2012-01-04 03:37:24 +0000 | |||
73 | +++ doc/source/howtos/setting_up_replication.rst 2012-01-17 09:06:25 +0000 | |||
74 | @@ -1,84 +1,140 @@ | |||
75 | 1 | .. _replication_howto: | 1 | .. _replication_howto: |
76 | 2 | 2 | ||
77 | 3 | ======================================================================== | 3 | ======================================================================== |
79 | 4 | How to setup a slave for replication in 5 simple steps with Xtrabackup | 4 | How to setup a slave for replication in 6 simple steps with Xtrabackup |
80 | 5 | ======================================================================== | 5 | ======================================================================== |
81 | 6 | 6 | ||
82 | 7 | Data is, by far, the most valuable part of a system. Having a backup done systematically and available for a rapid recovery in case of failure is admittedly essential to a system. However, it is not common practice because of its costs, infrastructure needed or even the boredom associated to the task. Xtrabackup is designed to solve this problem. | 7 | Data is, by far, the most valuable part of a system. Having a backup done systematically and available for a rapid recovery in case of failure is admittedly essential to a system. However, it is not common practice because of its costs, infrastructure needed or even the boredom associated to the task. Xtrabackup is designed to solve this problem. |
83 | 8 | 8 | ||
85 | 9 | You can have almost real-time backups in 5 simple steps by setting up a replication environment with |XtraBackup|. | 9 | You can have almost real-time backups in 6 simple steps by setting up a replication environment with |XtraBackup|. |
86 | 10 | 10 | ||
88 | 11 | *Percona* |XtraBackup| is a tool for backing up your data extremely easy and without interruption. It performs "hot backups" on unmodified versions of |MySQL| servers (5.0 and 5.1), as well as |MariaDB| and *Percona Servers*. It is a totally free and open source software distributed only under the *GPLv2* license. | 11 | *Percona* |XtraBackup| is a tool for backing up your data extremely easy and without interruption. It performs "hot backups" on unmodified versions of |MySQL| servers (5.0, 5.1 and 5.5), as well as |MariaDB| and *Percona Servers*. It is a totally free and open source software distributed only under the *GPLv2* license. |
89 | 12 | 12 | ||
90 | 13 | All the things you will need | 13 | All the things you will need |
91 | 14 | ============================ | 14 | ============================ |
92 | 15 | 15 | ||
93 | 16 | Setting up a slave for replication with |XtraBackup| is really a very straightforward procedure. In order to keep it simple, here is a list of the things you need to follow the steps without hassles: | 16 | Setting up a slave for replication with |XtraBackup| is really a very straightforward procedure. In order to keep it simple, here is a list of the things you need to follow the steps without hassles: |
94 | 17 | 17 | ||
97 | 18 | * ``The Master`` | 18 | * ``TheMaster`` |
98 | 19 | A system with a |MySQL|-based server installed, configured and running. This system will be called ``The Master``, as it is where your data is stored and the one to be replicated. We will assume the following about this system: | 19 | A system with a |MySQL|-based server installed, configured and running. This system will be called ``TheMaster``, as it is where your data is stored and the one to be replicated. We will assume the following about this system: |
99 | 20 | 20 | ||
100 | 21 | * the |MySQL| server is able to communicate with others by the standard TCP/IP port; | 21 | * the |MySQL| server is able to communicate with others by the standard TCP/IP port; |
101 | 22 | 22 | ||
102 | 23 | * the *SSH* server is installed and configured; | 23 | * the *SSH* server is installed and configured; |
103 | 24 | 24 | ||
111 | 25 | * you have an user account in the system with the appropiate permissions; | 25 | * you have an user account in the system with the appropriate permissions; |
112 | 26 | 26 | ||
113 | 27 | * you have a MySQL's user account with appropiate privileges. | 27 | * you have a MySQL's user account with appropriate privileges. |
114 | 28 | 28 | ||
115 | 29 | 29 | * server has binlogs enabled and server-id set up to 1. | |
116 | 30 | * ``The Slave`` | 30 | |
117 | 31 | Another system, with a |MySQL|-based server installed on it. We will reffer to this machine as ``The Slave`` and we will assume the same things we did about ``The Master``. | 31 | |
118 | 32 | * ``TheSlave`` | ||
119 | 33 | Another system, with a |MySQL|-based server installed on it. We will refer to this machine as ``TheSlave`` and we will assume the same things we did about ``TheMaster``. | ||
120 | 32 | 34 | ||
121 | 33 | * ``Xtrabackup`` | 35 | * ``Xtrabackup`` |
122 | 34 | The backup tool we will use. It should be installed in both computers for convenience. | 36 | The backup tool we will use. It should be installed in both computers for convenience. |
123 | 35 | 37 | ||
138 | 36 | STEP 1: Make a backup on ``The Master`` and stream it to ``The Slave`` | 38 | STEP 1: Make a backup on ``TheMaster`` and prepare it |
139 | 37 | ====================================================================== | 39 | ===================================================== |
140 | 38 | 40 | ||
141 | 39 | At ``The Master``, issue the following to a shell: | 41 | At ``TheMaster``, issue the following to a shell: |
142 | 40 | 42 | ||
143 | 41 | .. code-block:: console | 43 | .. code-block:: console |
144 | 42 | 44 | ||
145 | 43 | TheMaster$ innobackupex --user=yourDBuser --password=MaGiCdB1 \ | 45 | TheMaster$ innobackupex --user=yourDBuser --password=MaGiCdB1 /path/to/backupdir |
146 | 44 | --stream=tar /tmp/ | \ | 46 | |
147 | 45 | ssh user@THESLAVE "tar xfi - -C /var/lib/mysql" | 47 | After this is finished you should get: |
148 | 46 | 48 | ||
149 | 47 | You have told |XtraBackup| (through the |innobackupex| script) to connect to the database server using your database user and password, and do a hot backup of all your data in it (all |MyISAM|, |InnoDB| tables and indexes in them). | 49 | .. code-block:: console |
150 | 48 | 50 | ||
151 | 49 | Instead of writing it to a file, we printed it to ``STDOUT``, so it can be piped - via :command:`ssh` - to :command:`tar` in ``The Slave``, which will extract the files directly to ``The Slave`` 's data directory. | 51 | innobackupex: completed OK! |
152 | 52 | |||
153 | 53 | This will make a copy of your |MySQL| data dir to the /path/to/backupdir/$TIMESTAMP. You have told |XtraBackup| (through the |innobackupex| script) to connect to the database server using your database user and password, and do a hot backup of all your data in it (all |MyISAM|, |InnoDB| tables and indexes in them). | ||
154 | 54 | |||
155 | 55 | In order for snapshot to be consistent you need to prepare the data: | ||
156 | 56 | |||
157 | 57 | .. code-block:: console | ||
158 | 58 | |||
159 | 59 | TheMaster$ innobackupex --user=yourDBuser --password=MaGiCdB1 / | ||
160 | 60 | --apply-log /path/to/backupdir/$TIMESTAMP/ | ||
161 | 61 | |||
162 | 62 | You need to select path where your snapshot has been taken, for example /home/backups/2012-01-16_11-14-43. If everything is ok you should get the same OK message. Now the transaction logs are applied to the data files, and new ones are created: your data files are ready to be used by the MySQL server. | ||
163 | 50 | 63 | ||
164 | 51 | |XtraBackup| knows where your data is by reading your :term:`my.cnf`. If you have your configuration file in a non-standard place, you should use the flag :option:`--defaults-file` ``=/location/of/my.cnf``. | 64 | |XtraBackup| knows where your data is by reading your :term:`my.cnf`. If you have your configuration file in a non-standard place, you should use the flag :option:`--defaults-file` ``=/location/of/my.cnf``. |
165 | 52 | 65 | ||
182 | 53 | If, instead of ``--stream=tar /tmp/``, you give a directory to |innobackupex|, then the backup will be kept in ``The Master`` 's filesystem. A subdirectory will be created on the path you gave it and its name will be the current timestamp. You should copy that entire subdirectory to ``The Slave``, for example, with ``scp -r 2011-12-31_23-59-59``. | 66 | If you want to skip writing the username/password every time you want to access the MySQL, you can set it up in your $HOME folder. Just edit .my.cnf and add: |
183 | 54 | 67 | ||
184 | 55 | STEP 2: Apply the logs to the data | 68 | .. code-block:: console |
185 | 56 | ================================== | 69 | |
186 | 57 | 70 | [client] | |
187 | 58 | At ``The Slave``, tell |XtraBackup| to apply the binary logs to the data with: | 71 | user=root |
188 | 59 | 72 | pass=MaGiCdB1 | |
189 | 60 | .. code-block:: console | 73 | |
190 | 61 | 74 | This is will give you root access to MySQL. | |
191 | 62 | TheSlave$ innobackupex --apply-log --use-memory=2G /var/lib/mysql | 75 | |
192 | 63 | 76 | STEP 2: Copy backed up data to TheSlave | |
193 | 64 | Now the transaction logs are applied to the data files, and new ones are created: your data files are ready to be used by the MySQL server. | 77 | ======================================== |
194 | 65 | 78 | ||
195 | 66 | The :option:`--use-memory` ``=2G`` option indicates Xtrabackup to use 2 Gigabytes of RAM for the process. Adjust this amount to your situation in order to speed up the task. | 79 | Use rsync or scp to copy the data from Master to Slave. If you're syncing the data directly to slave's data directory it's advised to stop the mysqld there. |
196 | 67 | 80 | ||
197 | 68 | STEP 3: Configure The Slave's MySQL server | 81 | .. code-block:: console |
198 | 82 | |||
199 | 83 | TheMaster$ rsync -avprP -e ssh /path/to/backupdir/$TIMESTAMP TheSlave:/path/to/mysql/ | ||
200 | 84 | |||
201 | 85 | After data has been copied you can back up the original or previously installed |MySQL| datadir: | ||
202 | 86 | |||
203 | 87 | .. code-block:: console | ||
204 | 88 | |||
205 | 89 | TheSlave$ mv /path/to/mysql/datadir /path/to/mysql/datadir_bak | ||
206 | 90 | |||
207 | 91 | and move the snapshot from ``TheMaster`` in its place: | ||
208 | 92 | |||
209 | 93 | .. code-block:: console | ||
210 | 94 | |||
211 | 95 | TheSlave$ mv /path/to/mysql/$TIMESTAMP /path/to/mysql/datadir | ||
212 | 96 | |||
213 | 97 | After you copy data over, make sure |MySQL| has proper permissions to access them. | ||
214 | 98 | |||
215 | 99 | .. code-block:: console | ||
216 | 100 | |||
217 | 101 | TheSlave$ chown mysql:mysql /path/to/mysql/datadir | ||
218 | 102 | |||
219 | 103 | In case the ibdata and iblog files are located in different directories outside of the datadir, you will have to put them in their proper place after the logs have been applied. | ||
220 | 104 | |||
221 | 105 | STEP 3: Configure The Master's MySQL server | ||
222 | 106 | =========================================== | ||
223 | 107 | |||
224 | 108 | Add the appropriate grant in order for slave to be able to connect to master: | ||
225 | 109 | |||
226 | 110 | .. code-block:: mysql | ||
227 | 111 | |||
228 | 112 | TheMaster|mysql> GRANT REPLICATION SLAVE ON *.* TO 'repl'@'$slaveip' | ||
229 | 113 | IDENTIFIED BY '$slavepass'; | ||
230 | 114 | |||
231 | 115 | Also make sure that firewall rules are correct and that ``TheSlave`` can connect to ``TheMaster``. | ||
232 | 116 | |||
233 | 117 | STEP 4: Configure The Slave's MySQL server | ||
234 | 69 | ========================================== | 118 | ========================================== |
235 | 70 | 119 | ||
237 | 71 | First copy the :term:`my.cnf` file from ``The Master`` to ``The Slave``: | 120 | First copy the :term:`my.cnf` file from ``TheMaster`` to ``TheSlave``: |
238 | 72 | 121 | ||
239 | 73 | .. code-block:: console | 122 | .. code-block:: console |
240 | 74 | 123 | ||
241 | 75 | TheSlave$ scp user@TheMaster:/etc/mysql/my.cnf /etc/mysql/my.cnf | 124 | TheSlave$ scp user@TheMaster:/etc/mysql/my.cnf /etc/mysql/my.cnf |
242 | 76 | 125 | ||
248 | 77 | and start/restart :command:`mysqld` on ``The Slave``. | 126 | then change the following options in /etc/mysql/my.cnf: |
249 | 78 | 127 | ||
250 | 79 | You can do this without problems because you are replicating the "whole server". As it is the first slave that ``The Master`` has, |MySQL| will do the rest automatically. | 128 | .. code-block:: console |
251 | 80 | 129 | ||
252 | 81 | STEP 4: Start the replication | 130 | server-id=2 |
253 | 131 | |||
254 | 132 | and start/restart :command:`mysqld` on ``TheSlave``. | ||
255 | 133 | |||
256 | 134 | In case you're using init script to start mysqld, be sure that the password for that user has been updated and it's the same as one on ``TheMaster``. For example, Debian and Ubuntu use debian-sys-maint user to do that. Password can be seen and updated in :file:`/etc/mysql/debian.cnf`. | ||
257 | 135 | |||
258 | 136 | |||
259 | 137 | STEP 5: Start the replication | ||
260 | 82 | ============================= | 138 | ============================= |
261 | 83 | 139 | ||
262 | 84 | Look at the content of the file :file:`xtrabackup_binlog_info`, it will be something like: | 140 | Look at the content of the file :file:`xtrabackup_binlog_info`, it will be something like: |
263 | @@ -86,15 +142,16 @@ | |||
264 | 86 | .. code-block:: console | 142 | .. code-block:: console |
265 | 87 | 143 | ||
266 | 88 | TheSlave$ cat /var/lib/mysql/xtrabackup_binlog_info | 144 | TheSlave$ cat /var/lib/mysql/xtrabackup_binlog_info |
268 | 89 | TheMaster-bin.000001 481 | 145 | TheMaster-bin.000001 481 |
269 | 90 | 146 | ||
271 | 91 | Execute the ``CHANGE MASTER`` statement on a mysql console but remember to add to it your database user and password in ``The Master``: | 147 | Execute the ``CHANGE MASTER`` statement on a MySQL console and use the username and password you've set up in STEP 3: |
272 | 92 | 148 | ||
273 | 93 | .. code-block:: mysql | 149 | .. code-block:: mysql |
274 | 94 | 150 | ||
275 | 95 | TheSlave|mysql> CHANGE MASTER TO | 151 | TheSlave|mysql> CHANGE MASTER TO |
278 | 96 | MASTER_USER='DBuserInTheMaster', | 152 | MASTER_HOST='$masterip', |
279 | 97 | MASTER_PASSWORD='m4g1cM4st3r', | 153 | MASTER_USER='repl', |
280 | 154 | MASTER_PASSWORD='$slavepass', | ||
281 | 98 | MASTER_LOG_FILE='TheMaster-bin.000001', | 155 | MASTER_LOG_FILE='TheMaster-bin.000001', |
282 | 99 | MASTER_LOG_POS=481; | 156 | MASTER_LOG_POS=481; |
283 | 100 | 157 | ||
284 | @@ -104,7 +161,7 @@ | |||
285 | 104 | 161 | ||
286 | 105 | TheSlave|mysql> START SLAVE; | 162 | TheSlave|mysql> START SLAVE; |
287 | 106 | 163 | ||
289 | 107 | STEP 5: Check | 164 | STEP 6: Check |
290 | 108 | ============= | 165 | ============= |
291 | 109 | 166 | ||
292 | 110 | You should check that everything went OK with: | 167 | You should check that everything went OK with: |
293 | @@ -119,56 +176,64 @@ | |||
294 | 119 | Seconds_Behind_Master: 13 | 176 | Seconds_Behind_Master: 13 |
295 | 120 | ... | 177 | ... |
296 | 121 | 178 | ||
298 | 122 | The ``Seconds_Behind_Master`` means the ``SQL`` currently being executed has a ``current_timestamp`` of 13 seconds ago. It is an estimation of the lag between ``The Master`` and ``The Slave``. Note that at the begining, a high value should be shown because ``The Slave`` has to "catch up" with ``The Master``. | 179 | Both ``IO`` and ``SQL`` threads need to be running. The ``Seconds_Behind_Master`` means the ``SQL`` currently being executed has a ``current_timestamp`` of 13 seconds ago. It is an estimation of the lag between ``TheMaster`` and ``TheSlave``. Note that at the beginning, a high value could be shown because ``TheSlave`` has to "catch up" with ``TheMaster``. |
299 | 123 | 180 | ||
300 | 124 | Adding more slaves to The Master | 181 | Adding more slaves to The Master |
301 | 125 | ================================ | 182 | ================================ |
302 | 126 | 183 | ||
320 | 127 | You can use this procedure with slights variation to add new slaves to a master. We will use |Xtrabackup| to clone an already configured slave. We will continue using the previuos scenario for convenience but we will add ``The NEW Slave`` to the plot. | 184 | You can use this procedure with slight variation to add new slaves to a master. We will use |Xtrabackup| to clone an already configured slave. We will continue using the previous scenario for convenience but we will add ``TheNewSlave`` to the plot. |
321 | 128 | 185 | ||
322 | 129 | At ``The Slave``, do a full backup and stream it to ``The New Slave``: | 186 | At ``TheSlave``, do a full backup: |
323 | 130 | 187 | ||
324 | 131 | .. code-block:: console | 188 | .. code-block:: console |
325 | 132 | 189 | ||
326 | 133 | TheSlave$ innobackupex --user=yourDBuser --password=MaGiCiGaM \ | 190 | TheSlave$ innobackupex --user=yourDBuser --password=MaGiCiGaM / |
327 | 134 | --stream=tar /tmp/ --slave-info | \ | 191 | --slave-info /path/to/backupdir |
328 | 135 | ssh user@TheNEWSlave "tar xfi - -C /var/lib/mysql" | 192 | |
329 | 136 | 193 | By using the :option:`--slave-info` Xtrabackup creates additional file called :file:`xtrabackup_slave_info`. | |
330 | 137 | and apply the logs on ``The NEW Slave``: | 194 | |
331 | 138 | 195 | Apply the logs: | |
332 | 139 | .. code-block:: console | 196 | |
333 | 140 | 197 | .. code-block:: console | |
334 | 141 | TheNEWSlave$ innobackupex --apply-log --use-memory=2G /var/lib/mysql | 198 | |
335 | 142 | 199 | TheSlave$ innobackupex --apply-log --use-memory=2G /path/to/backupdir/$TIMESTAMP/ | |
336 | 143 | and copy the configuration file from ``The Slave``: | 200 | |
337 | 201 | Copy the directory from the ``TheSlave`` to ``TheNewSlave``: | ||
338 | 202 | |||
339 | 203 | .. code-block:: console | ||
340 | 204 | |||
341 | 205 | rsync -avprP -e ssh /path/to/backupdir/$TIMESTAMP TheNewSlave:/path/to/mysql/datadir | ||
342 | 206 | |||
343 | 207 | Add additional grant on the master: | ||
344 | 208 | |||
345 | 209 | .. code-block:: mysql | ||
346 | 210 | |||
347 | 211 | TheMaster|mysql> GRANT REPLICATION SLAVE ON *.* TO 'repl'@'$newslaveip' | ||
348 | 212 | IDENTIFIED BY '$slavepass'; | ||
349 | 213 | |||
350 | 214 | Copy the configuration file from ``TheSlave``: | ||
351 | 144 | 215 | ||
352 | 145 | .. code-block:: console | 216 | .. code-block:: console |
353 | 146 | 217 | ||
354 | 147 | TheNEWSlave$ scp user@TheSlave:/etc/mysql/my.cnf /etc/mysql/my.cnf | 218 | TheNEWSlave$ scp user@TheSlave:/etc/mysql/my.cnf /etc/mysql/my.cnf |
355 | 148 | 219 | ||
357 | 149 | Now comes a slight variation on the procedure: before starting the |MySQL| server, set the variable ``server_id`` in :term:`my.cnf` to a value greater than 2, for example, with | 220 | Make sure you change the server-id variable in :file:`/etc/mysql/my.cnf` to 3 and disable the replication on start: |
358 | 150 | 221 | ||
359 | 151 | .. code-block:: console | 222 | .. code-block:: console |
360 | 152 | 223 | ||
364 | 153 | TheNEWSlave$ echo '\nSERVER_ID=3' >> /etc/mysql/my.cnf | 224 | skip-slave-start |
365 | 154 | 225 | server-id=3 | |
363 | 155 | This is because on a replication environment with one master and one slave, if the variable is not setted (as default) |MySQL| assumes 1 for ``server_id`` in the master and 2 in the slave. If you don't change it, |MySQL| will assume a value of 2 in ``The New Slave`` again: the replication will fail because all servers involved must have a different ``server_id``. | ||
366 | 156 | 226 | ||
367 | 157 | After setting ``server_id``, start :command:`mysqld`. | 227 | After setting ``server_id``, start :command:`mysqld`. |
368 | 158 | 228 | ||
376 | 159 | As we backed up a slave that was doing a replication, in a :command:`mysql` console tell the server to stop doing it: | 229 | Fetch the master_log_file and master_log_pos from the file :file:`xtrabackup_slave_info`, execute the statement for setting up the master and the log file for ``The NEW Slave``: |
370 | 160 | |||
371 | 161 | .. code-block:: mysql | ||
372 | 162 | |||
373 | 163 | TheNEWSlave|mysql> STOP SLAVE; | ||
374 | 164 | |||
375 | 165 | With the help of the file :file:`xtrabackup_slave_info`, execute the statement for setting up the master and the log file for ``The NEW Slave``: | ||
377 | 166 | 230 | ||
378 | 167 | .. code-block:: mysql | 231 | .. code-block:: mysql |
379 | 168 | 232 | ||
380 | 169 | TheNEWSlave|mysql> CHANGE MASTER TO | 233 | TheNEWSlave|mysql> CHANGE MASTER TO |
383 | 170 | MASTER_USER='DBuserInTheMaster', | 234 | MASTER_HOST='$masterip' |
384 | 171 | MASTER_PASSWORD='m4g1cM4st3r', | 235 | MASTER_USER='repl', |
385 | 236 | MASTER_PASSWORD='$slavepass', | ||
386 | 172 | MASTER_LOG_FILE='TheMaster-bin.000001', | 237 | MASTER_LOG_FILE='TheMaster-bin.000001', |
387 | 173 | MASTER_LOG_POS=481; | 238 | MASTER_LOG_POS=481; |
388 | 174 | 239 | ||
389 | @@ -178,4 +243,4 @@ | |||
390 | 178 | 243 | ||
391 | 179 | TheSlave|mysql> START SLAVE; | 244 | TheSlave|mysql> START SLAVE; |
392 | 180 | 245 | ||
394 | 181 | and we have a The NEW Slave replicating The Master. | 246 | If both IO and SQL threads are running when you check the ``TheNewSlave``, server is replicating ``TheMaster``. |
395 | 182 | 247 | ||
396 | === modified file 'doc/source/howtos/ssh_server.rst' | |||
397 | --- doc/source/howtos/ssh_server.rst 2011-07-07 05:32:50 +0000 | |||
398 | +++ doc/source/howtos/ssh_server.rst 2012-01-17 09:06:25 +0000 | |||
399 | @@ -7,7 +7,7 @@ | |||
400 | 7 | ubuntu$ sudo apt-get install openssh-server | 7 | ubuntu$ sudo apt-get install openssh-server |
401 | 8 | archlinux$ sudo pacman -S openssh | 8 | archlinux$ sudo pacman -S openssh |
402 | 9 | 9 | ||
404 | 10 | You may need to take a look at your distribution's documentation or search for a tutorial in the internet to configure it if you haven't done it before. | 10 | You may need to take a look at your distribution's documentation or search for a tutorial in the Internet to configure it if you haven't done it before. |
405 | 11 | 11 | ||
406 | 12 | Some links of them are: | 12 | Some links of them are: |
407 | 13 | 13 | ||
408 | 14 | 14 | ||
409 | === modified file 'doc/source/innobackupex/innobackupex_option_reference.rst' | |||
410 | --- doc/source/innobackupex/innobackupex_option_reference.rst 2011-11-15 14:54:45 +0000 | |||
411 | +++ doc/source/innobackupex/innobackupex_option_reference.rst 2012-01-17 09:06:25 +0000 | |||
412 | @@ -89,6 +89,7 @@ | |||
413 | 89 | .. option:: --no-lock | 89 | .. option:: --no-lock |
414 | 90 | 90 | ||
415 | 91 | Use this option to disable table lock with ``FLUSH TABLES WITH READ LOCK``. Use it only if ALL your tables are InnoDB and you **DO NOT CARE** about the binary log position of the backup. | 91 | Use this option to disable table lock with ``FLUSH TABLES WITH READ LOCK``. Use it only if ALL your tables are InnoDB and you **DO NOT CARE** about the binary log position of the backup. |
416 | 92 | If you are considering to use :option:`--no-lock` because your backups are failing to acquire the lock, this could be because of incoming replication events preventing the lock from succeeding. Please try using :option:`--safe-slave-backup` to momentarily stop the replication slave thread, this may help the backup to succeed and you then don't need to resort to using :option:`--no-lock`. | ||
417 | 92 | 93 | ||
418 | 93 | .. option:: --ibbackup = 'autodetect' | 94 | .. option:: --ibbackup = 'autodetect' |
419 | 94 | 95 | ||
420 | @@ -112,7 +113,7 @@ | |||
421 | 112 | 113 | ||
422 | 113 | .. option:: --extra-lsndir | 114 | .. option:: --extra-lsndir |
423 | 114 | 115 | ||
425 | 115 | This option accepts a string argument that specifies the directory in which to save an extra copy of the :file:`xtrabackup_checkpoints` file. It is passed directly to |xtrabackup| 's :option:`--extra-lsndir` option. See the :program:`xtrabackup` documentation for details. | 116 | This option accepts a string argument that specifies the directory in which to save an extra copy of the :file:`xtrabackup_checkpoints` file. It is passed directly to |xtrabackup|'s :option:`--extra-lsndir` option. See the :program:`xtrabackup` documentation for details. |
426 | 116 | 117 | ||
427 | 117 | .. option:: --remote-host | 118 | .. option:: --remote-host |
428 | 118 | 119 | ||
429 | 119 | 120 | ||
430 | === modified file 'doc/source/innobackupex/preparing_a_backup_ibk.rst' | |||
431 | --- doc/source/innobackupex/preparing_a_backup_ibk.rst 2011-07-07 05:32:50 +0000 | |||
432 | +++ doc/source/innobackupex/preparing_a_backup_ibk.rst 2012-01-17 09:06:25 +0000 | |||
433 | @@ -19,7 +19,7 @@ | |||
434 | 19 | ============== | 19 | ============== |
435 | 20 | reading the configuration from the files in the backup directory, | 20 | reading the configuration from the files in the backup directory, |
436 | 21 | 21 | ||
438 | 22 | |innobackupex| replayed the committed transactions in the logfiles (some transactions could have been done while the backup was being done) and rolled back the uncommitted ones. Once this is done, all the information lay in the tablespace (the InnoDB files), and the logfiles are re-created. | 22 | |innobackupex| replayed the committed transactions in the log files (some transactions could have been done while the backup was being done) and rolled back the uncommitted ones. Once this is done, all the information lay in the tablespace (the InnoDB files), and the log files are re-created. |
439 | 23 | 23 | ||
440 | 24 | This implied calling :program:`xtrabackup --prepare` twice with the right binary (determined through the :file:`xtrabackup_binary` or by connecting the server). More details of this process are shown in the :doc:`xtrabackup section <../xtrabackup_bin/preparing_the_backup>`. | 24 | This implied calling :program:`xtrabackup --prepare` twice with the right binary (determined through the :file:`xtrabackup_binary` or by connecting the server). More details of this process are shown in the :doc:`xtrabackup section <../xtrabackup_bin/preparing_the_backup>`. |
441 | 25 | 25 | ||
442 | 26 | 26 | ||
443 | === modified file 'doc/source/xtrabackup_bin/preparing_the_backup.rst' | |||
444 | --- doc/source/xtrabackup_bin/preparing_the_backup.rst 2012-01-03 10:14:48 +0000 | |||
445 | +++ doc/source/xtrabackup_bin/preparing_the_backup.rst 2012-01-17 09:06:25 +0000 | |||
446 | @@ -36,6 +36,7 @@ | |||
447 | 36 | All following prepares (third and following) will not change the already prepared data files, you can only see that output says | 36 | All following prepares (third and following) will not change the already prepared data files, you can only see that output says |
448 | 37 | 37 | ||
449 | 38 | .. code-block:: console | 38 | .. code-block:: console |
450 | 39 | |||
451 | 39 | xtrabackup: This target seems to be already prepared. | 40 | xtrabackup: This target seems to be already prepared. |
452 | 40 | xtrabackup: notice: xtrabackup_logfile was already used to '--prepare'. | 41 | xtrabackup: notice: xtrabackup_logfile was already used to '--prepare'. |
453 | 41 | 42 |
Hrvoje,
The changes look generally good to me. I just had a number of minor comments/questions:
1. |Percona Toolkit| is defined as a macro for ":term:`Percona Toolkit`", but is not actually used anywhere?
There's also an inconsistency. |XtraBackup| and |Percona Server| are defined as just emphasized text rather than terms. Shouldn't |Percona Toolkit| be defined in the same way?
2. s/reffer/refer/g ?
3. Please keep "innobackupex" in examples and not replace it with "innobackupex- 1.5.1", as the latter is an old name, it's currently just a symlink to innobackupex.
4. Any specific reasons for removing streaming backups from the replication setup guidelines? It's not like it's wrong, I'm just curious.
5. I'm not sure "mv /path/to/ mysql/TIMESTAMP /path/to/ mysql/datadir" will do the right thing. I think it will move all files to a subdirectory of datadir, which is not what we really want to do?
6. Shouldn't we make it clear somehow that TIMESTAMP in examples should not be typed literally, but replaced with the actual directory name?
7. s/slights variation/slight variations/ ? (I know it's not your text, but might be a good idea to fix spelling once you are touching that line)
8. s/previuos/ previous/
9. Please don't reuse branches for different MPs. As a result, this MP now contains fixes for both bug #878457 and bug #914422. Which makes it harder to manage and review.