1 Reply Latest reply on Nov 6, 2017 7:26 AM by Paul Ferraro

    Wildfly Session Externalizing to Database

    Saroj Choudhury Newbie

      Hi,

      Is there any way, we can externalize Session to an external Database like MySQL/Oracle ?

       

      We are planning to have Wildfly under an ELB in AWS and the Wildfly servers will be under Auto Scaling, so, the number of Wildfly servers will vary depending upon the load.

       

      Thanks and Regards,

      Saroj

        • 1. Re: Wildfly Session Externalizing to Database
          Paul Ferraro Master

          Using WF 11.0.0.Final, use one of the ha profiles and make the following modifications:

          1. Create a datasource resource (via the datasources subsystem) describing the database to which you intend to store web session data.

          2. Create a new cache resource using a shared, persistent jdbc store (referencing the name of your datasource defined in step #1) within the "web" cache-container in the Infinispan subsystem, e.g.

          <invalidation-cache name="jdbc" mode="SYNC">
               <transaction mode="BATCH"/>
               <string-keyed-jdbc-store data-source="..." passivation="false" shared="true"/>
          </invalidation-cache>
          

          3. Modify your default-cache of the web cache-container to use this new configuration

          <cache-container name="web" default-cache="jdbc">...</cache-container>
          

          4. Ensure your web applications use <distributable/> in their web.xml