Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -256,3 +256,6 @@ Contact
~~~~~~~

`Contact Percona <mailto:mongodb-backup@percona.com>`__

Take Bacup OR Instances:
rocket_consistent_backup_wrapper `instaneid`
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.4.2
1.4.3
12 changes: 10 additions & 2 deletions mongodb_consistent_backup/Archive/Tar/TarThread.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
import logging


from mongodb_consistent_backup.Common import LocalCommand
from mongodb_consistent_backup.Pipeline import PoolThread

Expand Down Expand Up @@ -30,18 +31,25 @@ def run(self):
try:
backup_base_dir = os.path.dirname(self.backup_dir)
backup_base_name = os.path.basename(self.backup_dir)
output_file_dir = os.path.dirname(self.output_file)
output_file_basename= os.path.basename(self.output_file)
admin_backup_file = output_file_dir+"/" +"_".join(["admin",output_file_basename])

log_msg = "Archiving directory: %s" % self.backup_dir
cmd_flags = ["-C", backup_base_dir, "-c", "-f", self.output_file, "--remove-files"]
cmd_flags = ["--exclude", "admin" ,"-C", backup_base_dir, "-c", "-f", self.output_file, "--remove-files"]
admin_command_flags = ["-C", self.backup_dir +"/dump/", "-c", "-f", admin_backup_file, "--remove-files"]


if self.do_gzip():
log_msg = "Archiving and compressing directory: %s" % self.backup_dir
cmd_flags.append("-z")
admin_command_flags.append("-z")

cmd_flags.append(backup_base_name)
admin_command_flags.append("admin")
logging.info(log_msg)
self.running = True
self._command = LocalCommand(self.binary, cmd_flags, self.verbose)
self._command = LocalCommand(self.binary, cmd_flags, admin_command_flags, self.verbose)
self.exit_code = self._command.run()
except Exception, e:
return self.result(False, "Failed archiving file: %s!" % self.output_file, e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def mongodump_cmd(self):
logging.info("MongoDump Version higher that 4.2.0 found extending mongodump with snppy compressor flag")
## https://www.mongodb.com/docs/drivers/node/v4.4/fundamentals/connection/network-compression/
mongodump_flags.extend([
"--compressors=%s" % "snappy,zlib,zstd"
"--compressors=%s" % "zstd,snappy,zlib"
])

# --numParallelCollections
Expand Down
12 changes: 10 additions & 2 deletions mongodb_consistent_backup/Common/LocalCommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,14 @@


class LocalCommand:
def __init__(self, command, command_flags=None, verbose=False):
def __init__(self, command, command_flags=None, admin_command_flags=None, verbose=False):
if command_flags is None:
command_flags = []
if admin_command_flags is None:
admin_command_flags = []
self.command = command
self.command_flags = command_flags
self.admin_command_flags = admin_command_flags
self.verbose = verbose

self.output = []
Expand All @@ -21,6 +24,10 @@ def __init__(self, command, command_flags=None, verbose=False):
if len(self.command_flags):
self.command_line.extend(self.command_flags)

self.admin_command_line = [self.command]
if len(self.admin_command_flags):
self.admin_command_line.extend(self.admin_command_flags)

def parse_output(self):
if self._process:
try:
Expand All @@ -36,7 +43,8 @@ def parse_output(self):

def run(self):
try:
self._process = Popen(self.command_line, stdout=PIPE, stderr=PIPE)
cmd = " ".join(self.admin_command_line+ ["&&"]+ self.command_line)
self._process = Popen(cmd, stdout=PIPE, stderr=PIPE,shell= True)
while self._process.poll() is None:
self.parse_output()
sleep(0.1)
Expand Down