Hi,

 

For testing purpose to see the remote server failover behavior, I've
created 3 remote cache servers running on a same machine as following:

 

1.       startRemoteCache.sh /remote.cache1.ccf

2.       startRemoteCache.sh /remote.cache2.ccf

3.       startRemoteCache.sh /remote.cache3.ccf

 

On the same machine, I'm using RemoteCachePut.java and
RemoteCacheGet.java to put and get items to the remote "cache hub".
Everything works when all remote cache servers are running, but when I
stopped the *primary* remote cache server, the put and get stop working,
i.e. not able to put and get items to/from any remote cache servers.   I
was expecting some failover to happen against the other remote cache
servers, right?  Are these remote servers configured correctly?

 

Thanks,

--Thanhy

 

#

#  remote.cache1.ccf

#

registry.host=localhost

registry.port=2101

 

# cluster setting

remote.cluster.LocalClusterConsistency=true

remote.cluster.AllowClusterGet=true

 

jcs.default=DC,RC

jcs.auxiliary.DC=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheF
actory

jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.disk.indexed.Indexe
dDiskCacheAttributes

jcs.auxiliary.DC.attributes.DiskPath=./.jcs/raf/cache1

 

jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttribut
es

jcs.default.cacheattributes.MaxObjects=2000000

 

jcs.auxiliary.RC=org.apache.jcs.auxiliary.remote.RemoteCacheFactory

jcs.auxiliary.RC.attributes=org.apache.jcs.auxiliary.remote.RemoteCacheA
ttributes

jcs.auxiliary.RC.attributes.RemoteTypeName=CLUSTER

jcs.auxiliary.RC.attributes.RemoveUponRemotePut=false

jcs.auxiliary.RC.attributes.ClusterServers=localhost:2102,localhost:2103

jcs.auxiliary.RC.attributes.GetOnly=false

 

 

 

 

 

#

#  remote.cache2.ccf

#

registry.host=localhost

registry.port=2102

 

# cluster setting

remote.cluster.LocalClusterConsistency=true

remote.cluster.AllowClusterGet=true

 

jcs.default=DC,RC

jcs.auxiliary.DC=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheF
actory

jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.disk.indexed.Indexe
dDiskCacheAttributes

jcs.auxiliary.DC.attributes.DiskPath=./.jcs/raf/cache2

jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttribut
es

jcs.default.cacheattributes.MaxObjects=2000000

jcs.auxiliary.RC=org.apache.jcs.auxiliary.remote.RemoteCacheFactory

jcs.auxiliary.RC.attributes=org.apache.jcs.auxiliary.remote.RemoteCacheA
ttributes

jcs.auxiliary.RC.attributes.RemoteTypeName=CLUSTER

jcs.auxiliary.RC.attributes.RemoveUponRemotePut=false

jcs.auxiliary.RC.attributes.ClusterServers=localhost:2101,localhost:2103

jcs.auxiliary.RC.attributes.GetOnly=false

 

 

 

 

 

#

#  remote.cache3.ccf

#

registry.host=localhost

registry.port=2103

# cluster setting

remote.cluster.LocalClusterConsistency=true

remote.cluster.AllowClusterGet=true

jcs.default=DC,RC

jcs.auxiliary.DC=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheF
actory

jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.disk.indexed.Indexe
dDiskCacheAttributes

jcs.auxiliary.DC.attributes.DiskPath=./.jcs/raf/cache3

jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttribut
es

jcs.default.cacheattributes.MaxObjects=2000000

jcs.auxiliary.RC=org.apache.jcs.auxiliary.remote.RemoteCacheFactory

jcs.auxiliary.RC.attributes=org.apache.jcs.auxiliary.remote.RemoteCacheA
ttributes

jcs.auxiliary.RC.attributes.RemoteTypeName=CLUSTER

jcs.auxiliary.RC.attributes.RemoveUponRemotePut=false

jcs.auxiliary.RC.attributes.ClusterServers=localhost:2101,localhost:2102

jcs.auxiliary.RC.attributes.GetOnly=false

 

 

#

#  cache.ccf

#

 

jcs.default=RF,DC

jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttribut
es

jcs.default.cacheattributes.MaxObjects=10000

jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory
.lru.LRUMemoryCache

 

jcs.default.cacheattributes.UseMemoryShrinker=true

jcs.default.cacheattributes.MaxMemoryIdleTimeSeconds=3600

jcs.default.cacheattributes.ShrinkerIntervalSeconds=60

jcs.default.cacheattributes.MaxSpoolPerRun=500

 

jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes

jcs.default.elementattributes.IsEternal=false

 

jcs.auxiliary.DC=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheF
actory

jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.disk.indexed.Indexe
dDiskCacheAttributes

jcs.auxiliary.DC.attributes.DiskPath=./.jcs/raf/client

 

jcs.auxiliary.RF=org.apache.jcs.auxiliary.remote.RemoteCacheFactory

jcs.auxiliary.RF.attributes=org.apache.jcs.auxiliary.remote.RemoteCacheA
ttributes

jcs.auxiliary.RF.attributes.FailoverServers=localhost:2101,localhost:210
2,localhost:2103

jcs.auxiliary.RF.attributes.RemoveUponRemotePut=true

jcs.auxiliary.RF.attributes.GetOnly=false

 

 

 

//

//  RemoteCachePut

//

public class RemoteCachePut

{

                public static void main(String[] args) throws Exception

                {

                                int numMes = 10;

 

                                JCS cache =
JCS.getInstance("testCache");

                                

                                System.out.println();

                                

                                String postfix = (args.length > 0) ? "_"
+ args[0] : ""; 

                                for (int i = 0; i < numMes; i++)

                                {

                                                cache.putInGroup("Key_"
+ i, "testGroup", "Value_"+ i + postfix );

 
System.out.println("Put(Key_"+ i + ") = " + cache.get("Key_"+ i));

                                }

                                

                                cache.dispose();

                                

                }

}

 

 

//

//  RemoteCacheGet

//

public class RemoteCacheGet

{

    protected static long listenerId = 1;

 

                public static void main(String[] args) throws Exception

                {

                                int numMes = 10;

                                

                                JCS cache =
JCS.getInstance("testCache");

                                

                                while (true)

                                {

                                                Thread.sleep(1000);

                                                System.out.println();

                                                

                                                for (int i = 0; i <
numMes; i++)

                                                {

                                                                Object
data = cache.getFromGroup("Key_" + i, "testGroup");

 
System.out.println("Get(Key_"+ i + ") = " + data);

                                                }

                                }

                }

}

 

 

 

 

Reply via email to