JDBC
、Redis
、Memcached
服务端类图
client processor 类图
注
CacheJdbcPojoStoreFactory
通常是在 bean
文件中进行定义,如下:
<!-- 定义集群外 h2 数据库访问方式 -->
<bean id="storeDataSource" class="org.h2.jdbcx.JdbcDataSource">
<property name="url" value="jdbc:h2:tcp://localhost/store-benchmark/h2-benchmark"/>
<property name="user" value="sa"/>
</bean>
<!-- 定义集群基础配置 -->
<bean class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="peerClassLoadingEnabled" value="false"/>
<property name="cacheConfiguration">
<list>
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="atomic"/>
<property name="cacheMode" value="PARTITIONED"/>
<property name="atomicityMode" value="ATOMIC"/>
<property name="cacheStoreFactory">
<!-- 定义后端数据库配置 -->
<bean class="org.apache.ignite.cache.store.jdbc.CacheJdbcPojoStoreFactory">
<property name="dataSourceBean" value="storeDataSource"/>
<property name="dialect">
<bean class="org.apache.ignite.cache.store.jdbc.dialect.H2Dialect"/>
</property>
</bean>
</property>
</bean>
</list>
</property>
<property name="loadBalancingSpi">
<bean class="org.apache.ignite.spi.loadbalancing.roundrobin.RoundRobinLoadBalancingSpi">
<property name="perTask" value="false"/>
</bean>
</property>
<property name="localHost" value="127.0.0.1"/>
</bean>
注
在 IgniteH2Indexing
中使用 QueryParser
中的 GridSqlQuerySplitter
将接受到的 SQL
请求按分区进行封装为执行指令,通过 GridMapQueryExecutor
和 GridReduceQueryExecutor
来进行分布式查询及结果的聚合操作。
启动过程
在 IgniteKernel
中存在一系列的 XXXProcessor
类的启动过程,其中就包含 ClientListenerProcessor
(用于 JDBC 实现),及 IgniteRestProcessor
(用于 Redis,Memcached,Http 等Rest 接口实现)
startProcessor(createComponent(IGridClusterStateProcessor.class, ctx));
startProcessor(new IgniteAuthenticationProcessor(ctx));
// 缓存相关代码
startProcessor(new GridCacheProcessor(ctx));
// 后端数据库服务
startProcessor(new GridQueryProcessor(ctx));
// JDBC 访问方式
startProcessor(new ClientListenerProcessor(ctx));
startProcessor(createServiceProcessor());
startProcessor(new GridTaskSessionProcessor(ctx));
startProcessor(new GridJobProcessor(ctx));
startProcessor(new GridTaskProcessor(ctx));
startProcessor((GridProcessor)SCHEDULE.createOptional(ctx));
// http,redis,memcached 等访问方式
startProcessor(createComponent(IgniteRestProcessor.class, ctx));
startProcessor(new DataStreamProcessor(ctx));
startProcessor(new GridContinuousProcessor(ctx));
startProcessor(new DataStructuresProcessor(ctx));
startProcessor(createComponent(PlatformProcessor.class, ctx));
startProcessor(new DistributedMetaStorageImpl(ctx));
startProcessor(new DistributedConfigurationProcessor(ctx));
startProcessor(new DurableBackgroundTasksProcessor(ctx));
网友评论