@@ -23,60 +23,64 @@ go-dump uses the [MVCC](https://en.wikipedia.org/wiki/Multiversion_concurrency_c
2323The parameters and options are listed here:
2424
2525```
26- # go-dump --help
27- -add-drop-table
28- Add drop table before create table.
29- -all-databases
30- Dump all the databases.
31- -channel-buffer-size int
32- Task channel buffer size (default 1000)
33- -chunk-size int
34- Chunk size to get the rows (default 1000)
35- -databases string
36- List of comma separated databases to dump
37- -debug
38- Display debug information.
39- -destination string
40- Directory to store the dumps
41- -dry-run
42- Just calculate the number of chaunks per table and display it.
43- -execute
44- Execute the dump.
45- -help
46- Display this message
47- -host string
48- MySQL hostname (default "localhost")
49- -lock-tables
50- Lock tables to get consistent backup (default true)
51- -master-data
52- Get the master data. (default true)
53- -mysql-user string
54- MySQL user name
55- -output-chunk-size int
56- Chunk size to output the rows
57- -password string
58- MySQL password
59- -port int
60- MySQL port number (default 3306)
61- -skip-use-database
62- Skip USE "database" in the dump.
63- -socket string
64- MySQL socket file
65- -tables string
66- List of comma separated tables to dump.
67- Each table should have the database name included, for example "mydb.mytable,mydb2.mytable2"
68- -tables-without-uniquekey string
69- Action to have with tables without any primary or unique key.
70- Valid actions are: 'error', 'skip', 'single-chunk'. (default "error")
71- -threads int
72- Number of threads to use (default 1)
73- -version
74- Display version and exit
26+ Usage: go-dump --destination path [--databases str] [--tables str] [--all-databases] [--dry-run | --execute ] [--help] [--debug] [--version] [--lock-tables] [--channel-buffer-size num] [--chunk-size num] [--tables-without-uniquekey str] [--threads num] [--mysql-user str] [--mysql-password str] [--mysql-host str] [--mysql-port num] [--mysql-socket path] [--add-drop-table] [--master-data] [--output-chunk-size num] [--skip-use-database]
27+
28+ go-dump dumps a database or a table from a MySQL server and creates the SQL statements to recreate a table. This tool create one file per table per thread in the destination directory
29+
30+ Example: go-dump --destination /tmp/dbdump --databases mydb --mysql-user myuser --mysql-password password
31+
32+ Options description
33+
34+ # General:
35+ --help Display this message. Default [false]
36+ --dry-run Just calculate the number of chaunks per table and display it. Default [false]
37+ --execute Execute the dump. Default [false]
38+ --debug Display debug information. Default [false]
39+ --version Display version and exit. Default [false]
40+ --lock-tables Lock tables to get consistent backup. Default [true]
41+ --channel-buffer-size Task channel buffer size. Default [1000]
42+ --chunk-size Chunk size to get the rows. Default [1000]
43+ --tables-without-uniquekey Action to have with tables without any primary or unique key. Valid actions are: 'error', 'single-chunk'. Default [error]
44+ --threads Number of threads to use. Default [1]
45+
46+ # MySQL options:
47+ --mysql-user MySQL user name. Default [root]
48+ --mysql-password MySQL password.
49+ --mysql-host MySQL hostname. Default [localhost]
50+ --mysql-port MySQL port number Default [3306]
51+ --mysql-socket MySQL socket file.
52+
53+ # Databases or tables to dump:
54+ --all-databases Dump all the databases. Default [false]
55+ --databases List of comma separated databases to dump.
56+ --tables List of comma separated tables to dump. Each table should have the database name included,for example "mydb.mytable,mydb2.mytable2".
57+
58+ # Output options:
59+ --destination Directory to store the dumps.
60+ --add-drop-table Add drop table before create table. Default [false]
61+ --master-data Get the master data. Default [true]
62+ --output-chunk-size Chunk size to output the rows. Default [0]
63+ --skip-use-database Skip USE "database" in the dump. Default [false]
7564```
7665
7766## Examples
7867
79- ``` go-dump --threads 8 --chunk-size 50000 --output-chunk-size 1000 --channel-buffer-size 2000 --tables-without-uniquekey "single-chunk" --add-drop-table --databases "test" --mysql-user root --destination /tmp/testbackup --execute --skip-use-database ```
68+ ```
69+ go-dump --threads 8 --chunk-size 50000 --output-chunk-size 1000 --channel-buffer-size 2000 --tables-without-uniquekey "single-chunk" --add-drop-table --databases "test" --mysql-user root --destination /tmp/testbackup --execute --skip-use-database
70+
71+ 2018-04-08 01:40:44 INFO Locking tables to get a consistent backup.
72+ 2018-04-08 01:40:44 INFO Getting Master Status
73+ 2018-04-08 01:40:44 INFO Cols [File Position Binlog_Do_DB Binlog_Ignore_DB Executed_Gtid_Set]
74+ 2018-04-08 01:40:44 INFO Master File: binlog.000008
75+ Master Position: 154
76+ 2018-04-08 01:40:44 INFO Unlocking the tables. Tables were locked for 5.197763ms
77+ 2018-04-08 01:40:44 INFO Starting 8 workers
78+ 2018-04-08 01:40:46 INFO Status. Queue: 0 of 80
79+ 2018-04-08 01:40:49 INFO Status. Queue: 50 of 120
80+ 2018-04-08 01:40:54 INFO Status. Queue: 10 of 120
81+ 2018-04-08 01:41:00 INFO Waiting for the creation of all the chunks.
82+ 2018-04-08 01:41:00 INFO Execution time: 15.498141583s
83+ ```
8084
8185Explanation of this command:
8286
0 commit comments