Package org.apache.solr.core.backup
Class BackupManager
- java.lang.Object
-
- org.apache.solr.core.backup.BackupManager
-
public class BackupManager extends Object
This class implements functionality to create a backup with extension points provided to integrate with different types of file-systems.
-
-
Field Summary
Fields Modifier and Type Field Description static StringBACKUP_NAME_PROPprotected BackupIdbackupIdprotected URIbackupPathstatic StringCOLLECTION_ALIAS_PROPstatic StringCOLLECTION_NAME_PROPstatic StringCOLLECTION_PROPS_FILEstatic StringCONFIG_STATE_DIRstatic StringEND_TIME_PROPprotected StringexistingPropsFilestatic StringINDEX_VERSION_PROPprotected BackupRepositoryrepositorystatic StringSTART_TIME_PROPstatic StringTRADITIONAL_BACKUP_PROPS_FILEstatic StringZK_STATE_DIRprotected org.apache.solr.common.cloud.ZkStateReaderzkStateReader
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreateZkStateDir()voiddownloadCollectionProperties(String collectionName)voiddownloadConfigDir(String configName, ConfigSetService configSetService)This method stores the contents of a specified Solr config at the specified location in repository.static BackupManagerforBackup(BackupRepository repository, org.apache.solr.common.cloud.ZkStateReader stateReader, URI backupPath)static BackupManagerforIncrementalBackup(BackupRepository repository, org.apache.solr.common.cloud.ZkStateReader stateReader, URI backupPath)static BackupManagerforRestore(BackupRepository repository, org.apache.solr.common.cloud.ZkStateReader stateReader, URI backupPath)static BackupManagerforRestore(BackupRepository repository, org.apache.solr.common.cloud.ZkStateReader stateReader, URI backupPath, int bid)BackupIdgetBackupId()StringgetVersion()BackupPropertiesreadBackupProperties()This method returns the configuration parameters for the specified backup.org.apache.solr.common.cloud.DocCollectionreadCollectionState(String collectionName)This method reads the meta-data information for the backed-up collection.Optional<BackupProperties>tryReadBackupProperties()voiduploadCollectionProperties(String collectionName)voiduploadConfigDir(String sourceConfigName, String targetConfigName, ConfigSetService configSetService)This method uploads the Solr configuration files to the desired location in Zookeeper.voidwriteBackupProperties(BackupProperties props)This method stores the backup properties at the specified location in the repository.voidwriteCollectionState(String collectionName, org.apache.solr.common.cloud.DocCollection collectionState)This method writes the collection meta-data to the specified location in the repository.
-
-
-
Field Detail
-
COLLECTION_PROPS_FILE
public static final String COLLECTION_PROPS_FILE
- See Also:
- Constant Field Values
-
TRADITIONAL_BACKUP_PROPS_FILE
public static final String TRADITIONAL_BACKUP_PROPS_FILE
- See Also:
- Constant Field Values
-
ZK_STATE_DIR
public static final String ZK_STATE_DIR
- See Also:
- Constant Field Values
-
CONFIG_STATE_DIR
public static final String CONFIG_STATE_DIR
- See Also:
- Constant Field Values
-
COLLECTION_NAME_PROP
public static final String COLLECTION_NAME_PROP
- See Also:
- Constant Field Values
-
COLLECTION_ALIAS_PROP
public static final String COLLECTION_ALIAS_PROP
- See Also:
- Constant Field Values
-
BACKUP_NAME_PROP
public static final String BACKUP_NAME_PROP
- See Also:
- Constant Field Values
-
INDEX_VERSION_PROP
public static final String INDEX_VERSION_PROP
- See Also:
- Constant Field Values
-
START_TIME_PROP
public static final String START_TIME_PROP
- See Also:
- Constant Field Values
-
END_TIME_PROP
public static final String END_TIME_PROP
- See Also:
- Constant Field Values
-
zkStateReader
protected final org.apache.solr.common.cloud.ZkStateReader zkStateReader
-
repository
protected final BackupRepository repository
-
backupId
protected final BackupId backupId
-
backupPath
protected final URI backupPath
-
existingPropsFile
protected final String existingPropsFile
-
-
Method Detail
-
forIncrementalBackup
public static BackupManager forIncrementalBackup(BackupRepository repository, org.apache.solr.common.cloud.ZkStateReader stateReader, URI backupPath)
-
forBackup
public static BackupManager forBackup(BackupRepository repository, org.apache.solr.common.cloud.ZkStateReader stateReader, URI backupPath)
-
forRestore
public static BackupManager forRestore(BackupRepository repository, org.apache.solr.common.cloud.ZkStateReader stateReader, URI backupPath, int bid) throws IOException
- Throws:
IOException
-
forRestore
public static BackupManager forRestore(BackupRepository repository, org.apache.solr.common.cloud.ZkStateReader stateReader, URI backupPath) throws IOException
- Throws:
IOException
-
getBackupId
public final BackupId getBackupId()
-
getVersion
public final String getVersion()
- Returns:
- The version of this backup implementation.
-
readBackupProperties
public BackupProperties readBackupProperties() throws IOException
This method returns the configuration parameters for the specified backup.- Returns:
- the configuration parameters for the specified backup.
- Throws:
IOException- In case of errors.
-
tryReadBackupProperties
public Optional<BackupProperties> tryReadBackupProperties() throws IOException
- Throws:
IOException
-
writeBackupProperties
public void writeBackupProperties(BackupProperties props) throws IOException
This method stores the backup properties at the specified location in the repository.- Parameters:
props- The backup properties- Throws:
IOException- in case of I/O error
-
readCollectionState
public org.apache.solr.common.cloud.DocCollection readCollectionState(String collectionName) throws IOException
This method reads the meta-data information for the backed-up collection.- Parameters:
collectionName- The name of the collection whose meta-data is to be returned.- Returns:
- the meta-data information for the backed-up collection.
- Throws:
IOException- in case of errors.
-
writeCollectionState
public void writeCollectionState(String collectionName, org.apache.solr.common.cloud.DocCollection collectionState) throws IOException
This method writes the collection meta-data to the specified location in the repository.- Parameters:
collectionName- The name of the collection whose meta-data is being stored.collectionState- The collection meta-data to be stored.- Throws:
IOException- in case of I/O errors.
-
uploadConfigDir
public void uploadConfigDir(String sourceConfigName, String targetConfigName, ConfigSetService configSetService) throws IOException
This method uploads the Solr configuration files to the desired location in Zookeeper.- Parameters:
sourceConfigName- The name of the config to be copiedtargetConfigName- The name of the config to be created.configSetService- The name of the configset used to upload the config- Throws:
IOException- in case of I/O errors.
-
downloadConfigDir
public void downloadConfigDir(String configName, ConfigSetService configSetService) throws IOException
This method stores the contents of a specified Solr config at the specified location in repository.- Parameters:
configName- The name of the config to be saved.configSetService- The name of the configset used to download the config- Throws:
IOException- in case of I/O errors.
-
uploadCollectionProperties
public void uploadCollectionProperties(String collectionName) throws IOException
- Throws:
IOException
-
downloadCollectionProperties
public void downloadCollectionProperties(String collectionName) throws IOException
- Throws:
IOException
-
createZkStateDir
public void createZkStateDir() throws IOException- Throws:
IOException
-
-