Hi,
Here is the client config:
<bean id="clientConfig"
class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="failureHandler">
<bean
class="org.apache.ignite.failure.StopNodeOrHaltFailureHandler">
<constructor-arg value="true"/>
<constructor-arg value="1000"/>
</bean>
</property>
<property name="pluginProviders">
<array>
<bean class="<MY_SecurityPluginProvider>">
<constructor-arg ref="nodeSecurityCredential"/>
<constructor-arg ref="securityPluginConfiguration"/>
</bean>
<bean class="<MY_SegmentationPluginProvider>">
</bean>
</array>
</property>
<property name="eventStorageSpi">
<bean
class="<MY_AUDIT_STORAGE_SPI>"
scope="prototype"/>
</property>
<property name="discoverySpi" ref="tcpDiscSpiSpecific"/>
<property name="peerClassLoadingEnabled" value="true"/>
<property name="deploymentMode" value="SHARED"/>
<property name="gridLogger" ref="igniteLogger"/>
<property name="metricsLogFrequency" value="0"/>
<property name="includeEventTypes">
<list>
<util:constant
static-field="org.apache.ignite.events.EventType.EVT_TX_STARTED"/>
<util:constant
static-field="org.apache.ignite.events.EventType.EVT_NODE_SEGMENTED"/>
<util:constant
static-field="org.apache.ignite.events.EventType.EVT_CLIENT_NODE_RECONNECTED"/>
<util:constant
static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT"/>
<util:constant
static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_REMOVED"/>
</list>
</property>
<property name="dataStreamerThreadPoolSize" value="4"/>
<property name="igfsThreadPoolSize" value="4"/>
<property name="peerClassLoadingThreadPoolSize" value="8"/>
<property name="connectorConfiguration">
<bean
class="org.apache.ignite.configuration.ConnectorConfiguration">
<property name="threadPoolSize" value="4"/>
</bean>
</property>
<property name="workDirectory" value="${ignite.work.directory}"/>
<property name="clientMode" value="true"/>
</bean>
Here is the server config (and associated beans)
<bean class="org.apache.ignite.configuration.IgniteConfiguration"
id="serverConfig">
<property name="failureHandler">
<bean
class="org.apache.ignite.failure.StopNodeOrHaltFailureHandler">
<constructor-arg value="true"/>
<constructor-arg value="1000"/>
</bean>
</property>
<property name="pluginProviders">
<array>
<bean class="<MY_SecurityPluginProvider>">
<constructor-arg ref="nodeSecurityCredential"/>
<constructor-arg
ref="securityPluginConfiguration"/>
</bean>
<bean class="<MY_SegmentationPluginProvider>">
</bean>
</array>
</property>
<property name="eventStorageSpi">
<bean
class="<MY_AUDIT_STORAGE_SPI>"
scope="prototype"/>
</property>
<property name="discoverySpi" ref="tcpDiscSpiSpecific"/>
<property name="peerClassLoadingEnabled" value="true"/>
<property name="deploymentMode" value="SHARED"/>
<property name="gridLogger" ref="igniteLogger"/>
<property name="metricsLogFrequency" value="0"/>
<property name="includeEventTypes">
<list>
<util:constant
static-field="org.apache.ignite.events.EventType.EVT_TX_STARTED"/>
<util:constant
static-field="org.apache.ignite.events.EventType.EVT_NODE_SEGMENTED"/>
<util:constant
static-field="org.apache.ignite.events.EventType.EVT_CLIENT_NODE_RECONNECTED"/>
<util:constant
static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_PUT"/>
<util:constant
static-field="org.apache.ignite.events.EventType.EVT_CACHE_OBJECT_REMOVED"/>
</list>
</property>
<property name="dataStreamerThreadPoolSize" value="4"/>
<property name="igfsThreadPoolSize" value="4"/>
<property name="peerClassLoadingThreadPoolSize" value="8"/>
<property name="connectorConfiguration">
<bean
class="org.apache.ignite.configuration.ConnectorConfiguration">
<property name="threadPoolSize" value="4"/>
</bean>
</property>
<property name="communicationSpi">
<bean
class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi"
scope="prototype">
<property name="localPort"
value="${ignite.communicationSpiPort:47100}"/>
<property name="localPortRange" value="20"/>
</bean>
</property>
<property name="segmentationResolvers">
<array>
<ref bean="quorumCheckResolver"/>
</array>
</property>
<property name="segmentationPolicy" value="NOOP"/>
<property name="segmentCheckFrequency" value="5000"/>
<property name="segmentationResolveAttempts" value="5"/>
<property name="clientMode" value="false"/>
<property name="dataStorageConfiguration" ref="persistConf"/>
<property name="workDirectory" value="${ignite.work.directory}"/>
</bean>
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"
id="tcpDiscSpiSpecific"
parent="tcpDiscSpi" scope="prototype">
<property name="localPort" value="${ignite.discoverySpiPort:47500}"/>
<property name="localPortRange" value="20"/>
</bean>
<bean class="org.apache.ignite.configuration.DataStorageConfiguration"
id="persistConf" scope="prototype">
<property name="defaultDataRegionConfiguration">
<bean class="org.apache.ignite.configuration.DataRegionConfiguration"
scope="prototype">
<property name="metricsEnabled" value="false"/>
<property name="persistenceEnabled" value="true"/>
<property name="name" value="Default_Region"/>
<property name="maxSize" value="#{4L * 1024 * 1024 * 1024}"/>
</bean>
</property>
</bean>
<bean
class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"
id="tcpPortConfig" scope="prototype">
<property name="addresses" value="${ignite.nodes}"/>
</bean>
The client app just does this:
IgniteConfiguration igniteConfiguration = // load the serverConfig
spring bean
Ignition.start(igniteConfiguration);
Our caches are created via sql tables with:
CREATE TABLE TABLEA(
MODIFICATIONDATE TIMESTAMP,
ISACTIVE BOOLEAN,
VERSIONKEY VARCHAR,
KEYNAME VARCHAR ,
NAME VARCHAR,
VALUE VARCHAR,
VALUETYPE VARCHAR,
PRIMARY KEY ( NAME,VALUETYPE)
) WITH "TEMPLATE=MY_TEMPLATE,value_type=TABLEA, key_type=TABLEAKEY";
CREATE INDEX TABLEA_IDX ON PUBLIC.TABLEA (VALUETYPE, NAME);
Where MY_TEMPLATE is used for all our caches with this in our server node
startup code:
CacheConfiguration<BinaryObject, BinaryObject> cacheConfiguration =
new CacheConfiguration<>("MY_TEMPLATE");
cacheConfiguration.setRebalanceMode(CacheRebalanceMode.SYNC);
cacheConfiguration.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
cacheConfiguration.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
cacheConfiguration.setCacheMode(CacheMode.REPLICATED);
ignite.addCacheConfiguration(persistentCacheConfiguration);
The client app prints out lots of this type of thing incase this is
relevant:
2020-11-02 14:16:43,904 [exchange-worker-#70] DEBUG
org.apache.ignite.internal.processors.query.h2.SchemaManager [] - Creating
DB table with SQL: CREATE TABLE "PUBLIC"."TABLEA" ( ... all the fields
etc...
2020-11-02 14:16:43,909 [exchange-worker-#70] DEBUG
org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing [] -
Creating cache index [cacheId=-1559558230, idxName=_key_PK]
2020-11-02 14:16:43,912 [exchange-worker-#70] DEBUG
org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing [] -
Creating cache index [cacheId=-1559558230, idxName=TABLEA_IDX]
2020-11-02 14:16:43,915 [exchange-worker-#70] DEBUG
org.apache.ignite.internal.processors.resource.GridResourceProcessor [] -
Injecting resources
[obj=org.apache.ignite.internal.processors.cache.CacheDefaultBinaryAffinityKeyMapper@706efa6b]
2020-11-02 14:16:43,924 [exchange-worker-#70] DEBUG
org.apache.ignite.internal.processors.query.h2.SchemaManager [] - Creating
DB table with SQL: CREATE TABLE "PUBLIC"."TABLEB" ( ... all the fields
etc...
e.t.c for every cache/table defined on the cluster
--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/