-
Notifications
You must be signed in to change notification settings - Fork 1
/
mysql.txt
132 lines (98 loc) · 2.62 KB
/
mysql.txt
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
MySql commands
==============
mysql.backup_db
---------------
::
{
"your-own-description": {
"sequence": 1,
"command": "mysql.backup_db",
"params": {
"host": "localhost",
"user": "root",
"password": "root",
"database": "your-database",
"backup_file": "/full/path/to/database/backup/path/file.sql",
"download_tar_to_local_file": "./local/path/db/backup.tar.gz"
}
}
}
Functionality:
- Runs mysqldump and creates a mysql sql that will be compressed to tar.gz.
- The generated sql file will be removed.
- Tries to create the path on remote if it doesn't exist
- If download_tar_to_local_file is given it will download the tar.gz for local backup
mysql.cleanup_db_backups
------------------------
(Gonna be deprecated, this is something we should implement with the backup_db)
::
{
"your-own-description": {
"sequence": 1,
"command": "mysql.cleanup_db_dumps",
"params": {
"path": "/full/path/to/database/backup/path",
"max_backup_history": "5"
}
}
}
Functionality:
- Reads path for \*.tar.gz files... and removes the oldest files. (by filesystem)
- max_backup_history is optional, defaults to 5
mysql.query
-----------
::
{
"your-own-description": {
"sequence": 1,
"command": "mysql.query",
"params": {
"host": "localhost",
"user": "root",
"password": "root",
"query": "CREATE DATABASE IF NOT EXISTS your-db-name"
}
}
}
Functionality:
- Execute a raw query thru the command line
mysql.import_file
-----------------
::
{
"your-own-description": {
"sequence": 3,
"command": "mysql.import_file",
"params": {
"host": "localhost",
"user": "root",
"password": "root",
"database": "your-database",
"import_file": "/full/path/to/repo/.data/install.sql"
}
}
}
Functionality:
- Executes : 'mysql -h %(host)s -u %(user)s --password='%(password)s' %(database)s < %(import_file)s'
- If import_file does not exist it will show a warning and will continue to the next command
mysql.restore_db
----------------
::
{
"your-own-description": {
"sequence": 2,
"command": "mysql.restore_db",
"params": {
"host": "localhost",
"user": "root",
"password": "password",
"database": "your-database",
"backup_path": "/full/path/to/database/backup/path",
"version": "sql-version"
}
}
}
Functionality:
- By default the version is left empty, but you can force this.
- It will list the versions and prompt for a version to restore when params is empty.
- Requires valid backup version