Hazelcast custom default configuration file (hazelcast.xml)

The configuration file of hazelcast shows that there is basically no introduction on the Internet, and I have not found it for a long time, so I compiled a configuration file that can be customized according to the default configuration file and shared it with everyone, as long as it is named hazelcast.xml and placed on the classpath You can use hazelcast as a cache in the directory.

<?xml version="1.0" encoding="UTF-8"?>

<!--自定义hazelcast配置文件
-->
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.4.xsd"
           xmlns="http://www.hazelcast.com/schema/config"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <group>
        <name>dev</name>
        <password>dev-pass</password>
    </group>
    <management-center enabled="false">http://localhost:8080/mancenter</management-center>
    <network>
        <port auto-increment="true" port-count="100">5701</port>
        <outbound-ports>
            <!--连接节点时允许端口的范围
                0 或 * 表示使用系统默认提供的端口
            -->
            <ports>0</ports>
        </outbound-ports>
        <join>
            <multicast enabled="true">
                <multicast-group>224.2.2.3</multicast-group>
                <multicast-port>54327</multicast-port>
            </multicast>
            <tcp-ip enabled="false">
                <interface>127.0.0.1</interface>
            </tcp-ip>
            <aws enabled="false">
                <access-key>my-access-key</access-key>
                <secret-key>my-secret-key</secret-key>
                <!--可选项, 默认是us-east-1 -->
                <region>us-west-1</region>
                <!--可选项, 默认是ec2.amazonaws.com-->
                <host-header>ec2.amazonaws.com</host-header>
                <!--可选项, 默认是所有正在运行的实例-->
                <security-group-name>hazelcast-sg</security-group-name>
                <tag-key>type</tag-key>
                <tag-value>hz-nodes</tag-value>
            </aws>
        </join>
        <interfaces enabled="false">
            <interface>10.10.1.*</interface>
        </interfaces>
        <ssl enabled="false"/>
        <socket-interceptor enabled="false"/>
        <symmetric-encryption enabled="false">
            <!--加密算法:
                DES/ECB/PKCS5Padding
                PBEWithMD5AndDES(默认)
                AES/CBC/PKCS5Padding
                Blowfish
                DESede
            -->
            <algorithm>PBEWithMD5AndDES</algorithm>
            <!-- 生成密钥时要使用的xx值
             -->
            <salt>thesalt</salt>
            <!--  生成密钥时使用的xx密码短语
            -->
            <password>thepass</password>
            <!-- 生成密钥时使用的xx迭代计数
            -->
            <iteration-count>19</iteration-count>
        </symmetric-encryption>
    </network>
    <partition-group enabled="false"/>
    <executor-service name="default">
        <pool-size>16</pool-size>
        <!--队列容量, 范围 0 ~ Integer.MAX_VALUE-->
        <queue-capacity>0</queue-capacity>
    </executor-service>
    <queue name="default">
        <!--队列的最大值
            当JVM的本地队列大小达到最大值时,所有put / offer操作将被阻塞
            范围是(0 ~ Integer.MAX_VALUE), 默认值为0
        -->
        <max-size>0</max-size>
        <!--备份数量, 默认值为1, Map中的所有条目都将被复制到另一个JVM中
                如果设置为0, 即没有备份
        -->
        <backup-count>1</backup-count>
        <!--异步备份数量
            默认值为0(没有备份)
        -->
        <async-backup-count>0</async-backup-count>
        <!--用于清除未使用或空的队列, 一秒为单位时间, 过期则被销毁
            默认为-1, 即无过期时间
        -->
        <empty-queue-ttl>-1</empty-queue-ttl>
    </queue>
    <map name="default">
        <!--将用于存储recordMap的数据类型。
            BINARY(默认) : 键和值将存储为二进制数据
            OBJECT: 键和值将存储在对象表单中
            NATIVE: 键和值将存储在非堆区域中
        -->
        <in-memory-format>BINARY</in-memory-format>

        <!--备份数量, 默认值为1, Map中的所有条目都将被复制到另一个JVM中
                如果设置为0, 即没有备份
        -->
        <backup-count>1</backup-count>
        <!--异步备份的数量, 默认值为0(没有备份)
        -->
        <async-backup-count>0</async-backup-count>
        <!--每个条目的过期时间
            范围 0到Integer.MAX_VALUE之间的任何整数, 默认值为0, 即无限制
        -->
        <time-to-live-seconds>1800</time-to-live-seconds>
        <!--设置空闲的最长时间, 默认值为0(无限长)
        -->
        <max-idle-seconds>0</max-idle-seconds>
        <!--逐出策略:
            NONE(不逐出), LRU(逐出最近最少使用的),
            LFU(逐出最不经常使用的),
            默认值是NONE
        -->
        <eviction-policy>NONE</eviction-policy>
        <!--Map的最大范围(0 ~ Integer.MAX_VALUE之间的任何整数), 默认值是0
        -->
        <max-size policy="PER_NODE">0</max-size>
        <!--逐出总容量的百分比, 默认25%
        -->
        <eviction-percentage>25</eviction-percentage>
        <!--检查前最短的通过时间, 默认100毫秒
        -->
        <min-eviction-check-millis>100</min-eviction-check-millis>
        <!--
            小集群融入大集群中的默认策略为PutIfAbsentMapMergePolicy

            PassThroughMergePolicy: 如果密钥存在合并条目,则将覆盖该条目。
            PutIfAbsentMapMergePolicy(默认):  如果群集中不存在合并条目,则将添加条目。
            HigherHitsMapMergePolicy: 大概率为准
            LatestUpdateMapMergePolicy: 最新更新的条目为准
        -->
        <merge-policy>com.hazelcast.map.merge.PutIfAbsentMapMergePolicy</merge-policy>

    </map>

    <multimap name="default">
        <backup-count>1</backup-count>
        <value-collection-type>SET</value-collection-type>
    </multimap>

    <multimap name="default">
        <backup-count>1</backup-count>
        <value-collection-type>SET</value-collection-type>
    </multimap>

    <list name="default">
        <backup-count>1</backup-count>
    </list>

    <set name="default">
        <backup-count>1</backup-count>
    </set>

    <jobtracker name="default">
        <max-thread-size>0</max-thread-size>
        <!-- 队列大小设为0, 则分区大小*2
         -->
        <queue-size>0</queue-size>
        <retry-count>0</retry-count>
        <chunk-size>1000</chunk-size>
        <communicate-stats>true</communicate-stats>
        <topology-changed-strategy>CANCEL_RUNNING_OPERATION</topology-changed-strategy>
    </jobtracker>

    <semaphore name="default">
        <initial-permits>0</initial-permits>
        <backup-count>1</backup-count>
        <async-backup-count>0</async-backup-count>
    </semaphore>

    <serialization>
        <portable-version>0</portable-version>
    </serialization>

    <services enable-defaults="true"/>

</hazelcast>

 

Guess you like

Origin blog.csdn.net/ip_JL/article/details/85175257