Not the answer you need?
Register and ask your own question!

mongodb-consistent-backup

rdab100rdab100 ContributorCurrent User Role Patron
Bit confused how to differentiate/use the backups.... env... 3 data nodes, 3 config one mongos... the data nodes on 27018,27019, 27020 the mongos 27017, config 27021,27022,27023.

The different backups output...
Using the MONGOS port 27017 connection:
[email protected] ~/Documents/mongodb/Percona_backup/mongodb_consistent_backup/bin $ ./mongodb-consistent-backup -H localhost -P 27017 -n testcluster -l /home/mongo/mongobackups
[2016-08-25 11:46:12,907] [INFO] [MainProcess] [Backup:run:167] Starting mongodb-consistent-backup version 0.2.1 (git commit hash: 669c7dbcf57161cfe1f94a9cf3f50249ad292832)
[2016-08-25 11:46:12,907] [INFO] [MainProcess] [Backup:run:199] Running backup of localhost:27017 in sharded mode
[2016-08-25 11:46:12,910] [INFO] [MainProcess] [ShardingHandler:get_start_state:32] Began with balancer state: True
[2016-08-25 11:46:12,910] [INFO] [MainProcess] [ShardingHandler:stop_balancer:80] Stopping the balancer and waiting a max of 300 sec
[2016-08-25 11:46:22,921] [INFO] [MainProcess] [ShardingHandler:stop_balancer:90] Balancer is now stopped
[2016-08-25 11:46:23,033] [INFO] [OplogTail-1] [Tail:run:66] Tailing oplog on 127.0.0.1:27019 for changes
[2016-08-25 11:46:23,052] [INFO] [MainProcess] [Mongodumper:run:112] Starting backups in threads using mongodump r3.2.9 (inline gzip: True)
[2016-08-25 11:46:23,054] [INFO] [Mongodump-2] [Mongodump:run:49] Starting mongodump (with oplog) backup of rs0/127.0.0.1:27019
[2016-08-25 11:46:23,056] [INFO] [Mongodump-3] [Mongodump:run:49] Starting mongodump (with oplog) backup of config/127.0.0.1:27021
[2016-08-25 11:46:23,175] [INFO] [Mongodump-2] [Mongodump:run:90] Backup for rs0/127.0.0.1:27019 completed in 0.123189926147 sec with 0 oplog changes captured to: None
[2016-08-25 11:46:23,193] [INFO] [Mongodump-3] [Mongodump:run:90] Backup for config/127.0.0.1:27021 completed in 0.141259908676 sec with 0 oplog changes captured to: None
[2016-08-25 11:46:26,198] [INFO] [MainProcess] [Mongodumper:run:137] All mongodump backups completed
[2016-08-25 11:46:26,198] [INFO] [MainProcess] [Tailer:stop:55] Stopping oplog tailing threads
[2016-08-25 11:46:27,041] [INFO] [OplogTail-1] [Tail:run:119] Done tailing oplog on 127.0.0.1:27019, 0 changes captured to: None
[2016-08-25 11:46:27,198] [INFO] [MainProcess] [Tailer:stop:61] Stopped all oplog threads
[2016-08-25 11:46:27,199] [INFO] [MainProcess] [ShardingHandler:restore_balancer_state:73] Restoring balancer state to: True
[2016-08-25 11:46:27,208] [INFO] [MainProcess] [Resolver:run:51] Resolving oplogs using 8 threads max
[2016-08-25 11:46:27,208] [INFO] [MainProcess] [Resolver:run:63] No oplog changes to resolve for 127.0.0.1:27019
[2016-08-25 11:46:27,208] [INFO] [MainProcess] [Resolver:run:83] No tailed oplog for host 127.0.0.1:27021
[2016-08-25 11:46:27,311] [INFO] [MainProcess] [Resolver:run:95] Done resolving oplogs
[2016-08-25 11:46:27,314] [INFO] [MainProcess] [Archiver:run:86] Archiving backup directories with 4 threads max
[2016-08-25 11:46:27,315] [INFO] [PoolWorker-12] [Archiver:run:55] Archiving directory: /home/mongo/mongobackups/testcluster/20160825_1146/rs0
[2016-08-25 11:46:27,315] [INFO] [PoolWorker-13] [Archiver:run:55] Archiving directory: /home/mongo/mongobackups/testcluster/20160825_1146/config
[2016-08-25 11:46:27,516] [INFO] [MainProcess] [Archiver:run:102] Archiver threads completed
[2016-08-25 11:46:27,516] [INFO] [MainProcess] [Backup:run:317] Backup completed in 14.6180999279 sec
Using the MONGOD port 27018
[email protected] ~/Documents/mongodb/Percona_backup/mongodb_consistent_backup/bin $ ./mongodb-consistent-backup -H localhost -P 27018 -n testcluster -l /home/mongo/mongobackups
[2016-08-25 14:14:51,778] [INFO] [MainProcess] [Backup:run:167] Starting mongodb-consistent-backup version 0.2.1 (git commit hash: 669c7dbcf57161cfe1f94a9cf3f50249ad292832)
[2016-08-25 14:14:51,778] [INFO] [MainProcess] [Backup:run:176] Running backup of localhost:27018 in replset mode
[2016-08-25 14:14:51,798] [INFO] [MainProcess] [Mongodumper:run:53] Found replset rs0, using secondary instance 127.0.0.1:27019 for backup
[2016-08-25 14:14:51,799] [INFO] [MainProcess] [Mongodumper:run:112] Starting backups in threads using mongodump r3.2.9 (inline gzip: True)
[2016-08-25 14:14:51,800] [INFO] [Process-2] [Mongodump:run:49] Starting mongodump (with oplog) backup of rs0/127.0.0.1:27019
[2016-08-25 14:14:52,013] [INFO] [Process-2] [Mongodump:run:90] Backup for rs0/127.0.0.1:27019 completed in 0.213969945908 sec with 0 oplog changes captured to: None
[2016-08-25 14:14:55,016] [INFO] [MainProcess] [Mongodumper:run:137] All mongodump backups completed
[2016-08-25 14:14:55,019] [INFO] [MainProcess] [Archiver:run:86] Archiving backup directories with 1 threads max
[2016-08-25 14:14:55,020] [INFO] [PoolWorker-3] [Archiver:run:55] Archiving directory: /home/mongo/mongobackups/testcluster/20160825_1414/rs0
[2016-08-25 14:14:55,220] [INFO] [MainProcess] [Archiver:run:102] Archiver threads completed
[2016-08-25 14:14:55,220] [INFO] [MainProcess] [Backup:run:317] Backup completed in 3.45086193085 sec
Using a config server connection port
[email protected] ~/Documents/mongodb/Percona_backup/mongodb_consistent_backup/bin $ ./mongodb-consistent-backup -H localhost -P 27021 -n testcluster -l /home/mongo/mongobackups
[2016-08-25 15:39:47,922] [INFO] [MainProcess] [Backup:run:167] Starting mongodb-consistent-backup version 0.2.1 (git commit hash: 669c7dbcf57161cfe1f94a9cf3f50249ad292832)
[2016-08-25 15:39:47,923] [INFO] [MainProcess] [Backup:run:176] Running backup of localhost:27021 in replset mode
[2016-08-25 15:39:47,937] [INFO] [MainProcess] [Mongodumper:run:53] Found replset ConfigSvr, using secondary instance 127.0.0.1:27022 for backup
[2016-08-25 15:39:47,937] [INFO] [MainProcess] [Mongodumper:run:112] Starting backups in threads using mongodump r3.2.9 (inline gzip: True)
[2016-08-25 15:39:47,938] [INFO] [Process-2] [Mongodump:run:49] Starting mongodump (with oplog) backup of ConfigSvr/127.0.0.1:27022
[2016-08-25 15:39:48,164] [INFO] [Process-2] [Mongodump:run:90] Backup for ConfigSvr/127.0.0.1:27022 completed in 0.227024078369 sec with 0 oplog changes captured to: None
[2016-08-25 15:39:51,168] [INFO] [MainProcess] [Mongodumper:run:137] All mongodump backups completed
[2016-08-25 15:39:51,171] [INFO] [MainProcess] [Archiver:run:86] Archiving backup directories with 1 threads max
[2016-08-25 15:39:51,171] [INFO] [PoolWorker-3] [Archiver:run:55] Archiving directory: /home/mongo/mongobackups/testcluster/20160825_1539/ConfigSvr
[2016-08-25 15:39:51,372] [INFO] [MainProcess] [Archiver:run:102] Archiver threads completed
[2016-08-25 15:39:51,372] [INFO] [MainProcess] [Backup:run:317] Backup completed in 3.45891904831 sec
[email protected] ~/Documents/mongodb/Percona_backup/mongodb_consistent_backup/bin $


The backup files are in the /home/mongo/mongobackups directory.... but the restore notes only mention how to deal with the data.... the script will allow you to backup either through the mongod, mongos or the config port (see above)... but which should you use to obtain a consistent backup of the data on the cluster and how do you restore it?
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.