之前,在Payara 4中,我们使用了Hazelcast群集/数据网格。我们在名为hazelcast-config.xml的文件中为Shiro authenticationCache网格映射条目配置了群集发现和ttl:
<?xml version="1.0" encoding="UTF-8"?><hazelcast xmlns="http://www.hazelcast.com/schema/config" xmlns:xsi="http://www.w3.org/2
001/XMLSchema-instance" xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.5.xsd">
<properties/>
<group>
<name>prod</name>
<password>pass</password>
</group>
<management-center enabled="false">http://localhost:8180/mancenter</management-center>
<network>
<join>
<multicast enabled="false">
<multicast-group>my-group</multicast-group>
<multicast-port>my-port</multicast-port>
</multicast>
<tcp-ip enabled="false">
<interface>127.0.0.1</interface>
<member-list>
<member>127.0.0.1</member>
</member-list>
</tcp-ip>
</join>
<interfaces enabled="true">
<interface><my-ip-address></interface>
</interfaces>
</network>
<map name="*.authorizationCache">
<async-backup-count>1</async-backup-count>
<backup-count>0</backup-count>
<time-to-live-seconds>7210</time-to-live-seconds>
</map>
<map name="*.authenticationCache">
<async-backup-count>1</async-backup-count>
<backup-count>0</backup-count>
<time-to-live-seconds>7200</time-to-live-seconds>
</map>
<map name="/mymap">
<async-backup-count>1</async-backup-count>
<backup-count>0</backup-count>
<time-to-live-seconds>7210</time-to-live-seconds>
</map>
<map name="default">
<async-backup-count>1</async-backup-count>
<backup-count>0</backup-count>
</map>
</hazelcast>
现在使用Payara 5,似乎已经启用了hazelcast。无需使用hazelcast-config.xml,集群成员发现(domain discovery)就可以正常工作。问题是,如果没有xml文件,ttl将无法工作。如果我提供hazelcast-config.xml,它会给我我的ttl配置,但是我会丢失域发现。
是否可以使用Payara 5.193同时进行域发现和数据网格ttl配置?看来我应该能够在shiro.ini中设置ttl,但是我看不到任何文档表明这一点。
谢谢
答案 0 :(得分:1)
在Hazelcast配置中,您没有发现设置。您可以使用<multicast enabled="false">
禁用基于多播的发现。您还可以使用<tcp-ip enabled="false">
禁用静态IP配置。然后,没有配置发现,Hazelcast不会形成集群。
您需要设置静态IP配置或使用任何发现机制。请在此处阅读更多信息:https://docs.hazelcast.org/docs/latest/manual/html-single/#discovery-mechanisms。