Search in sources :

Example 1 with BackupLeaderRole

use of alluxio.master.backup.BackupLeaderRole in project alluxio by Alluxio.

the class DefaultMetaMaster method start.

@Override
public void start(Boolean isPrimary) throws IOException {
    super.start(isPrimary);
    mWorkerConfigStore.reset();
    mMasterConfigStore.reset();
    if (isPrimary) {
        // Add the configuration of the current leader master
        mMasterConfigStore.registerNewConf(mMasterAddress, ConfigurationUtils.getConfiguration(ServerConfiguration.global(), Scope.MASTER));
        // The service that detects lost standby master nodes
        getExecutorService().submit(new HeartbeatThread(HeartbeatContext.MASTER_LOST_MASTER_DETECTION, new LostMasterDetectionHeartbeatExecutor(), (int) ServerConfiguration.getMs(PropertyKey.MASTER_STANDBY_HEARTBEAT_INTERVAL), ServerConfiguration.global(), mMasterContext.getUserState()));
        getExecutorService().submit(new HeartbeatThread(HeartbeatContext.MASTER_LOG_CONFIG_REPORT_SCHEDULING, new LogConfigReportHeartbeatExecutor(), (int) ServerConfiguration.getMs(PropertyKey.MASTER_LOG_CONFIG_REPORT_HEARTBEAT_INTERVAL), ServerConfiguration.global(), mMasterContext.getUserState()));
        if (ServerConfiguration.getBoolean(PropertyKey.MASTER_DAILY_BACKUP_ENABLED)) {
            mDailyBackup = new DailyMetadataBackup(this, Executors.newSingleThreadScheduledExecutor(ThreadFactoryUtils.build("DailyMetadataBackup-%d", true)), mUfsManager);
            mDailyBackup.start();
        }
        if (mJournalSpaceMonitor != null) {
            getExecutorService().submit(new HeartbeatThread(HeartbeatContext.MASTER_JOURNAL_SPACE_MONITOR, mJournalSpaceMonitor, ServerConfiguration.getMs(PropertyKey.MASTER_JOURNAL_SPACE_MONITOR_INTERVAL), ServerConfiguration.global(), mMasterContext.getUserState()));
        }
        if (mState.getClusterID().equals(INVALID_CLUSTER_ID)) {
            try (JournalContext context = createJournalContext()) {
                String clusterID = java.util.UUID.randomUUID().toString();
                mState.applyAndJournal(context, clusterID);
                LOG.info("Created new cluster ID {}", clusterID);
            }
            if (ServerConfiguration.getBoolean(PropertyKey.MASTER_UPDATE_CHECK_ENABLED) && !ServerConfiguration.getBoolean(PropertyKey.TEST_MODE)) {
                getExecutorService().submit(new HeartbeatThread(HeartbeatContext.MASTER_UPDATE_CHECK, new UpdateChecker(this), (int) ServerConfiguration.getMs(PropertyKey.MASTER_UPDATE_CHECK_INTERVAL), ServerConfiguration.global(), mMasterContext.getUserState()));
            }
        } else {
            LOG.info("Detected existing cluster ID {}", mState.getClusterID());
        }
        mBackupRole = new BackupLeaderRole(mCoreMasterContext);
    } else {
        if (ConfigurationUtils.isHaMode(ServerConfiguration.global())) {
            // Standby master should setup MetaMasterSync to communicate with the leader master
            RetryHandlingMetaMasterMasterClient metaMasterClient = new RetryHandlingMetaMasterMasterClient(MasterClientContext.newBuilder(ClientContext.create(ServerConfiguration.global())).build());
            getExecutorService().submit(new HeartbeatThread(HeartbeatContext.META_MASTER_SYNC, new MetaMasterSync(mMasterAddress, metaMasterClient), (int) ServerConfiguration.getMs(PropertyKey.MASTER_STANDBY_HEARTBEAT_INTERVAL), ServerConfiguration.global(), mMasterContext.getUserState()));
            LOG.info("Standby master with address {} starts sending heartbeat to leader master.", mMasterAddress);
        }
        // Enable worker role if backup delegation is enabled.
        if (ServerConfiguration.getBoolean(PropertyKey.MASTER_BACKUP_DELEGATION_ENABLED)) {
            mBackupRole = new BackupWorkerRole(mCoreMasterContext);
        }
    }
}
Also used : HeartbeatThread(alluxio.heartbeat.HeartbeatThread) JournalContext(alluxio.master.journal.JournalContext) BackupWorkerRole(alluxio.master.backup.BackupWorkerRole) BackupLeaderRole(alluxio.master.backup.BackupLeaderRole)

Aggregations

HeartbeatThread (alluxio.heartbeat.HeartbeatThread)1 BackupLeaderRole (alluxio.master.backup.BackupLeaderRole)1 BackupWorkerRole (alluxio.master.backup.BackupWorkerRole)1 JournalContext (alluxio.master.journal.JournalContext)1