Ignite Cache Persistence server for DB with servers for compute 用于计算的服务器

Ignite Cache Persistence server for DB with servers for compute

我正在使用 Ignite 2.5 并部署了几个这样的服务器:

  1. 一台计算机充当启用了持久性的数据库服务器。
  2. 其他三台计算机是具有与数据库服务器相同的缓存但没有持久性的计算服务器。

我有class这样的:

public class Address implements Serializable
{
  String streetName;
  String houseNumber;
  String cityName;
  String countryName;
}

public class Person implements Serializable
{
  @QuerySqlField
  String firstName;

  @QuerySqlField
  String lastName;

  @QuerySqlField
  Address homeAddress;
}

缓存配置在所有服务器上 XML:

 <bean class="org.apache.ignite.configuration.CacheConfiguration">
    <property name="name" value="Persons" />
    <property name="cacheMode" value="PARTITIONED" />
    <property name="backups" value="0" />
    <property name="storeKeepBinary" value="true" />
    <property name="atomicityMode" value="TRANSACTIONAL"/> 
    <property name="writeSynchronizationMode" value="FULL_SYNC"/>
    <property name="indexedTypes">
        <list>
            <value>java.lang.String</value>
            <value>Person</value>
        </list>
    </property>
 </bean>

此外,在数据库服务器上还启用了持久性,如下所示:

<property name="dataStorageConfiguration">
    <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
        <property name="storagePath" value="/data/Storage" />
        <property name="walPath" value="/data/Wal" />
        <property name="walArchivePath" value="/data/WalArchive" />
        <property name="defaultDataRegionConfiguration">
            <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
                <property name="initialSize" value="536870912" />
                <property name="maxSize" value="1073741824" />
                <property name="persistenceEnabled" value="true" />
            </bean>
        </property>
    </bean>
</property>

<property name="binaryConfiguration">
    <bean class="org.apache.ignite.configuration.BinaryConfiguration">
        <property name="compactFooter" value="false" />
    </bean>
</property>

缓存与 put/get 一起使用,但也与 SqlQuery 和 SqlFieldsQuery 一起使用。

有时我必须更新 class 定义,即添加另一个字段左右。我可以关闭整个集群来更新 classes,因为它无论如何都需要应用程序更新。

目前,当我更新 Person class 中的一个字段时,我会遇到奇怪的错误,例如:

Unknown pair [platformId=0, typeId=1968448811]

抱歉,如果这里有多个问题,我不知何故迷失了 "Unknown pair" 问题,现在质疑我的完整设置是否正确。

感谢任何建议。

  • I believe the above configuration is generally OK to use for Ignite?

不,您不能只为一个节点配置持久性。因此,在您的情况下,所有节点都将存储数据,但只有一个节点会保留其数据,因此只会保留部分数据,这可能会导致不可预测的后果。如果只希望一个节点存储数据需要配置node filter.

使用节点过滤器,缓存将仅位于一个节点上,该节点将存储数据,但是在这种情况下,您的计算节点将不得不进行网络 IO 以从缓存中读取数据。

  • Do I understand this other question (Apache Ignite persistent store recommended way for class versions) correctly that on the DB server I shall not have the Person classes in the classpath? Wouldn't then the XML config fail because it's missing the index classes?

您的模型的 classes 不需要位于 class 路径中,但请确保您仅在服务器端使用 BinaryObjects,因此所有计算任务应该使用 BinaryObjects。另外正如您提到的,此配置不起作用,您需要使用 Query Entity 代替索引配置。

  • On compute servers I shall also not use the Person classes but instead read from cache into BinaryObject? Is the idea to manually fill my Person class from the BinaryObject?

好吧,如果您在服务器端没有 Person class,您就无法创建 Person class,您需要在计算作业中使用 BinaryObject。

Currently when I update a field in the Person class I get strange errors like: Unknown pair [platformId=0, typeId=1968448811]

能否请您提供完整的堆栈跟踪信息,并说明是什么操作导致了这个错误?