/** * @param pResp proto options * @return wire type options corresponding to the proto options */ public static BackupResponse fromPoto(BackupPResponse pResp) { return new BackupResponse(new AlluxioURI(pResp.getBackupUri()), pResp.getHostname()); }
@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; }
@Override public void backup(BackupPOptions options, StreamObserver<BackupPResponse> responseObserver) { RpcUtils.call(LOG, (RpcUtils.RpcCallableThrowsIOException<BackupPResponse>) () -> { return mMetaMaster.backup(BackupOptions.fromProto(options)).toProto(); }, "backup", "options=%s", responseObserver, options); }
.getBackupUri(); FileUtils.moveFile(new File(backup.getPath()), backupDst); cluster.stopMasters();
@Override public BackupResponse backup(String targetDirectory, boolean localFileSystem) throws IOException { return retryRPC(() -> BackupResponse.fromPoto(mClient.backup(BackupPOptions.newBuilder() .setTargetDirectory(targetDirectory).setLocalFileSystem(localFileSystem).build()))); }
@Override public BackupTResponse backup(BackupTOptions options) throws AlluxioTException { return RpcUtils.call((RpcUtils.RpcCallableThrowsIOException<BackupTResponse>) () -> mMetaMaster .backup(BackupOptions.fromThrift(options)).toThrift()); }
/** * 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); } }
@Before public void before() throws Exception { mRandom = new Random(); mBackupDir = "/tmp/test/alluxio_backups"; mMetaMaster = Mockito.mock(MetaMaster.class); when(mMetaMaster.backup(any())).thenReturn(new BackupResponse(new AlluxioURI( PathUtils.concatPath(mBackupDir, generateBackupFileName())), "localhost")); mUfs = Mockito.mock(UnderFileSystem.class); when(mUfs.getUnderFSType()).thenReturn("local"); when(mUfs.deleteFile(any())).thenReturn(true); mScheduler = new ControllableScheduler(); }
return new BackupResponse(backupUri, NetworkAddressUtils.getConnectHost(NetworkAddressUtils.ServiceType.MASTER_RPC, ServerConfiguration.global()));
/** * @param tResp thrift options * @return wire type options corresponding to the thrift options */ public static BackupResponse fromThrift(BackupTResponse tResp) { return new BackupResponse(new AlluxioURI(tResp.getBackupUri()), tResp.getHostname()); }
return new BackupResponse(backupUri, NetworkAddressUtils.getConnectHost(ServiceType.MASTER_RPC));