ignite系列之3--如何单机或者多机部署多集群
如何单机或者多机部署多集群
discovery port为集群发现端口
comminication port为 集群节点间通信端口,不同集群间配置不同端口,则组成不同集群
配置示例:
<property name="discoverySpi"> <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> <!-- Initial local port to listen to. --> <property name="localPort" value="49500"/> <!-- Changing local port range. This is an optional action. --> <property name="localPortRange" value="1"/> <!-- Setting up IP finder for this cluster --> <property name="ipFinder"> <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"> <property name="addresses"> <list> <!-- Addresses and port range of the nodes from the second cluster. 127.0.0.1 can be replaced with actual IP addresses or host names. Port range is optional. --> <value>10.20.145.91:49500</value> <!--Replace the above with the following--> <!-- <value>${ip1}:49500..49520</value> <value>${ip2}:49500..49520</value> <value>${ip3}:49500..49520</value> --> </list> </property> </bean> </property> <!--单位 毫秒 ms--> <property name="statisticsPrintFrequency" value="30000"/> <property name="reconnectCount" value="10"/> <property name="networkTimeout" value="5000"/> <property name="socketTimeout" value="5000"/> <property name="ackTimeout" value="5000"/> <property name="joinTimeout" value="0"/> </bean> </property> <!-- Explicitly configure TCP communication SPI changing local port number for the nodes from the second cluster. --> <property name="communicationSpi"> <bean class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi"> <property name="localPort" value="49100"/> <property name="localPortRange" value="1"/> </bean> </property>
完整配置参考:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"> <bean abstract="true" id="ignite.cfg" class="org.apache.ignite.configuration.IgniteConfiguration"> <!-- Set to true to enable distributed class loading for examples, default is false. --> <property name="peerClassLoadingEnabled" value="true"/> <property name="igniteInstanceName" value="igniteIgniteInstance"/> <property name="workDirectory" value="/opt/ignite/app/bigdata-ignite/work"/> <!-- <property name="workDirectory" value="/opt/ignite/app/bigdata-ignite${workDirectory}"/> --> <property name="discoverySpi"> <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi"> <!-- Initial local port to listen to. --> <property name="localPort" value="49500"/> <!-- Changing local port range. This is an optional action. --> <property name="localPortRange" value="1"/> <!-- Setting up IP finder for this cluster --> <property name="ipFinder"> <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder"> <property name="addresses"> <list> <!-- Addresses and port range of the nodes from the second cluster. 127.0.0.1 can be replaced with actual IP addresses or host names. Port range is optional. --> <value>10.20.145.91:49500</value> <!--Replace the above with the following--> <!-- <value>${ip1}:49500..49520</value> <value>${ip2}:49500..49520</value> <value>${ip3}:49500..49520</value> --> </list> </property> </bean> </property> <!--单位 毫秒 ms--> <property name="statisticsPrintFrequency" value="30000"/> <property name="reconnectCount" value="10"/> <property name="networkTimeout" value="5000"/> <property name="socketTimeout" value="5000"/> <property name="ackTimeout" value="5000"/> <property name="joinTimeout" value="0"/> </bean> </property> <!-- Explicitly configure TCP communication SPI changing local port number for the nodes from the second cluster. --> <property name="communicationSpi"> <bean class="org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi"> <property name="localPort" value="49100"/> <property name="localPortRange" value="1"/> </bean> </property> <!--默认数据区配置,用于堆外存储数据--> <property name="dataStorageConfiguration"> <bean class="org.apache.ignite.configuration.DataStorageConfiguration"> <!-- Default memory region that grows endlessly. Any cache will be bound to this memory region unless another region is set in the cache's configuration. --> <property name="defaultDataRegionConfiguration"> <bean class="org.apache.ignite.configuration.DataRegionConfiguration"> <property name="name" value="Default_Region"/> <!-- 100 MB memory region with disabled eviction. --> <property name="initialSize" value="#{1L * 1024 * 1024 * 1024}"/> <property name="maxSize" value="#{1L * 1024 * 1024 * 1024}"/> </bean> </property> </bean> </property> <!--jdbc端口范围配置--> <property name="clientConnectorConfiguration"> <bean class="org.apache.ignite.configuration.ClientConnectorConfiguration" > <property name="port" value="10800"/> <property name="portRange" value="1"/> </bean> </property> <!-- Configure internal thread pool. --> <property name="publicThreadPoolSize" value="64"/> <!-- Configure system thread pool. --> <property name="systemThreadPoolSize" value="32"/> <!-- 类加载,对应缓存中key-value类,本地路径和扫描频率--> <property name="deploymentSpi"> <bean class="org.apache.ignite.spi.deployment.uri.UriDeploymentSpi"> <property name="temporaryDirectoryPath" value="/opt/ignite/app/bigdata-ignite/tmp/temp_ignite_libs"/> <property name="uriList"> <list> <value>file://freq=3000@localhost/opt/ignite/app/bigdata-ignite/user_libs</value> <!-- <value>file://freq=${cache_classLoader_scan_freq}@localhost/opt/ignite/app/bigdata-ignite${cache_classLoad_scan_path}</value> --> </list> </property> </bean> </property> </bean> <bean parent="ignite.cfg"/> </beans>
本文来自博客园,作者:life_start,转载请注明原文链接:https://www.cnblogs.com/yangh2016/p/17122577.html