mys3ql 0.0.5 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +11 -7
- data/lib/mys3ql/config.rb +4 -0
- data/lib/mys3ql/mysql.rb +1 -1
- data/lib/mys3ql/s3.rb +6 -3
- data/lib/mys3ql/shell.rb +1 -1
- data/lib/mys3ql/version.rb +1 -1
- data/mys3ql.gemspec +1 -1
- metadata +59 -85
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e54e18bc02f3e450ff0b3bbcf538d110740f7656
|
4
|
+
data.tar.gz: d9a68227ab366c3cfae81f56116c723c0ccb4bb4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cec4e35514acad343828bfbd6c726db0a0ca3654ce54906e1cb047d242a68d3b4fb7c47bde63287b8fda3a5fe6a0c01ecec19954f92be10a523ea954fce24261
|
7
|
+
data.tar.gz: e62c4784ea4161dd939f659ffa8f80d765976059149185adbf724d9eb4ffce6e2445296051cba0040d6369f9a24a028d8a0185bd12f66d4d16d259b17ac12d31
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# mys3ql = mysql + s3
|
2
2
|
|
3
|
-
Simple backup of your
|
3
|
+
Simple backup of your MySQL database onto Amazon S3.
|
4
4
|
|
5
5
|
|
6
6
|
## Quick start
|
@@ -19,8 +19,9 @@ To restore from the latest backup (plus binlogs if present):
|
|
19
19
|
|
20
20
|
$ mys3ql restore
|
21
21
|
|
22
|
-
By default mys3ql looks for a configuration file at
|
22
|
+
By default mys3ql looks for a configuration file at `~/.mys3ql`. You can override this like so:
|
23
23
|
|
24
|
+
$ mys3ql [command] -c FILE
|
24
25
|
$ mys3ql [command] --config=FILE
|
25
26
|
|
26
27
|
|
@@ -41,7 +42,7 @@ Second, create your config file:
|
|
41
42
|
# Path (with trailing slash) to mysql commands e.g. mysqldump
|
42
43
|
bin_path: /usr/local/mysql/bin/
|
43
44
|
# If you are using MySql binary logging:
|
44
|
-
# Path to the binary logs, should match the
|
45
|
+
# Path to the binary logs, should match the log_bin option in your my.cnf.
|
45
46
|
# Comment out if you are not using mysql binary logging
|
46
47
|
bin_log: /var/lib/mysql/binlog/mysql-bin
|
47
48
|
|
@@ -51,21 +52,24 @@ Second, create your config file:
|
|
51
52
|
secret_access_key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
52
53
|
# Bucket in which to store your backups
|
53
54
|
bucket: db_backups
|
55
|
+
# AWS region your bucket lives in.
|
56
|
+
# (I suspect you only need to specify this when your 'location' is in a different region.)
|
57
|
+
#region: eu-west-1
|
54
58
|
|
55
59
|
If you only have one database to back up on your server, you can put the config file at `~/.mys3ql`. Otherwise, tell the `mys3ql` command where the config file is with the `--config=FILE` switch.
|
56
60
|
|
57
61
|
## Binary logging
|
58
62
|
|
59
|
-
To use incremental backups you need to enable binary logging by making sure that the MySQL config file (my.cnf) has the following line in it:
|
63
|
+
To use incremental backups you need to enable binary logging by making sure that the MySQL config file (`/etc/my.cnf`) has the following line in it:
|
60
64
|
|
61
65
|
log_bin = /var/db/mysql/binlog/mysql-bin
|
62
66
|
|
63
|
-
The MySQL user needs to have the RELOAD and the SUPER privileges
|
67
|
+
The MySQL user needs to have the RELOAD and the SUPER privileges. These can be granted with the following SQL commands (which need to be executed as the MySQL root user):
|
64
68
|
|
65
69
|
GRANT RELOAD ON *.* TO 'user_name'@'%' IDENTIFIED BY 'password';
|
66
70
|
GRANT SUPER ON *.* TO 'user_name'@'%' IDENTIFIED BY 'password';
|
67
71
|
|
68
|
-
You may need to run mys3ql's incremental backup with special permissions (sudo)
|
72
|
+
You may need to run mys3ql's incremental backup with special permissions (sudo) depending on the ownership of the binlogs directory.
|
69
73
|
|
70
74
|
N.B. the binary logs contain updates to all the databases on the server. This means you can only switch on incremental backups for one database per server, because the logs will be purged each time a database is dumped.
|
71
75
|
|
@@ -79,7 +83,7 @@ Marc-André Cournoyer's [mysql_s3_backup](https://github.com/macournoyer/mysql_s
|
|
79
83
|
|
80
84
|
- tests ;)
|
81
85
|
- remove old dump files (s3)
|
82
|
-
- restore from non-latest dump
|
86
|
+
- (restore from non-latest dump)
|
83
87
|
|
84
88
|
|
85
89
|
## Questions, Problems, Feedback
|
data/lib/mys3ql/config.rb
CHANGED
data/lib/mys3ql/mysql.rb
CHANGED
@@ -14,7 +14,7 @@ module Mys3ql
|
|
14
14
|
|
15
15
|
def dump
|
16
16
|
cmd = "#{@config.bin_path}mysqldump"
|
17
|
-
cmd += ' --quick --single-transaction --create-options'
|
17
|
+
cmd += ' --quick --single-transaction --create-options --no-tablespaces'
|
18
18
|
cmd += ' --flush-logs --master-data=2 --delete-master-logs' if binary_logging?
|
19
19
|
cmd += cli_options
|
20
20
|
cmd += " | gzip > #{dump_file}"
|
data/lib/mys3ql/s3.rb
CHANGED
@@ -23,7 +23,7 @@ module Mys3ql
|
|
23
23
|
def delete_bin_logs
|
24
24
|
each_bin_log do |file|
|
25
25
|
file.destroy
|
26
|
-
log "s3:
|
26
|
+
log "s3: deleted #{file.key}"
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -50,10 +50,12 @@ module Mys3ql
|
|
50
50
|
|
51
51
|
# returns Fog::Storage::AWS::File if we pushed, nil otherwise.
|
52
52
|
def save(local_file_name, s3_key)
|
53
|
+
s3.sync_clock
|
53
54
|
unless bucket.files.head(s3_key)
|
54
55
|
s3_file = bucket.files.create(
|
55
56
|
:key => s3_key,
|
56
57
|
:body => File.open(local_file_name),
|
58
|
+
:storage_class => 'STANDARD_IA',
|
57
59
|
:public => false
|
58
60
|
)
|
59
61
|
log "s3: pushed #{local_file_name} to #{s3_key}"
|
@@ -75,7 +77,8 @@ module Mys3ql
|
|
75
77
|
s = Fog::Storage.new(
|
76
78
|
:provider => 'AWS',
|
77
79
|
:aws_secret_access_key => @config.secret_access_key,
|
78
|
-
:aws_access_key_id => @config.access_key_id
|
80
|
+
:aws_access_key_id => @config.access_key_id,
|
81
|
+
:region => @config.region
|
79
82
|
)
|
80
83
|
log 's3: connected'
|
81
84
|
s
|
@@ -85,7 +88,7 @@ module Mys3ql
|
|
85
88
|
def bucket
|
86
89
|
@directory ||= begin
|
87
90
|
d = s3.directories.get @config.bucket
|
88
|
-
raise "S3 bucket #{@config.bucket} not found" unless d # create bucket instead?
|
91
|
+
raise "S3 bucket #{@config.bucket} not found" unless d # create bucket instead (n.b. region/location)?
|
89
92
|
log "s3: opened bucket #{@config.bucket}"
|
90
93
|
d
|
91
94
|
end
|
data/lib/mys3ql/shell.rb
CHANGED
@@ -5,7 +5,7 @@ module Mys3ql
|
|
5
5
|
def run(command)
|
6
6
|
log command
|
7
7
|
result = `#{command}`
|
8
|
-
log "==> #{result}"
|
8
|
+
log "==> #{result}" unless result.empty?
|
9
9
|
raise ShellCommandError, "error (exit status #{$?.exitstatus}): #{command} ==> #{result}: #{$?}" unless $?.success?
|
10
10
|
result
|
11
11
|
end
|
data/lib/mys3ql/version.rb
CHANGED
data/mys3ql.gemspec
CHANGED
metadata
CHANGED
@@ -1,80 +1,66 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: mys3ql
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 5
|
10
|
-
version: 0.0.5
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.1.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Andy Stewart
|
14
|
-
autorequire:
|
8
|
+
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2020-12-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
22
14
|
name: main
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 31
|
30
|
-
segments:
|
31
|
-
- 4
|
32
|
-
- 8
|
33
|
-
- 0
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
34
19
|
version: 4.8.0
|
35
20
|
type: :runtime
|
36
|
-
requirement: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: fog
|
39
21
|
prerelease: false
|
40
|
-
version_requirements:
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.8.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: fog
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.19.0
|
51
34
|
type: :runtime
|
52
|
-
requirement: *id002
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
name: rake
|
55
35
|
prerelease: false
|
56
|
-
version_requirements:
|
57
|
-
|
58
|
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.19.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
59
45
|
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
|
62
|
-
segments:
|
63
|
-
- 0
|
64
|
-
version: "0"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
65
48
|
type: :development
|
66
|
-
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
67
55
|
description: Simple backup of your MySql database onto Amazon S3.
|
68
|
-
email:
|
56
|
+
email:
|
69
57
|
- boss@airbladesoftware.com
|
70
|
-
executables:
|
58
|
+
executables:
|
71
59
|
- mys3ql
|
72
60
|
extensions: []
|
73
|
-
|
74
61
|
extra_rdoc_files: []
|
75
|
-
|
76
|
-
|
77
|
-
- .gitignore
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
78
64
|
- CHANGELOG.md
|
79
65
|
- Gemfile
|
80
66
|
- README.md
|
@@ -88,39 +74,27 @@ files:
|
|
88
74
|
- lib/mys3ql/shell.rb
|
89
75
|
- lib/mys3ql/version.rb
|
90
76
|
- mys3ql.gemspec
|
91
|
-
has_rdoc: true
|
92
77
|
homepage: https://github.com/airblade/mys3ql
|
93
78
|
licenses: []
|
94
|
-
|
95
|
-
post_install_message:
|
79
|
+
metadata: {}
|
80
|
+
post_install_message:
|
96
81
|
rdoc_options: []
|
97
|
-
|
98
|
-
require_paths:
|
82
|
+
require_paths:
|
99
83
|
- lib
|
100
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
-
|
102
|
-
requirements:
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
103
86
|
- - ">="
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
version: "0"
|
109
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
-
none: false
|
111
|
-
requirements:
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
112
91
|
- - ">="
|
113
|
-
- !ruby/object:Gem::Version
|
114
|
-
|
115
|
-
segments:
|
116
|
-
- 0
|
117
|
-
version: "0"
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
118
94
|
requirements: []
|
119
|
-
|
120
95
|
rubyforge_project: mys3ql
|
121
|
-
rubygems_version:
|
122
|
-
signing_key:
|
123
|
-
specification_version:
|
96
|
+
rubygems_version: 2.5.2.3
|
97
|
+
signing_key:
|
98
|
+
specification_version: 4
|
124
99
|
summary: Simple backup of your MySql database onto Amazon S3.
|
125
100
|
test_files: []
|
126
|
-
|