I am using hazelcast in my spring boot app, i have a hazelcast.yml in my classpath :
hazelcast:
cluster-name: access-cache
network:
join:
multicast:
enabled: false
tcp-ip:
enabled: true
member-list:
- 127.0.0.1:5701
map:
default:
backup-count: 1
time-to-live-seconds: 300
max-idle-seconds: 30
cache-deserialized-values: ALWAYS
eviction:
max-size-policy: PER_NODE
size: 200
eviction-policy: LRU
and in my application.yml :
spring:
hazelcast:
config: classpath:hazelcast.yml
Now when i run a docker container with the app jar, i want to create a hazelcast-prod.yml that contain member-list for this env (prod) that override the hazlecast.yml conf in the jar.
in my container i create hazelcast-prod.yml :
hazelcast:
cluster-name: SAV5
network:
tcp-ip:
enabled: true
member-list:
- ip-server-1:5701
- ip-server-2:5701
and a application-prod.properties :
spring.hazelcast.config=file:/config/hazelcast.yml
The problem is when i start the app, hazelcast take the default conf with the local ip and not the one that i create with the different servers addresses :
INFO [c.h.h.HazelcastCacheRegionFactory] [] [] - Starting up HazelcastCacheRegionFactory
INFO [c.h.i.c.AbstractConfigLocator] [] [] - Loading 'hazelcast-default.xml' from the classpath.
How can i define different conf for each environment ?
Thank you
INFO [c.h.i.AddressPicker] [] [] - [LOCAL] [access-cache] [5.5.0] Interfaces is disabled, trying to pick one address from TCP-IP config addresses: [127.0.0.1]
INFO [c.h.s.logo] [] [] - [127.0.0.1]:5701 [access-cache] [5.5.0]
o o o o---o o--o o o---o o o----o o--o--o
| | / \ / | / / \ | |
o----o o o o----o | o o o----o |
| | * \ / | \ * \ | |
o o * o o---o o--o o----o o---o * o o----o o
INFO [c.h.system] [] [] - [127.0.0.1]:5701 [access-cache] [5.5.0] Copyright (c) 2008-2024, Hazelcast, Inc. All Rights Reserved.
INFO [c.h.system] [] [] - [127.0.0.1]:5701 [access-cache] [5.5.0] Hazelcast Platform 5.5.0 (20240725) starting at [127.0.0.1]:5701
INFO [c.h.system] [] [] - [127.0.0.1]:5701 [access-cache] [5.5.0] Cluster name: sas-access-cache
INFO [c.h.system] [] [] - [127.0.0.1]:5701 [access-cache] [5.5.0] Integrity Checker is disabled. Fail-fast on corrupted executables will not be performed. For more information, see the documentation for Integrity Checker.
INFO [c.h.system] [] [] - [127.0.0.1]:5701 [access-cache] [5.5.0] The Jet engine is disabled.
To enable the Jet engine on the members, do one of the following:
- Change member config using Java API: config.getJetConfig().setEnabled(true)
- Change XML/YAML configuration property: Set hazelcast.jet.enabled to true
- Add system property: -Dhz.jet.enabled=true (for Hazelcast embedded, works only when loading config via Config.load)
- Add environment variable: HZ_JET_ENABLED=true (recommended when running container image. For Hazelcast embedded, works only when loading config via Config.load)
INFO [c.h.s.security] [] [] - [127.0.0.1]:5701 [access-cache] [5.5.0] Enable DEBUG/FINE log level for log category com.hazelcast.system.security or use -Dhazelcast.security.recommendations system property to see