~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to docs/clients/drizzledump.rst

  • Committer: Monty Taylor
  • Date: 2010-09-28 17:45:19 UTC
  • mfrom: (1799.1.6 build)
  • Revision ID: mordred@inaugust.com-20100928174519-y6ie2f3wa4t6o669
Rollup patch with several bugfixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
The :program:`drizzledump` command line tool is used for backing up and
5
5
restoring logical backups of a Drizzle database, as well as for migrating
6
 
from *MySQL*.
 
6
from *MySQL*.  It is called like this::
 
7
 
 
8
     $ drizzledump [OPTIONS] database [tables]
 
9
     $ drizzledump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]
 
10
     $ drizzledump [OPTIONS] --all-databases [OPTIONS]
 
11
 
 
12
When connecting to a Drizzle server it will do a plain dump of the server.  It
 
13
will, however, automatically detect when it is connected to a *MySQL* server and
 
14
will convert the tables and data into a Drizzle compatible format.
 
15
 
 
16
Any binary data in tables will be converted into hexadecimal output so that it
 
17
does not corrupt the dump file.
 
18
 
 
19
Drizzledump options
 
20
-------------------
 
21
 
 
22
The :program:`drizzledump` tool has several available options:
 
23
 
 
24
.. option:: -A, --all-databases
 
25
   
 
26
   Dumps all databases found on the server apart from *information_schema* and
 
27
   *data_dictionary* in Drizzle and *information_schema*, *performance_schema*
 
28
   and *mysql* in MySQL.
 
29
 
 
30
.. option:: -c, --complete-insert
 
31
 
 
32
   Dumps using complete insert statements. *CURRENTLY BROKEN*
 
33
 
 
34
.. option:: -C, --compress
 
35
 
 
36
   Use client/server compression protocol.
 
37
 
 
38
.. option:: -F, --flush-logs
 
39
 
 
40
   Flush the server logs before commencing with the dump. *CURRENTLY_BROKEN*
 
41
 
 
42
.. option:: -f, --force
 
43
 
 
44
   Continue even if we get an sql-error. *CURRENTLY_BROKEN*
 
45
 
 
46
.. option:: -?, --help
 
47
 
 
48
   Show a message with all the available options.
 
49
 
 
50
.. option:: -x, --lock-all-tables
 
51
 
 
52
   Locks all the tables for all databases with a global read lock.  The lock is
 
53
   released automatically when :program:`drizzledump` ends.
 
54
   Turns on :option:`--single-transaction` and :option:`--lock-tables`.
 
55
 
 
56
.. option:: --single-transaction
 
57
 
 
58
   Creates a consistent snapshot by dumping the tables in a single transaction.
 
59
   During the snapshot no other connected client should use any of the
 
60
   following as this will implicitly commit the transaction and prevent the
 
61
   consistency::
 
62
 
 
63
      ALTER TABLE
 
64
      DROP TABLE
 
65
      RENAME TABLE
 
66
      TRUNCATE TABLE
 
67
 
 
68
   Only works with InnoDB.  Automatically disables :option:`--lock-tables`.
 
69
 
 
70
.. option:: --disable-opt
 
71
 
 
72
   A shortcut for :option:`--skip-drop-table`, :option:`--skip-locks`,
 
73
   :option:`--skip-create`, :option:`--slow`, :option:`--skip-extended-insert`
 
74
   and :option:`--skip-disable-keys`
 
75
 
 
76
.. option:: --tables t1 t2 ...
 
77
 
 
78
   Dump a list of tables.
 
79
 
 
80
.. option:: --show-progress-size rows (=10000)
 
81
 
 
82
   Show progress of the dump every *rows* of the dump.  Requires
 
83
   :option:`--verbose`
 
84
 
 
85
.. option:: -v, --verbose
 
86
 
 
87
   Sends various verbose information to stderr as the dump progresses.
 
88
 
 
89
.. option:: --skip-create
 
90
 
 
91
   Do not dump the CREATE TABLE / CREATE DATABASE statements.
 
92
 
 
93
.. option:: --skip-extended-insert
 
94
 
 
95
   Dump every row on an individual line.  For example::
 
96
 
 
97
     INSERT INTO `t1` VALUES (1,'hello');
 
98
     INSERT INTO `t1` VALUES (2,'world');
 
99
 
 
100
.. option:: --skip-dump-date
 
101
 
 
102
   Do not display the date/time at the end of the dump.
 
103
 
 
104
.. option:: --no-defaults
 
105
 
 
106
   Do not attempt to read configuration from configuration files.
 
107
 
 
108
.. option:: --add-drop-database
 
109
 
 
110
   Add `DROP DATABASE` statements before `CREATE DATABASE`.
 
111
 
 
112
.. option:: --compact
 
113
 
 
114
   Gives a more compact output by disabling header/footer comments and enabling
 
115
   :option:`--skip-add-drop-table`, :option:`--no-set-names`,
 
116
   :option:`--skip-disable-keys` and :option:`--skip-add-locks`.
 
117
 
 
118
.. option:: -B, --databases
 
119
 
 
120
   Dump several databases.  The databases do not need to follow on after this
 
121
   option, they can be anywhere in the command line.
 
122
 
 
123
.. option:: --insert-ignore
 
124
 
 
125
   Add the `IGNORE` keyword into every `INSERT` statement.
 
126
 
 
127
.. option:: --no-autocommit
 
128
 
 
129
   Make the dump of each table a single transaction by wrapping it in `COMMIT`
 
130
   statements.
 
131
 
 
132
.. option:: -n, --no-create-db
 
133
 
 
134
   Do not output the `CREATE DATABASE` statements when using
 
135
   :option:`--all-databases` or :option:`--databases`.
 
136
 
 
137
.. option:: -d, --no-data
 
138
 
 
139
   Do not dump the data itself, used to dump the schemas only.
 
140
 
 
141
.. option:: --slow
 
142
 
 
143
   Dump directly from database to destination rather than using a query buffer.
 
144
 
 
145
.. option:: --replace
 
146
 
 
147
   Use `REPLACE INTO` statements instead of `INSERT INTO`
 
148
 
 
149
.. option:: --destination-type type (=stdout)
 
150
 
 
151
   Destination of the data.
 
152
 
 
153
   **stdout**
 
154
      The default.  Output to the command line
 
155
 
 
156
   **database**
 
157
      Connect to another database and pipe data to that.
 
158
 
 
159
   .. versionadded:: 2010-09-27
 
160
 
 
161
.. option:: --destination-host hostname (=localhost)
 
162
 
 
163
   The hostname for the destination database.  Requires
 
164
   :option:`--destination-type` `= database`
 
165
 
 
166
   .. versionadded:: 2010-09-27
 
167
 
 
168
.. option:: --destination-port port (=3306)
 
169
 
 
170
   The port number for the destination database.  Requires
 
171
   :option:`--destination-type` `= database`
 
172
 
 
173
  .. versionadded:: 2010-09-27
 
174
 
 
175
.. option:: --destination-user username
 
176
 
 
177
   The username for the destinations database.  Requires
 
178
   :option:`--destination-type` `= database`
 
179
 
 
180
  .. versionadded:: 2010-09-27
 
181
 
 
182
.. option:: --destination-password password
 
183
 
 
184
   The password for the destination database.  Requires
 
185
   :option:`--destination-type` `= database`
 
186
 
 
187
  .. versionadded:: 2010-09-27
 
188
 
 
189
.. option:: --destination-database database
 
190
 
 
191
   The database for the destination database, for use when only dumping a
 
192
   single database.  Requires
 
193
   :option:`--destination-type` `= database`
 
194
 
 
195
  .. versionadded:: 2010-09-27
 
196
 
 
197
.. option:: -h, --host hostname (=localhost)
 
198
 
 
199
   The hostname of the database server.
 
200
 
 
201
.. option:: -u, --user username
 
202
 
 
203
   The username for the database server.
 
204
 
 
205
.. option:: -P, --password password
 
206
 
 
207
   The password for the database server.
 
208
 
 
209
.. option:: -p, --port port (=3306,4427)
 
210
 
 
211
   The port number of the database server.  Defaults to 3306 for MySQL protocol
 
212
   and 4427 for Drizzle protocol.
 
213
 
 
214
.. option:: --protocol protocol (=mysql)
 
215
 
 
216
   The protocol to use when connecting to the database server.  Options are:
 
217
 
 
218
   **mysql**
 
219
      The standard MySQL protocol.
 
220
 
 
221
   **drizzle**
 
222
      The Drizzle protocol.
 
223
 
 
224
Backups using Drizzledump
 
225
-------------------------
 
226
 
 
227
Backups of a database can be made very simply by running the following::
 
228
 
 
229
     $ drizzledump --all-databases > dumpfile.sql
 
230
 
 
231
This can then be re-imported into drizzle at a later date using::
 
232
 
 
233
     $ drizzle < dumpfile.sql
 
234
 
 
235
MySQL Migration using Drizzledump
 
236
---------------------------------
 
237
 
 
238
As of version 2010-09-27 there is the capability to migrate databases from
 
239
MySQL to Drizzle using :program:`drizzledump`.
 
240
 
 
241
:program:`drizzledump` will automatically detect whether it is talking to a
 
242
MySQL or Drizzle database server.  If it is connected to a MySQL server it will
 
243
automatically convert all the structures and data into a Drizzle compatible 
 
244
format.
 
245
 
 
246
So, simply connecting to a MySQL server with :program:`drizzledump` as follows
 
247
will give you a Drizzle compatible output::
 
248
 
 
249
     $ drizzledump --all-databases --host=mysql-host --user=mysql-user --password > dumpfile.sql
 
250
 
 
251
Additionally :program:`drizzledump` can now dump from MySQL and import directly
 
252
into a Drizzle server as follows::
 
253
 
 
254
     $ drizzledump --all-databases --host=mysql-host --user=mysql-user --password --destination-type=database --desination-host=drizzle-host