use of alluxio.client.meta.RetryHandlingMetaMasterClient in project alluxio by Alluxio.
the class JournalMigrationIntegrationTest method migration.
@Test
public void migration() throws Exception {
MultiProcessCluster cluster = MultiProcessCluster.newBuilder(PortCoordination.JOURNAL_MIGRATION).setClusterName("journalMigration").setNumMasters(3).addProperty(PropertyKey.MASTER_JOURNAL_TYPE, JournalType.UFS.toString()).addProperty(PropertyKey.ZOOKEEPER_SESSION_TIMEOUT, "1sec").build();
try {
cluster.start();
FileSystem fs = cluster.getFileSystemClient();
MetaMasterClient metaClient = new RetryHandlingMetaMasterClient(MasterClientContext.newBuilder(ClientContext.create(ServerConfiguration.global())).setMasterInquireClient(cluster.getMasterInquireClient()).build());
for (int i = 0; i < NUM_DIRS; i++) {
fs.createDirectory(new AlluxioURI("/dir" + i));
}
File backupsDir = AlluxioTestDirectory.createTemporaryDirectory("backups");
AlluxioURI zkBackup = metaClient.backup(BackupPRequest.newBuilder().setTargetDirectory(backupsDir.getAbsolutePath()).setOptions(BackupPOptions.newBuilder().setLocalFileSystem(false)).build()).getBackupUri();
cluster.updateMasterConf(PropertyKey.MASTER_JOURNAL_INIT_FROM_BACKUP, zkBackup.toString());
// Migrate to embedded journal HA.
cluster.stopMasters();
cluster.formatJournal();
cluster.updateDeployMode(DeployMode.EMBEDDED);
cluster.startMasters();
assertEquals(NUM_DIRS, fs.listStatus(new AlluxioURI("/")).size());
// Migrate back to Zookeeper HA.
cluster.stopMasters();
cluster.formatJournal();
cluster.updateDeployMode(DeployMode.ZOOKEEPER_HA);
cluster.startMasters();
assertEquals(NUM_DIRS, fs.listStatus(new AlluxioURI("/")).size());
cluster.notifySuccess();
} finally {
cluster.destroy();
}
}
use of alluxio.client.meta.RetryHandlingMetaMasterClient in project alluxio by Alluxio.
the class MultiProcessCluster method getClients.
/**
* @return clients for communicating with the cluster
*/
public synchronized Clients getClients() {
Preconditions.checkState(mState == State.STARTED, "must be in the started state to create a meta master client, but state was %s", mState);
MasterClientContext config = MasterClientContext.newBuilder(ClientContext.create(ServerConfiguration.global())).setMasterInquireClient(getMasterInquireClient()).build();
return new Clients(getFileSystemClient(), new RetryHandlingFileSystemMasterClient(config), new RetryHandlingMetaMasterClient(config), new RetryHandlingBlockMasterClient(config));
}
use of alluxio.client.meta.RetryHandlingMetaMasterClient in project alluxio by Alluxio.
the class FileSystemAdminShell method loadCommands.
@Override
protected Map<String, Command> loadCommands() {
ClientContext ctx = ClientContext.create(mConfiguration);
MasterClientContext masterConfig = MasterClientContext.newBuilder(ctx).build();
JobMasterClientContext jobMasterConfig = JobMasterClientContext.newBuilder(ctx).build();
Context adminContext = new Context(new RetryHandlingFileSystemMasterClient(masterConfig), new RetryHandlingBlockMasterClient(masterConfig), new RetryHandlingMetaMasterClient(masterConfig), new RetryHandlingMetaMasterConfigClient(masterConfig), new RetryHandlingMetricsMasterClient(masterConfig), new RetryHandlingJournalMasterClient(masterConfig), new RetryHandlingJournalMasterClient(jobMasterConfig), new RetryHandlingJobMasterClient(jobMasterConfig), System.out);
return CommandUtils.loadCommands(FileSystemAdminShell.class.getPackage().getName(), new Class[] { Context.class, AlluxioConfiguration.class }, new Object[] { mCloser.register(adminContext), mConfiguration });
}
use of alluxio.client.meta.RetryHandlingMetaMasterClient in project alluxio by Alluxio.
the class JournalCheckpointIntegrationTest method backupAndRestore.
private void backupAndRestore() throws Exception {
File backup = mFolder.newFolder("backup");
MetaMasterClient metaClient = new RetryHandlingMetaMasterClient(MasterClientContext.newBuilder(ClientContext.create(ServerConfiguration.global())).build());
AlluxioURI backupURI = metaClient.backup(BackupPRequest.newBuilder().setTargetDirectory(backup.getAbsolutePath()).setOptions(BackupPOptions.newBuilder().setLocalFileSystem(true)).build()).getBackupUri();
ServerConfiguration.set(PropertyKey.MASTER_JOURNAL_INIT_FROM_BACKUP, backupURI);
mCluster.formatAndRestartMasters();
}
Aggregations