Search in sources :

Example 1 with RetryHandlingMetaMasterClient

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();
    }
}
Also used : RetryHandlingMetaMasterClient(alluxio.client.meta.RetryHandlingMetaMasterClient) MetaMasterClient(alluxio.client.meta.MetaMasterClient) FileSystem(alluxio.client.file.FileSystem) RetryHandlingMetaMasterClient(alluxio.client.meta.RetryHandlingMetaMasterClient) MultiProcessCluster(alluxio.multi.process.MultiProcessCluster) File(java.io.File) AlluxioURI(alluxio.AlluxioURI) Test(org.junit.Test) BaseIntegrationTest(alluxio.testutils.BaseIntegrationTest)

Example 2 with RetryHandlingMetaMasterClient

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));
}
Also used : RetryHandlingFileSystemMasterClient(alluxio.client.file.RetryHandlingFileSystemMasterClient) MasterClientContext(alluxio.master.MasterClientContext) RetryHandlingMetaMasterClient(alluxio.client.meta.RetryHandlingMetaMasterClient) RetryHandlingBlockMasterClient(alluxio.client.block.RetryHandlingBlockMasterClient)

Example 3 with RetryHandlingMetaMasterClient

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 });
}
Also used : Context(alluxio.cli.fsadmin.command.Context) MasterClientContext(alluxio.master.MasterClientContext) ClientContext(alluxio.ClientContext) JobMasterClientContext(alluxio.worker.job.JobMasterClientContext) RetryHandlingFileSystemMasterClient(alluxio.client.file.RetryHandlingFileSystemMasterClient) RetryHandlingJournalMasterClient(alluxio.client.journal.RetryHandlingJournalMasterClient) RetryHandlingJobMasterClient(alluxio.client.job.RetryHandlingJobMasterClient) JobMasterClientContext(alluxio.worker.job.JobMasterClientContext) MasterClientContext(alluxio.master.MasterClientContext) ClientContext(alluxio.ClientContext) JobMasterClientContext(alluxio.worker.job.JobMasterClientContext) MasterClientContext(alluxio.master.MasterClientContext) JobMasterClientContext(alluxio.worker.job.JobMasterClientContext) RetryHandlingMetaMasterClient(alluxio.client.meta.RetryHandlingMetaMasterClient) RetryHandlingMetaMasterConfigClient(alluxio.client.meta.RetryHandlingMetaMasterConfigClient) RetryHandlingMetricsMasterClient(alluxio.client.metrics.RetryHandlingMetricsMasterClient) RetryHandlingBlockMasterClient(alluxio.client.block.RetryHandlingBlockMasterClient)

Example 4 with RetryHandlingMetaMasterClient

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();
}
Also used : RetryHandlingMetaMasterClient(alluxio.client.meta.RetryHandlingMetaMasterClient) MetaMasterClient(alluxio.client.meta.MetaMasterClient) RetryHandlingMetaMasterClient(alluxio.client.meta.RetryHandlingMetaMasterClient) File(java.io.File) AlluxioURI(alluxio.AlluxioURI)

Aggregations

RetryHandlingMetaMasterClient (alluxio.client.meta.RetryHandlingMetaMasterClient)4 AlluxioURI (alluxio.AlluxioURI)2 RetryHandlingBlockMasterClient (alluxio.client.block.RetryHandlingBlockMasterClient)2 RetryHandlingFileSystemMasterClient (alluxio.client.file.RetryHandlingFileSystemMasterClient)2 MetaMasterClient (alluxio.client.meta.MetaMasterClient)2 MasterClientContext (alluxio.master.MasterClientContext)2 File (java.io.File)2 ClientContext (alluxio.ClientContext)1 Context (alluxio.cli.fsadmin.command.Context)1 FileSystem (alluxio.client.file.FileSystem)1 RetryHandlingJobMasterClient (alluxio.client.job.RetryHandlingJobMasterClient)1 RetryHandlingJournalMasterClient (alluxio.client.journal.RetryHandlingJournalMasterClient)1 RetryHandlingMetaMasterConfigClient (alluxio.client.meta.RetryHandlingMetaMasterConfigClient)1 RetryHandlingMetricsMasterClient (alluxio.client.metrics.RetryHandlingMetricsMasterClient)1 MultiProcessCluster (alluxio.multi.process.MultiProcessCluster)1 BaseIntegrationTest (alluxio.testutils.BaseIntegrationTest)1 JobMasterClientContext (alluxio.worker.job.JobMasterClientContext)1 Test (org.junit.Test)1