Upgrading Data Grid
Upgrade Data Grid to 8.2
Abstract
Red Hat Data Grid Copy linkLink copied to clipboard!
Data Grid is a high-performance, distributed in-memory data store.
- Schemaless data structure
- Flexibility to store different objects as key-value pairs.
- Grid-based data storage
- Designed to distribute and replicate data across clusters.
- Elastic scaling
- Dynamically adjust the number of nodes to meet demand without service disruption.
- Data interoperability
- Store, retrieve, and query data in the grid from different endpoints.
Data Grid documentation Copy linkLink copied to clipboard!
Documentation for Data Grid is available on the Red Hat customer portal.
Data Grid downloads Copy linkLink copied to clipboard!
Access the Data Grid Software Downloads on the Red Hat customer portal.
You must have a Red Hat account to access and download Data Grid software.
Making open source more inclusive Copy linkLink copied to clipboard!
Red Hat is committed to replacing problematic language in our code, documentation, and web properties. We are beginning with these four terms: master, slave, blacklist, and whitelist. Because of the enormity of this endeavor, these changes will be implemented gradually over several upcoming releases. For more details, see our CTO Chris Wright’s message.
Chapter 1. Data Grid 8 upgrade notes Copy linkLink copied to clipboard!
Review the details in this section before upgrading from one Data Grid 8 version to another.
1.1. Upgrading to Data Grid 8.2 Copy linkLink copied to clipboard!
Read the following information to ensure a successful upgrade from previous versions of Data Grid 8 to 8.2:
Upgrading deployments with Single File cache stores
When upgrading Data Grid to 8.2.0, caches that include a SingleFileStore persistence configuration can encounter an issue that leads to data corruption.
This issue affects upgrades to Data Grid 8.2.0 only. As of Data Grid 8.2.1 this issue no longer occurs during upgrade.
If you have already upgraded from an earlier version to 8.2.0, you should do the following as soon as possible:
-
Back up any
$RHDG_HOME/server/data/*.datfiles. - Upgrade to Data Grid 8.2.1 or later.
After successful upgrade, Data Grid recovers any corrupted data and restores the Single File Store on first start.
Cross-site replication state transfer
For caches that backup to other clusters via cross-site replication, you should perform a state transfer after upgrading to 8.2.
From the Infinispan CLI use the site push-site-state command as follows:
[//containers/default]> site push-site-state --cache=cacheName --site=NYC
[//containers/default]> site push-site-state --cache=cacheName --site=NYC
Upgrade from 8.1 at a minimum
If you are upgrading from 8.0, you must first upgrade to 8.1. Persistent data in Data Grid 8.0 is not binary compatible with Data Grid 8.2 because user serialization contexts are separated from Data Grid serialization contexts in 8.2. To overcome this incompatibility issue, Data Grid 8.2 automatically converts existing persistent cache stores from Data Grid 8.1 at cluster startup. However, Data Grid does not convert cache stores from Data Grid 8.0.
Migrating ProtoStream marshaller configuration
Data Grid 8.2 upgrades the ProtoStream library that provides marshalling capabilities. As part of the upgrade process from Data Grid 8.1 you should also review ProtoStream migration details to avoid any data compatibility issues that might arise from differences in how ProtoStream encodes entries as Protobuf.
In addition the MessageMarshaller API and the ProtoSchemaBuilder annotation are deprecated in the ProtoStream API. You should migrate any serialization context initializers in Data Grid 8.1 to the AutoProtoSchemaBuilder annotation as part of the upgrade to Data Grid 8.2.
Chapter 2. Performing Rolling Upgrades for Data Grid Servers Copy linkLink copied to clipboard!
Perform rolling upgrades of your Data Grid clusters to change between versions without downtime or data loss. Rolling upgrades migrate both your Data Grid servers and your data to the target version over Hot Rod.
2.1. Setting Up Target Clusters Copy linkLink copied to clipboard!
Create a cluster that runs the target Data Grid version and uses a remote cache store to load data from the source cluster.
Prerequisites
- Install a Data Grid cluster with the target upgrade version.
Ensure the network properties for the target cluster do not overlap with those for the source cluster. You should specify unique names for the target and source clusters in the JGroups transport configuration. Depending on your environment you can also use different network interfaces and specify port offsets to keep the target and source clusters separate.
Procedure
Add a
RemoteCacheStoreon the target cluster for each cache you want to migrate from the source cluster.Remote cache stores use the Hot Rod protocol to retrieve data from remote Data Grid clusters. When you add the remote cache store to the target cluster, it can lazily load data from the source cluster to handle client requests.
Switch clients over to the target cluster so it starts handling all requests.
- Update client configuration with the location of the target cluster.
- Restart clients.
2.1.1. Remote Cache Stores for Rolling Upgrades Copy linkLink copied to clipboard!
You must use specific remote cache store configuration to perform rolling upgrades, as follows:
2.2. Synchronizing Data to Target Clusters Copy linkLink copied to clipboard!
When your target cluster is running and handling client requests using a remote cache store to load data on demand, you can synchronize data from the source cluster to the target cluster.
This operation reads data from the source cluster and writes it to the target cluster. Data migrates to all nodes in the target cluster in parallel, with each node receiving a subset of the data. You must perform the synchronization for each cache in your Data Grid configuration.
Procedure
Start the synchronization operation for each cache in your Data Grid configuration that you want to migrate to the target cluster.
Use the Data Grid REST API and invoke
POSTrequests with the?action=sync- dataparameter. For example, to synchronize data in a cache named "myCache" from a source cluster to a target cluster, do the following:POST /v2/caches/myCache?action=sync-data
POST /v2/caches/myCache?action=sync-dataCopy to Clipboard Copied! Toggle word wrap Toggle overflow When the operation completes, Data Grid responds with the total number of entries copied to the target cluster.
Alternatively, you can use JMX by invoking
synchronizeData(migratorName=hotrod)on theRollingUpgradeManagerMBean.Disconnect each node in the target cluster from the source cluster.
For example, to disconnect the "myCache" cache from the source cluster, invoke the following
POSTrequest:POST /v2/caches/myCache?action=disconnect-source
POST /v2/caches/myCache?action=disconnect-sourceCopy to Clipboard Copied! Toggle word wrap Toggle overflow To use JMX, invoke
disconnectSource(migratorName=hotrod)on theRollingUpgradeManagerMBean.
Next steps
After you synchronize all data from the source cluster, the rolling upgrade process is complete. You can now decommission the source cluster.
Chapter 3. Migrating Data Between Cache Stores Copy linkLink copied to clipboard!
Data Grid provides a Java utility for migrating persisted data between cache stores.
In the case of upgrading Data Grid, functional differences between major versions do not allow backwards compatibility between cache stores. You can use StoreMigrator to convert your data so that it is compatible with the target version.
For example, upgrading to Data Grid 8.0 changes the default marshaller to Protostream. In previous Data Grid versions, cache stores use a binary format that is not compatible with the changes to marshalling. This means that Data Grid 8.0 cannot read from cache stores with previous Data Grid versions.
In other cases Data Grid versions deprecate or remove cache store implementations, such as JDBC Mixed and Binary stores. You can use StoreMigrator in these cases to convert to different cache store implementations.
3.1. Cache Store Migrator Copy linkLink copied to clipboard!
Data Grid provides the StoreMigrator.java utility that recreates data for the latest Data Grid cache store implementations.
StoreMigrator takes a cache store from a previous version of Data Grid as source and uses a cache store implementation as target.
When you run StoreMigrator, it creates the target cache with the cache store type that you define using the EmbeddedCacheManager interface. StoreMigrator then loads entries from the source store into memory and then puts them into the target cache.
StoreMigrator also lets you migrate data from one type of cache store to another. For example, you can migrate from a JDBC String-Based cache store to a Single File cache store.
StoreMigrator cannot migrate data from segmented cache stores to:
- Non-segmented cache store.
- Segmented cache stores that have a different number of segments.
3.2. Getting the Store Migrator Copy linkLink copied to clipboard!
StoreMigrator is available as part of the Data Grid tools library, infinispan-tools, and is included in the Maven repository.
Procedure
Configure your
pom.xmlforStoreMigratoras follows:Copy to Clipboard Copied! Toggle word wrap Toggle overflow
3.3. Configuring the Store Migrator Copy linkLink copied to clipboard!
Set properties for source and target cache stores in a migrator.properties file.
Procedure
-
Create a
migrator.propertiesfile. Configure the source cache store in
migrator.properties.Prepend all configuration properties with
source.as in the following example:source.type=SOFT_INDEX_FILE_STORE source.cache_name=myCache source.location=/path/to/source/sifs
source.type=SOFT_INDEX_FILE_STORE source.cache_name=myCache source.location=/path/to/source/sifsCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Configure the target cache store in
migrator.properties.Prepend all configuration properties with
target.as in the following example:target.type=SINGLE_FILE_STORE target.cache_name=myCache target.location=/path/to/target/sfs.dat
target.type=SINGLE_FILE_STORE target.cache_name=myCache target.location=/path/to/target/sfs.datCopy to Clipboard Copied! Toggle word wrap Toggle overflow
3.3.1. Store Migrator Properties Copy linkLink copied to clipboard!
Configure source and target cache stores in a StoreMigrator properties.
| Property | Description | Required/Optional |
|---|---|---|
|
| Specifies the type of cache store type for a source or target.
| Required |
| Property | Description | Example Value | Required/Optional |
|---|---|---|---|
|
| Names the cache that the store backs. |
| Required |
|
| Specifies the number of segments for target cache stores that can use segmentation.
The number of segments must match In other words, the number of segments for a cache store must match the number of segments for the corresponding cache. If the number of segments is not the same, Data Grid cannot read data from the cache store. |
| Optional |
| Property | Description | Required/Optional |
|---|---|---|
|
| Specifies the dialect of the underlying database. | Required |
|
| Specifies the marshaller version for source cache stores. Set one of the following values:
*
*
* | Required for source stores only.
For example: |
|
| Specifies a custom marshaller class. | Required if using custom marshallers. |
|
|
Specifies a comma-separated list of custom | Optional |
|
| Specifies the JDBC connection URL. | Required |
|
| Specifies the class of the JDBC driver. | Required |
|
| Specifies a database username. | Required |
|
| Specifies a password for the database username. | Required |
|
| Sets the database major version. | Optional |
|
| Sets the database minor version. | Optional |
|
| Disables database upsert. | Optional |
|
| Specifies if table indexes are created. | Optional |
|
| Specifies additional prefixes for the table name. | Optional |
|
| Specifies the column name. | Required |
|
| Specifies the column type. | Required |
|
|
Specifies the | Optional |
To migrate from Binary cache stores in older Data Grid versions, change table.string.* to table.binary.\* in the following properties:
-
source.table.binary.table_name_prefix -
source.table.binary.<id\|data\|timestamp>.name -
source.table.binary.<id\|data\|timestamp>.type
| Property | Description | Required/Optional |
|---|---|---|
|
| Sets the database directory. | Required |
|
| Specifies the compression type to use. | Optional |
Example configuration for migrating from a RocksDB cache store.
# Example configuration for migrating from a RocksDB cache store.
source.type=ROCKSDB
source.cache_name=myCache
source.location=/path/to/rocksdb/database
source.compression=SNAPPY
| Property | Description | Required/Optional |
|---|---|---|
|
|
Sets the directory that contains the cache store | Required |
Example configuration for migrating to a Single File cache store.
# Example configuration for migrating to a Single File cache store.
target.type=SINGLE_FILE_STORE
target.cache_name=myCache
target.location=/path/to/sfs.dat
| Property | Description | Value |
|---|---|---|
| Required/Optional |
| Sets the database directory. |
| Required |
| Sets the database index directory. |
Example configuration for migrating to a Soft-Index File cache store.
# Example configuration for migrating to a Soft-Index File cache store.
target.type=SOFT_INDEX_FILE_STORE
target.cache_name=myCache
target.location=path/to/sifs/database
target.location=path/to/sifs/index
3.4. Migrating Cache Stores Copy linkLink copied to clipboard!
Run StoreMigrator to migrate data from one cache store to another.
Prerequisites
-
Get
infinispan-tools.jar. -
Create a
migrator.propertiesfile that configures the source and target cache stores.
Procedure
If you build
infinispan-tools.jarfrom source, do the following:-
Add
infinispan-tools.jarand dependencies for your source and target databases, such as JDBC drivers, to your classpath. -
Specify
migrator.propertiesfile as an argument forStoreMigrator.
-
Add
If you pull
infinispan-tools.jarfrom the Maven repository, run the following command:mvn exec:java