public class PersistenceConfig extends Object
Persistence stores are used to hold copy of in-memory data in disk to be able to restart very fast without needing to load data from a central storage.
PersistenceConfig configures whether persistence is enabled,
where disk data will be stored, should data be persisted
sync or async etc.
Note: If either, but not both, persistence (PersistenceConfig) or
hot-restart-persistence (HotRestartPersistenceConfig) is enabled,
Hazelcast will use the configuration of the enabled element. If both are
enabled, Hazelcast will use the persistence (PersistenceConfig)
configuration. hot-restart-persistence element (and thus HotRestartPersistenceConfig)
will be removed in a future release.
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_DATA_LOAD_TIMEOUT
Default load timeout
|
static int |
DEFAULT_PARALLELISM
Default level of parallelism in Persistence.
|
static int |
DEFAULT_VALIDATION_TIMEOUT
Default validation timeout
|
static String |
PERSISTENCE_BASE_DIR_DEFAULT
Default directory name for the Persistence store's home
|
| Constructor and Description |
|---|
PersistenceConfig() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
File |
getBackupDir()
Base directory for persistence backups.
|
File |
getBaseDir()
Base directory for all Persistence stores.
|
PersistenceClusterDataRecoveryPolicy |
getClusterDataRecoveryPolicy()
Returns the policy to be used when the cluster is started
|
int |
getDataLoadTimeoutSeconds()
Returns configured data load timeout for persistence restart process.
|
EncryptionAtRestConfig |
getEncryptionAtRestConfig()
Returns the Persistence Encryption at Rest configuration.
|
int |
getParallelism()
Gets the configured number of Persistence store instance to create for one Hazelcast instance.
|
int |
getValidationTimeoutSeconds()
Returns configured validation timeout for restart process.
|
int |
hashCode() |
boolean |
isAutoRemoveStaleData()
Returns whether or not automatic removal of stale Persistence restart data is enabled.
|
boolean |
isEnabled()
Returns whether persistence enabled on this member.
|
PersistenceConfig |
setAutoRemoveStaleData(boolean autoRemoveStaleData)
Sets whether or not automatic removal of stale Persistence restart data is enabled.
|
PersistenceConfig |
setBackupDir(File backupDir)
Sets base directory for all Hot Restart stores.
|
PersistenceConfig |
setBaseDir(File baseDir)
Sets base directory for all Persistence stores.
|
PersistenceConfig |
setClusterDataRecoveryPolicy(PersistenceClusterDataRecoveryPolicy clusterDataRecoveryPolicy)
Sets the policy to be used when the cluster is started
|
PersistenceConfig |
setDataLoadTimeoutSeconds(int dataLoadTimeoutSeconds)
Sets data load timeout for persistence restart process,
all members in the cluster should complete restoring their local data
before this timeout.
|
PersistenceConfig |
setEnabled(boolean enabled)
Sets whether persistence is enabled on this member.
|
PersistenceConfig |
setEncryptionAtRestConfig(EncryptionAtRestConfig encryptionAtRestConfig)
Sets the Persistence Encryption at Rest configuration.
|
PersistenceConfig |
setParallelism(int parallelism)
Sets the number of Persistence store instances to create for one Hazelcast instance.
|
PersistenceConfig |
setValidationTimeoutSeconds(int validationTimeoutSeconds)
Sets validation timeout for persistence restart process, includes validating
cluster members expected to join and partition table on all cluster.
|
String |
toString() |
public static final String PERSISTENCE_BASE_DIR_DEFAULT
public static final int DEFAULT_VALIDATION_TIMEOUT
public static final int DEFAULT_DATA_LOAD_TIMEOUT
public static final int DEFAULT_PARALLELISM
public boolean isEnabled()
public PersistenceConfig setEnabled(boolean enabled)
public PersistenceClusterDataRecoveryPolicy getClusterDataRecoveryPolicy()
public PersistenceConfig setClusterDataRecoveryPolicy(PersistenceClusterDataRecoveryPolicy clusterDataRecoveryPolicy)
clusterDataRecoveryPolicy - the policy to be used when the cluster is startedpublic File getBaseDir()
public PersistenceConfig setBaseDir(File baseDir)
baseDir - home directorypublic File getBackupDir()
public PersistenceConfig setBackupDir(File backupDir)
backupDir - home directorypublic int getParallelism()
public PersistenceConfig setParallelism(int parallelism)
public int getValidationTimeoutSeconds()
public PersistenceConfig setValidationTimeoutSeconds(int validationTimeoutSeconds)
validationTimeoutSeconds - validation timeout in secondspublic int getDataLoadTimeoutSeconds()
public PersistenceConfig setDataLoadTimeoutSeconds(int dataLoadTimeoutSeconds)
dataLoadTimeoutSeconds - data load timeout in secondspublic boolean isAutoRemoveStaleData()
public PersistenceConfig setAutoRemoveStaleData(boolean autoRemoveStaleData)
When a member terminates or crashes when cluster state is ClusterState.ACTIVE,
remaining members redistributes data among themselves and data persisted on terminated member's storage becomes
stale. That terminated member cannot rejoin the cluster without removing Persistence data.
When auto-removal of stale Persistence data is enabled, while restarting that member, Persistence data is
automatically removed and it joins the cluster as a completely new member.
Otherwise, Persistence data should be removed manually.
autoRemoveStaleData - true to enable auto-removal of stale data, false otherwisepublic PersistenceConfig setEncryptionAtRestConfig(EncryptionAtRestConfig encryptionAtRestConfig)
encryptionAtRestConfig - the Encryption at Rest configurationpublic EncryptionAtRestConfig getEncryptionAtRestConfig()
Copyright © 2021 Hazelcast, Inc.. All rights reserved.