-
Notifications
You must be signed in to change notification settings - Fork 2
/
README
82 lines (60 loc) · 2.5 KB
/
README
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
= Temporary Mysql Snapshots
== User Commands:
Usage temporary.mysql.main list|list-snaps
Usage temporary.mysql.main list-all|list-all-snapshots
Usage temporary.mysql.main create|remove|restart <snapshot name>
Usage temporary.mysql.main create|remove|restart <snapshot name> <lvm instance>
Usage temporary.mysql.main create <snapshot name> <dump file> <db name>
== Example usage
bb3:~/bin# temporary.mysql list-snaps
Using default group
=== Instances for user andrew: ===
bb3:~/bin# time temporary.mysql create test
bb3:~/bin# time temporary.mysql create test example
=== Creating snapshot 'test' for andrew: ===
Performing pre-creation checks...
(OK)
Flushing master tables with read lock (Done)
Creating LVM snapshot of master (Done)
Mounting snapshot '/dev/database/temporary.andrew.example.test' at /mnt/mysql/andrew.database.example.test (Done)
Starting MySQL on port 3314 (Done)
=== Created snapshot 'test' for andrew on port 3314 ===
real 0m8.355s
user 0m0.144s
sys 0m0.160s
bb3:~/bin# temporary.mysql list
Using default group
=== Instances for user andrew: ===
--- Instance 'example.test'
* datadir=/mnt/mysql/andrew.database.example.test/data/
* port=3314
bb3:~/bin# temporary.mysql list-snaps
Using default group
=== Instances for user andrew: ===
--- Active snapshot - example.test
* Mapper path: /dev/database/temporary.andrew.example.test
* Mount directory: /mnt/mysql/andrew.example.test
* COW usage: 0.00%
* MySQLd status: ---
|-- datadir: /mnt/mysql/andrew.example.test/
|-- socket: /mnt/mysql/andrew.example.test/socket
|-- PID: 4534
|-- port: 3314
=== Create mysql instance from snapshot of live production data (subject to replication lag)
temporary.mysql create <instance-name>
temporary.mysql create <instance-name> <lvm-group>
=== Create mysql instance from single mysqldump file
- ''dump-files should be placed in /usr/local/share/temporary.mysql/ although absolute and relative paths are valid''
- ''database is required as mysqldump does not include a 'CREATE DATABASE' statement when dumping tables''
temporary.mysql create <instance-name> <dump-file-name> <database>
== List mysql instances for current user
temporary.mysql list
=== List mysql snapshot instances for current user
temporary.mysql list-snaps
==== Remove mysql instance
temporary.mysql remove <instance-name>
=== Admin Commands
==== List all mysql instances
temporary.mysql list-all
==== List all mysql snapshot instances
temporary.mysql list-all-snapshots