Name: matiri
Owner: Biological Informatics CoE @ Agriculture and Agri-Food Canada
Owner: Biological Informatics CoE @ Agriculture and Agri-Food Canada
Description: Concurrent mysql backup script with metadata in Sqlite3;
Created: 2013-11-23 20:59:47.0
Updated: 2018-03-19 17:32:01.0
Pushed: 2018-03-19 17:32:19.0
Size: 51
Language: Shell
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Features:
matiri invokes a script called mysql.sh
(must be in same directory as matiri script) to obtain MySQL server host, port number, user, password, and databases to include/exclude.
A default implementation is supplied but should be modified to be more secure. For obvious security reasons, this file should be in mode 700.
Note that only include or exclude are allowed, but not both.
mysql.sh
script to include one or more host, port, user, password, and included or excluded databasesmatiri_options
to modify backup destinations, concurrency, naming conventions`All backup files are grouped by year and month, which can be modified within matiri_options
`$BASE_DESTINATION_DIR/YYYY/MM`
Four files are produced:
mysql_backup_YYYY-MM-DD_ID.tar
mysql_backup_YYYY-MM-DD_ID.tar.sha256
mysql_backup_YYYY-MM-DD_ID.meta
mysql_backup_YYYY-MM-DD_ID.err
The above (#1) tar
file is made up of:
For each database being backed up, two files are produced:
Default sqlite location: $BASE_DESTINATION_DIR/backups.sqlite3.db
'backup_event'
table is created for each defined server (multiple MySQL servers = multiple backup events).'completed'
column set to -999
(not completed)backup_event
id
as the forign key 'backup_id'
. The 'completed' column set to -999
(not completed).'completed'
column set to 0
(completed), the end_time is set, the size ('bytes'
) and the SHA256 of the backup file are recorded.Database schema:
CREATE TABLE backup_event (id INTEGER PRIMARY KEY, completed int NOT NULL, comments text,
host varchar(255) NOT NULL, port int NOT NULL,
start_time DATETIME not null, end_time DATETIME not null,
user varchar(64), bytes bigint NOT NULL, file text, sha256 char(64) NOT NULL,
error default NULL);
CREATE TABLE database (id INTEGER PRIMARY KEY, completed int NOT NULL, backup_id INTEGER,
database varchar(255) NOT NULL, file text,
start_time DATETIME not null, end_time DATETIME not null,
bytes bigint NOT NULL, sha256 char(64) NOT NULL,
error default NULL, FOREIGN KEY(backup_id) REFERENCES backup(id));
CREATE INDEX backup_start_time on backup(start_time);
CREATE INDEX database_start_time on database(start_time);
Using the Sqlite3 command line tool
te> select * from backup_event;
ompleted|comments|host|port|start_time|end_time|user|bytes|file|sha256|error
||localhost|3306|2013-11-23 17:23:15|2013-11-23 17:23:15|backups|20480|/home/newtong/backups/2013/11/mysql_backup_2013-11-23_12.tar|6f216d2a4811382b66b25480328b385bab54e7531f73bf2aa5262b00b030017c|
||localhost|3306|2013-11-23 17:23:26|2013-11-23 17:23:27|backups|20480|/home/newtong/backups/2013/11/mysql_backup_2013-11-23_13.tar|da5721440c8577a3b250232ba2e901350ea9a34876212312a5b9a28206ae6d33|
||localhost|3306|2013-11-23 17:23:50|2013-11-23 17:23:51|backups|20480|/home/newtong/backups/2013/11/mysql_backup_2013-11-23_14.tar|f2a9b41e4157da803d79cf385db17dad1d273e48b352eba2cd0209eaf90fa2e9|
||localhost|3306|2013-11-23 17:24:08|2013-11-23 17:24:15|backups|29399040|/home/newtong/backups/2013/11/mysql_backup_2013-11-23_15.tar|8ef6dbdb3537361e48bce1d3eeb3c114d25ebf8d7eb808312384035221f20e32|
te> select * from database where backup_id = 15;
ompleted|backup_id|database|file|start_time|end_time|bytes|sha256|error
|15|performance_schema|database__performance_schema.gz|2013-11-23 17:24:09|2013-11-23 17:24:15|1100|2e7ea55832e3fbb62ee1370a1f0b6ffef2415aba79a129b419181195588b6c27|
|15|information_schema|database__information_schema.gz|2013-11-23 17:24:09|2013-11-23 17:24:15|395504|694688b16377916f31f9dbe2a8647928a6cbb4cd5419767b3335c5ca7e5e5f37|
|15|mysql|database__mysql.gz|2013-11-23 17:24:09|2013-11-23 17:24:15|142109|a72789bedfdcc73ea419750fd4904fd1c859e175f23be208b58d1c262e45eae5|
|15|specify_dao_live|database__specify_dao_live.gz|2013-11-23 17:24:09|2013-11-23 17:24:15|28842782|1d91517672bae1ae39294d3e4f819e79eb6d0c4325d9c30d2d78303c34e189cd|
te>
Named after the Matiri River, New Zealand. I have been very close on several occasions but never have seen the river.
Partially developed at Agriculture and Agri-Food Canada, Ottawa, Ontario.
Features:
matiri invokes a script called mysql.sh
(must be in same directory as matiri script) to obtain MySQL server host, port number, user, password, and databases to include/exclude.
A default implementation is supplied but should be modified to be more secure. For obvious security reasons, this file should be in mode 700.
Note that only include or exclude are allowed, but not both.
mysql.sh
script to include one or more host, port, user, password, and included or excluded databasesmatiri_options
to modify backup destinations, concurrency, naming conventions`All backup files are grouped by year and month, which can be modified within matiri_options
`$BASE_DESTINATION_DIR/YYYY/MM`
Four files are produced:
mysql_backup_YYYY-MM-DD_ID.tar
mysql_backup_YYYY-MM-DD_ID.tar.sha256
mysql_backup_YYYY-MM-DD_ID.meta
mysql_backup_YYYY-MM-DD_ID.err
The above (#1) tar
file is made up of:
For each database being backed up, two files are produced:
Default sqlite location: $BASE_DESTINATION_DIR/backups.sqlite3.db
'backup_event'
table is created for each defined server (multiple MySQL servers = multiple backup events).'completed'
column set to -999
(not completed)backup_event
id
as the forign key 'backup_id'
. The 'completed' column set to -999
(not completed).'completed'
column set to 0
(completed), the end_time is set, the size ('bytes'
) and the SHA256 of the backup file are recorded.Database schema:
CREATE TABLE backup_event (id INTEGER PRIMARY KEY, completed int NOT NULL, comments text,
host varchar(255) NOT NULL, port int NOT NULL,
start_time DATETIME not null, end_time DATETIME not null,
user varchar(64), bytes bigint NOT NULL, file text, sha256 char(64) NOT NULL,
error default NULL);
CREATE TABLE database (id INTEGER PRIMARY KEY, completed int NOT NULL, backup_id INTEGER,
database varchar(255) NOT NULL, file text,
start_time DATETIME not null, end_time DATETIME not null,
bytes bigint NOT NULL, sha256 char(64) NOT NULL,
error default NULL, FOREIGN KEY(backup_id) REFERENCES backup(id));
CREATE INDEX backup_start_time on backup(start_time);
CREATE INDEX database_start_time on database(start_time);
Using the Sqlite3 command line tool
te> select * from backup_event;
ompleted|comments|host|port|start_time|end_time|user|bytes|file|sha256|error
||localhost|3306|2013-11-23 17:23:15|2013-11-23 17:23:15|backups|20480|/home/newtong/backups/2013/11/mysql_backup_2013-11-23_12.tar|6f216d2a4811382b66b25480328b385bab54e7531f73bf2aa5262b00b030017c|
||localhost|3306|2013-11-23 17:23:26|2013-11-23 17:23:27|backups|20480|/home/newtong/backups/2013/11/mysql_backup_2013-11-23_13.tar|da5721440c8577a3b250232ba2e901350ea9a34876212312a5b9a28206ae6d33|
||localhost|3306|2013-11-23 17:23:50|2013-11-23 17:23:51|backups|20480|/home/newtong/backups/2013/11/mysql_backup_2013-11-23_14.tar|f2a9b41e4157da803d79cf385db17dad1d273e48b352eba2cd0209eaf90fa2e9|
||localhost|3306|2013-11-23 17:24:08|2013-11-23 17:24:15|backups|29399040|/home/newtong/backups/2013/11/mysql_backup_2013-11-23_15.tar|8ef6dbdb3537361e48bce1d3eeb3c114d25ebf8d7eb808312384035221f20e32|
te> select * from database where backup_id = 15;
ompleted|backup_id|database|file|start_time|end_time|bytes|sha256|error
|15|performance_schema|database__performance_schema.gz|2013-11-23 17:24:09|2013-11-23 17:24:15|1100|2e7ea55832e3fbb62ee1370a1f0b6ffef2415aba79a129b419181195588b6c27|
|15|information_schema|database__information_schema.gz|2013-11-23 17:24:09|2013-11-23 17:24:15|395504|694688b16377916f31f9dbe2a8647928a6cbb4cd5419767b3335c5ca7e5e5f37|
|15|mysql|database__mysql.gz|2013-11-23 17:24:09|2013-11-23 17:24:15|142109|a72789bedfdcc73ea419750fd4904fd1c859e175f23be208b58d1c262e45eae5|
|15|specify_dao_live|database__specify_dao_live.gz|2013-11-23 17:24:09|2013-11-23 17:24:15|28842782|1d91517672bae1ae39294d3e4f819e79eb6d0c4325d9c30d2d78303c34e189cd|
te>
Named after the Matiri River, New Zealand. I have been very close on several occasions but never have seen the river.
Partially developed at Agriculture and Agri-Food Canada, Ottawa, Ontario.