6.17.3. 配置缓存存储器

migrator.properties 文件中设置源和目标缓存存储的属性。

流程

  1. 创建 migrator.properties 文件。
  2. migrator.properties 中配置源缓存存储。

    1. 使用 源添加所有配置属性。 如下例所示:

      source.type=SOFT_INDEX_FILE_STORE
      source.cache_name=myCache
      source.location=/path/to/source/sifs
      source.version=<version>
  3. migrator.properties 中配置目标缓存存储。

    1. 使用 目标添加所有配置属性。 如下例所示:

      target.type=SINGLE_FILE_STORE
      target.cache_name=myCache
      target.location=/path/to/target/sfs.dat

6.17.3.1. 缓存存储器的配置属性

配置源和目标缓存存储在 StoreMigrator 属性中。

表 6.2. 缓存存储类型 Property

属性描述必填/选填

type

指定源或目标的缓存存储类型。

.type=JDBC_STRING

.type=JDBC_BINARY

.type=JDBC_MIXED

.type=LEVELDB

.type=ROCKSDB

.type=SINGLE_FILE_STORE

.type=SOFT_INDEX_FILE_STORE

.type=JDBC_MIXED

必需

表 6.3. 常见属性

属性描述值示例必填/选填

cache_name

将存储后端的缓存进行命名。

.cache_name=myCache

必需

segment_count

指定可以使用分段的目标缓存存储位置的片段数量。

片段的数量必须与 Data Grid 配置中的 cluster.hash.numSegments 匹配。

换句话说,缓存存储的片段数量必须与对应缓存的片段数量匹配。如果片段的数量不同,Data Grid 无法从缓存存储中读取数据。

.segment_count=256

选填

表 6.4. JDBC 属性

属性描述必填/选填

dialect

指定底层数据库的数量。

必需

version

指定源缓存存储位置的 marshaller 版本。
设置以下值之一:

* 8 for Data Grid 7.2.x

* 9 for Data Grid 7.3.x

* 10 for Data Grid 8.0.x

* 11 for Data Grid 8.1.x

* 12 for Data Grid 8.2.x

* 13 for Data Grid 8.3.x

仅限源代码存储需要。

marshaller.class

指定自定义 marshaller 类。

如果使用自定义 marshallers,则需要此项。

marshaller.externalizers

指定以这个格式加载的自定义 AdvancedExternalizer 实现的逗号分隔列表: [id]:<Externalizer class>

选填

connection_pool.connection_url

指定 JDBC 连接 URL。

必需

connection_pool.driver_class

指定 JDBC 驱动程序的类。

必需

connection_pool.username

指定数据库用户名。

必需

connection_pool.password

指定数据库用户名的密码。

必需

db.major_version

设置数据库主版本。

选填

db.minor_version

设置数据库次要版本。

选填

db.disable_upsert

禁用数据库。

选填

db.disable_indexing

指定是否创建了表索引。

选填

table.string.table_name_prefix

指定表名称的额外前缀。

选填

table.string.<id|data|timestamp>.name

指定列名称。

必需

table.string.<id|data|timestamp>.type

指定列类型。

必需

key_to_string_mapper

指定 TwoWayKey2StringMapper 类。

选填

注意

要从旧的 Data Grid 版本中的 Binary 缓存存储,将 table.string.* 改为 table.binary.\*,在以下属性中:

  • source.table.binary.table_name_prefix
  • source.table.binary.<id\|data\|timestamp>.name
  • source.table.binary.<id\|data\|timestamp>.type
# Example configuration for migrating to a JDBC String-Based cache store
target.type=STRING
target.cache_name=myCache
target.dialect=POSTGRES
target.marshaller.class=org.example.CustomMarshaller
target.marshaller.externalizers=25:Externalizer1,org.example.Externalizer2
target.connection_pool.connection_url=jdbc:postgresql:postgres
target.connection_pool.driver_class=org.postrgesql.Driver
target.connection_pool.username=postgres
target.connection_pool.password=redhat
target.db.major_version=9
target.db.minor_version=5
target.db.disable_upsert=false
target.db.disable_indexing=false
target.table.string.table_name_prefix=tablePrefix
target.table.string.id.name=id_column
target.table.string.data.name=datum_column
target.table.string.timestamp.name=timestamp_column
target.table.string.id.type=VARCHAR
target.table.string.data.type=bytea
target.table.string.timestamp.type=BIGINT
target.key_to_string_mapper=org.infinispan.persistence.keymappers. DefaultTwoWayKey2StringMapper

表 6.5. rocksdb 属性

属性描述必填/选填

位置

设置数据库目录。

必需

compression

指定要使用的压缩类型。

选填

# 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

表 6.6. SingleFileStore Properties

属性描述必填/选填

位置

设置包含缓存存储 .dat 文件的目录。

必需

# 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

表 6.7. SoftIndexFileStore Properties

属性描述

必填/选填

位置

设置数据库目录。

必需

index_location

设置数据库索引目录。

# 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