首页 > 其他分享 >Ignite系列之2-xml如何配置代码部署

Ignite系列之2-xml如何配置代码部署

时间:2024-09-10 12:52:29浏览次数:3  
标签:Ignite xml ignite scan 代码 file freq 目录

一、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

相关文章

  • KISS/DRY/YANGI/SOLID 等程序设计原则 第一类代码是炫技,第二类代码才叫专业。
    小结:SOLID出自UncleBob著名的《敏捷软件开发》一书,是五个重要软件设计原则的缩写。SOLID-SRPSingleResponsibilityPrinciple单一职责原则Aclassshouldhaveone,andonlyone,reasontochange.SOLID中最简单的原则,每个class或者function只做一件事情。Open/C......
  • 代码随想录算法 - 二叉树
    题目1226.翻转二叉树给你一棵二叉树的根节点root,翻转这棵二叉树,并返回其根节点。示例1:输入:root=[4,2,7,1,3,6,9]输出:[4,7,2,9,6,3,1]示例2:输入:root=[2,1,3]输出:[2,3,1]示例3:输入:root=[]输出:[]提示:树中节点数目范围在[0,100]内-100<=Node.val......
  • 代码随想录day 56 || 图论6
    Prim算法应用场景是主要是找到一个无向连通图的最小生成树,即连接所有节点且权重总和最小的树//prim三部曲//1,找到距离当前最小树最近节点//2,节点入树//3,更新mindist//更新树funcupdateMinDist(edges[][]int,nodeint){ for_,edge:=rangeedges{ ifed......
  • 代码随想录训练营第28天|利润分解
    122.买卖股票的最佳时机IIclassSolution{public:intmaxProfit(vector<int>&prices){intsum=0,day_profit;for(inti=1;i<prices.size();i++){day_profit=prices[i]-prices[i-1];if(day_profit>0)......
  • 网站如何制作?不懂代码也可以也能做。
    你想创建网站吗?如果你真想创建网站,那可以看看我现在分享给大家分享的内容。很多用户想接触建站,但不知道从何做起,网上有很多的教程,要么不是突出重点,就是长篇累赘,看完后还一头雾水。今天分享的创建网站干货不累赘,步骤简单,如果看这篇文章的你完全不需要你懂代码也不需要过于担忧。跟......
  • 13.6 编写go代码接收webhook的告警发送钉钉
    本节重点介绍:使用钉钉机器人发送到钉钉群通过alertmanagerwebhook发送我们自定义的go程序中解析alert对象并拼接钉钉信息发送需求分析使用钉钉机器人发送到钉钉群钉钉机器人发送群消息文档地址通过webhook发送我们自定义的go程序中然后解析发过来的alert,转换成钉钉的数据结构。......
  • Springboot整合websocket(附详细案例代码)
    文章目录WebSocket简述WebSocket是什么?WebSocket的特点WebSocket的工作流程WebSocket的消息(帧)格式WebSocket与HTTPspringboot中整合WebSocketpom依赖实体类配置类握手配置类WebSocket配置类自定义异常类webSocket服务类websocket中Session的getBasicRemote()和......
  • PLC结构化文本(ST)——区域代码折叠(Region)
    PLCStructuredTextObjectOrientedProgrammingPLC结构化文本(ST)——区域代码折叠(Region)区域折叠条件预编译指令{Region"description"}可以将文本编辑器中的多行合并到一个块中,可以为块分配一个名称,也可以嵌套使用。语法PLCST文本编辑器{region"Description"}//cod......
  • 【没发表过的创新点】【多变量输入单步预测】基于CEEMDAN-VMD-CNN的风电功率预测研究(M
                                          ......
  • 【用于电能质量分类的ML和DWT】智能电网中高级电能质量干扰鲁棒分类器的机器学习应用(M
    ......