Hello! Now I’m in troubles trying to run my application in a cluster environment using docker containers. I have a docker image with my application and a tomcat server. My application uses ehcache with “automatic” approach. Here is the ehcache.xml:
<?xml version="1.0" encoding="UTF-8"?>
xsi:noNamespaceSchemaLocation=“ehcache.xsd”>
...
I’m running the application in two different hosts machines, each one with the same version of docker (1.9.1, build a34a1d5). Below is the docker-compose.xml:
As I’ve said in the previous post, I’ve extended ehcache functionallity in order to replicate the cache. By default, ehcache supports only two ways to replicate cache: manual (but if you want to scale up you have to turn down your services) and automatic (your network must support multicast). Both ways didn’t worked for me because I’m working with Rancher and It does not support multicast.
What I’ve done is:
I’ve extended the class RMICacheManagerPeerProviderFactory and call a new way to replicate.
I’ve extended the class RMICacheManagerPeerProvider and based on the automatic approach of ehcache, I built a new way to find the other peers (I used rancher metadata).
Finally I modified the ecache file and replaced the call of RMICacheManagerPeerProviderFactory for the class of the point one.
I hope that this could help you, let me know if you need something else.
@juandavidgc
I am glad that you solved your problem by modifying the ehcache classes.
We are having similar issue and we are using docker swarm for our instances. I am not sure how would get other containers IP from swarm. If you could give any hints how to proceed that would be really helpful.
Hi, we are facing the same issue though in our side we are using manual discovery. When we tried it on our local instances ehcache works but when we applied it to docker, replication doesn’t happen. Anyone can point out what’s wrong to docker?
Note: All ports are open and allowed on the firewall