Jump to content
We've recently updated our Privacy Statement, available here ×
  • Configuring ehcache to replicate across a cluster with REST_V2


    rmiller

    Issue:

    When creating an object, e.g., an organization, using rest_v2 ehcache does not get updated across the cluster.


    Resolution:

    First IP Multicast must be enabled on each server in the cluster. The configuration is different for the two main Linux flavors.

    Ubuntu:

    1. Add or uncomment the following lines in /etc/sysctl.conf.

      net.ipv4.icmp_echo_ignore_broadcasts=false
      net.ipv4.ip_forward=1
      
    2. Lookup the network device used for the multicast traffic by typing ifconfig.

      You’ll get a list of devices with their names on the left. Typically eth[0-9], e.g., eth0.  Remember the name of the device you’ll want to use it in the next step.

    3. Add this line to /etc/network/interfaces.

      up route add -net 224.0.0.0/4 mask 240.0.0.0 dev eth[0-9]
      
    4. Reboot the servers.

    Fedora:

    1. Add or uncomment the following lines in /etc/sysctl.conf.

      net.ipv4.icmp_echo_ignore_broadcasts=0
      net.ipv4.ip_forward=1
      
    2. Lookup the network device used for the multicast traffic by typing ifconfig.

      You’ll get a list of devices with their names on the left. Typically eth[0-9], e.g., eth0.  Remember the name of the device, you’ll use it in the next step.

    3. Create or edit the file /etc/sysconfig/network-scripts/route-eth[0-9] on each server and add the following lines.

      GATEWAY0=0.0.0.0 
      NETMASK0=240.0.0.0 
      ADDRESS0=224.0.0.0 
      

      If there is already a "0" appended to the configuration as above then append "1" to the elements.

    4. Reboot the servers.

    To test the network settings:

    Type "cat /proc/sys/net/ipv4/ip_forward." This must return 1.

    Type "cat /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts." This should return 0.

    Type "ping 224.0.0.1 | grep <IP address of other server in cluster>". You should see the IP address.

     

    Modify ehcache configuration files:

    Add the "hostname" property to the cacheManagerPeerProviderFactory and cacheManagerPeerListenerFactory beans in the following files:

    • WEB-INF/ehcache.xml 
    • WEB-INF/ehcache_hibernate.xml 
    • WEB-INF/classes/ehcache_hibernate.xml
    The configuration will look like this:
     
    <cacheManagerPeerProviderFactory  
        class="net.sf.ehcache.distribution.RMICacheManagerPeerProviderFactory"  
        properties="hostName=172.17.10.124,peerDiscovery=automatic, multicastGroupAddress=228.0.0.1, multicastGroupPort=4446, timeToLive=1"/> 
                    
    <cacheManagerPeerListenerFactory  
        class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"  
        properties="hostName=172.17.10.124,port=40011,remoteObjectPort=40012,socketTimeoutMillis=120000"/>
    
    Restart the servers.
     
    To test the configuration first create an organization using the JasperReport Server UI. In the following examle the organization is testorg1.
     
    Using a REST client send the following URL to any other node in the cluster:
     
    http://172.17.10.125:8080/jasperserver-pro-561/rest_v2/organizations/testorg1/roles
    
    You should receive a 204 No Content HTTP response (there are no roles in the organization). In versions 5.x there is a bug that prevents the automatic replication across the cluster of ehcache. This is fixed in version 6.0. There is a patch for 5.5, 5.6 and 5.6.1. Open a case and request the patch from the support engineer. 

    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...