<font face="arial" size="2"><p style="margin:0;padding:0;font-family: arial; font-size: 10pt; word-wrap: break-word;">What should I do to store sessions in the database? Is there a guide to do this? Should I implement any SPI?</p>
<p style="margin:0;padding:0;font-family: arial; font-size: 10pt; word-wrap: break-word;"> </p>
<!--WM_COMPOSE_SIGNATURE_START-->
<p style="margin:0;padding:0;">Kalinga</p>
<p style="margin:0;padding:0;font-family: arial; font-size: 10pt; word-wrap: break-word;"><br />-----Original Message-----<br />From: "Stian Thorgersen" <stian@redhat.com><br />Sent: Tuesday, April 7, 2015 11:50am<br />To: "Kalinga Dissanayake" <kalinga@leapset.com><br />Cc: keycloak-user@lists.jboss.org<br />Subject: Re: Externalising session storage in keycloak<br /><br /></p>
<div id="SafeStyles1428406560">
<p style="margin:0;padding:0;font-family: arial; font-size: 10pt; word-wrap: break-word;">We have support for using either Infinispan or a database (relational or Mongo) to store the user sessions when load balanced.<br /><br />If performance is not a problem you can just go with storing sessions in the database. Otherwise go with Infinispan, see http://docs.jboss.org/keycloak/docs/1.2.0.Beta1/userguide/html/clustering.html for the details on how to configure that. To use a replicated cache instead of a distributed cache use the following config for Infinspan:<br /><br /><subsystem xmlns="urn:jboss:domain:infinispan:2.0"><br /> <cache-container name="keycloak" jndi-name="infinispan/Keycloak" start="EAGER"><br /> <transport lock-timeout="60000"/><br /> <invalidation-cache name="realms" mode="SYNC"/><br /> <invalidation-cache name="users" mode="SYNC"/><br /> <replicated-cachename="sessions" mode="SYNC"/><br /> <replicated-cache name="loginFailures" mode="SYNC"/><br /> </cache-container><br /> ...<br /></subsystem><br /><br />You can also just use the configuration from the docs above but set 'owners="2"'.<br /><br />----- Original Message -----<br />> From: "Kalinga Dissanayake" <kalinga@leapset.com><br />> To: keycloak-user@lists.jboss.org<br />> Cc: "Stian Thorgersen" <stian@redhat.com><br />> Sent: Monday, 6 April, 2015 2:13:42 PM<br />> Subject: Externalising session storage in keycloak<br />> <br />> <br />> Guys i know this has been discussed before, but im trying to find a simple<br />> number of steps for me to externalize the session storage in keycloak.<br />> I just need to do the following;<br />> 1. Two servers running keycloak (wildfly)<br />> 2. A load balancer in front of these two servers. Preferably an AWS<br />> loadbalancer<br />> 3. I need to store the session details on an external store so that the<br />> sessions work accurately.<br />> <br />> There is so much documentation for this but I am actually confused as to what<br />> i should do and the bare minimum i should do to achieve this. I dont need a<br />> distributed cache or anything just need one cache store (may be infinispan<br />> or memcached) and the two keycloak servers running storing the sessions on<br />> that. Is there one key place i should look into which contains the bare<br />> minimum i should do.<br />> <br />> Kalinga.<br />> </p>
</div></font>