一、Ignite代码部署属性配置
除了对等类加载之外,还可以通过配置UriDeploymentSpi
部署用户代码。使用这种方法,可以在节点配置中指定库文件的位置。Ignite会定期扫描该位置,并在类文件有变更时重新部署。该位置可以是文件系统目录或HTTP(S)位置。当Ignite检测到库文件已从该位置删除时,这些类将从集群中卸载。可以通过提供目录和http(s)的URL来指定(不同类型的)多个位置。
要从文件系统目录部署库文件,需要将目录路径添加到UriDeploymentSpi
配置中的URI列表中。该目录必须存在于指定目录的节点上,并且包含要部署的类的jar文件。注意,必须使用file://
模式指定路径。可以在不同的节点上指定不同的目录。
<!-- 类加载,对应缓存中key-value类,本地路径和扫描频率-->
<property name="deploymentSpi">
<bean class="org.apache.ignite.spi.deployment.uri.UriDeploymentSpi">
<property name="temporaryDirectoryPath" value="${workspace}/bigdata-ignite/tmp/temp_ignite_libs"/>
<property name="uriList">
<list>
<value>file://freq=3000@localhost${workspace}/bigdata-ignite/user_libs</value>
<!--
<value>file://freq=${cache_classLoader_scan_freq}@localhost${workspace}/bigdata-ignite${cache_classLoad_scan_path}</value>
-->
</list>
</property>
</bean>
</property>
二、Ignite集群服务端xml配置示例
<?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>
标签:Ignite,xml,ignite,scan,代码,file,freq,目录
From: https://blog.csdn.net/qq_43462685/article/details/142095956