问题
Previously, with Payara 4, we used Hazelcast cluster/data grid. We configured cluster discovery and the ttl for Shiro authenticationCache grid map entries, in a file called hazelcast-config.xml:
<?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>
Now with Payara 5, hazelcast seems to be rolled in. Cluster member discovery (domain discovery) "just works" without using a hazelcast-config.xml. Problem is, ttl does not work without the xml file. And if I supply hazelcast-config.xml it gives me my ttl configuration, but I lose domain discovery.
Is there a way I can have both domain discovery and data grid ttl configuration with Payara 5.193? It seems like I should be able to set ttl in shiro.ini but I see no documentation indicating that.
thank you
回答1:
In your Hazelcast configuration you don't have the discovery setup. You disable multicast-based discovery with <multicast enabled="false">
. You also disable static IP configuration with <tcp-ip enabled="false">
. Then, there is no discovery configured and Hazelcast won't form the cluster.
You need to set either the static IP configuration or use any of the discovery mechanisms. Please read more here: https://docs.hazelcast.org/docs/latest/manual/html-single/#discovery-mechanisms.
来源:https://stackoverflow.com/questions/58956155/how-to-configure-data-grid-ttl-in-payara-5-193