apache Ignite 实战+数据迁移部署

1,因mysql压力需求,采用apache Ignite做缓存前置,考虑不影响现有业务逻辑下,apache Ignite昨为查询主库,mysql不变,所以以mysql为持久层,php写个加载启动,mysql表比较多,手写配置文件不符合场景,决定用php写启动应用代码
2,配置文件(说明:采用纯缓存不切实际,200多万数据好用1G内存,配置持久化

<?xml version="1.0" encoding="UTF-8"?>
			<!--
			  Licensed to the Apache Software Foundation (ASF) under one or more
			  contributor license agreements.  See the NOTICE file distributed with
			  this work for additional information regarding copyright ownership.
			  The ASF licenses this file to You under the Apache License, Version 2.0
			  (the "License"); you may not use this file except in compliance with
			  the License.  You may obtain a copy of the License at

				   http://www.apache.org/licenses/LICENSE-2.0

			  Unless required by applicable law or agreed to in writing, software
			  distributed under the License is distributed on an "AS IS" BASIS,
			  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
			  See the License for the specific language governing permissions and
			  limitations under the License.
			-->

			<beans xmlns="http://www.springframework.org/schema/beans"
				   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
				   xsi:schemaLocation="
				   http://www.springframework.org/schema/beans
				   http://www.springframework.org/schema/beans/spring-beans.xsd">
				<!--
					Alter configuration below as needed.
				-->
				<bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
					<!-- Enabling ODBC. -->
					<property name="odbcConfiguration">
					  <bean class="org.apache.ignite.configuration.OdbcConfiguration"/>
					</property>
					<!--慢客户端列队限制-->
				  <property name="communicationSpi">
					<bean class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi">
					  <property name="slowClientQueueLimit" value="1000"/>
					</bean>
				  </property>
					<!--<property name="memoryConfiguration">
					  <bean class="org.apache.ignite.configuration.MemoryConfiguration">
						<property name="defaultMemoryPolicySize" value="#{1L * 1024 * 1024 * 1024}"/>
					  </bean>
					</property>-->
					  <!-- Enabling Apache Ignite native persistence. -->
					  <property name="dataStorageConfiguration">
						<bean class="org.apache.ignite.configuration.DataStorageConfiguration">
						  <property name="defaultDataRegionConfiguration">
							<bean class="org.apache.ignite.configuration.DataRegionConfiguration">
							  <property name="persistenceEnabled" value="true"/>
							</bean>
						  </property>
						</bean>
					  </property>
					<!-- Configuring cache. -->
					<property name="cacheConfiguration">
					  <list>
						<bean class="org.apache.ignite.configuration.CacheConfiguration">
						  <property name="name" value="PUBLIC"/>
						  <!--<property name="sqlFunctionClasses" value="com.example.SqlFunc"/>-->
						  <property name="cacheMode" value="PARTITIONED"/>
						  <property name="atomicityMode" value="TRANSACTIONAL"/>
						  <property name="writeSynchronizationMode" value="FULL_SYNC"/>
						 </bean>
					</list>
					</property>
					<property name="discoverySpi">
                        <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
						<property name="localPort" value="47500"/>
						<property name="localPortRange" value="20"/>
                          <property name="ipFinder">
                            <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
                              <property name="multicastGroup" value="224.0.0.100"/>
                              <property name="addresses">
								  <list>
									<value>139.236.17.64:47500..47509</value>
									<value>139.241.231.73:47500..47509</value>
								  </list>
							  </property>
                            </bean>
                           </property>
						</bean>
					 </property>             
				 </bean>
			</beans>

3,启动ignite
4,激活集群命令
/opt/tmp/apache-ignite-fabric-2.6.0-bin/bin/control.sh --activate
5,代码创建表,载如数据库
6,单台服务查询性能远不如单台mysql,同样的数据量同样的sql,场景不同吧,不符合需求,以致详情的没动力贴了。

猜你喜欢

转载自blog.csdn.net/weixin_43294972/article/details/83014598