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 String
BACKUP_NAME_PROP
protected BackupId
backupId
protected URI
backupPath
static String
COLLECTION_ALIAS_PROP
static String
COLLECTION_NAME_PROP
static String
COLLECTION_PROPS_FILE
static String
CONFIG_STATE_DIR
static String
END_TIME_PROP
protected String
existingPropsFile
static String
INDEX_VERSION_PROP
protected BackupRepository
repository
static String
START_TIME_PROP
static String
TRADITIONAL_BACKUP_PROPS_FILE
static String
ZK_STATE_DIR
protected org.apache.solr.common.cloud.ZkStateReader
zkStateReader
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createZkStateDir()
void
downloadCollectionProperties(String collectionName)
void
downloadConfigDir(String configName, ConfigSetService configSetService)
This method stores the contents of a specified Solr config at the specified location in repository.static BackupManager
forBackup(BackupRepository repository, org.apache.solr.common.cloud.ZkStateReader stateReader, URI backupPath)
static BackupManager
forIncrementalBackup(BackupRepository repository, org.apache.solr.common.cloud.ZkStateReader stateReader, URI backupPath)
static BackupManager
forRestore(BackupRepository repository, org.apache.solr.common.cloud.ZkStateReader stateReader, URI backupPath)
static BackupManager
forRestore(BackupRepository repository, org.apache.solr.common.cloud.ZkStateReader stateReader, URI backupPath, int bid)
BackupId
getBackupId()
String
getVersion()
BackupProperties
readBackupProperties()
This method returns the configuration parameters for the specified backup.org.apache.solr.common.cloud.DocCollection
readCollectionState(String collectionName)
This method reads the meta-data information for the backed-up collection.Optional<BackupProperties>
tryReadBackupProperties()
void
uploadCollectionProperties(String collectionName)
void
uploadConfigDir(String sourceConfigName, String targetConfigName, ConfigSetService configSetService)
This method uploads the Solr configuration files to the desired location in Zookeeper.void
writeBackupProperties(BackupProperties props)
This method stores the backup properties at the specified location in the repository.void
writeCollectionState(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
-
-