@Override public int run(CommandLine cl) throws IOException { String[] args = cl.getArgs(); String dir; if (args.length < 1) { dir = null; } else { dir = args[0]; } boolean local = cl.hasOption(LOCAL_OPTION.getLongOpt()); BackupResponse resp = mMetaClient.backup(dir, local); if (local) { mPrintStream.printf("Successfully backed up journal to %s on master %s%n", resp.getBackupUri(), resp.getHostname()); } else { mPrintStream.printf("Successfully backed up journal to %s%n", resp.getBackupUri()); } return 0; }
/** * The daily backup task. */ private void dailyBackup() { try { BackupResponse resp = mMetaMaster.backup(new BackupOptions(mBackupDir, mIsLocal)); if (mIsLocal) { LOG.info("Successfully backed up journal to {} on master {}", resp.getBackupUri(), resp.getHostname()); } else { LOG.info("Successfully backed up journal to {}", resp.getBackupUri()); } } catch (Throwable t) { LOG.error("Failed to execute daily backup at {}", mBackupDir, t); return; } try { deleteStaleBackups(); } catch (Throwable t) { LOG.error("Failed to delete outdated backup files at {}", mBackupDir, t); } }
.getBackupUri(); FileUtils.moveFile(new File(backup.getPath()), backupDst); cluster.stopMasters();