[keycloak-user] Session persistence in MySQL

Mihai Gogu mihai.g at adoreme.com
Thu Jun 27 03:08:39 EDT 2019


Hello,

We have a keycloak 6.0.1 setup in kubernetes and we want to configure the infinispan persistence for sessions through MySQL since we can expect the containers to be restarted at any time and setting up more infinispan owners does not offer enough guarantees for our needs.

The config that we have now is like this:

<subsystem xmlns="urn:jboss:domain:infinispan:8.0">
	<cache-container name="keycloak”>
	…
		<distributed-cache name="sessions" statistics-enabled="true" owners="1">
        		<jdbc-store data-source="KeycloakDS" dialect="MYSQL" fetch-state="true" passivation="false" preload="true" purge="false" shared="true" singleton="false">
                		<property name="dropTableOnExit">false</property>
                        	<property name="createTableOnStart">true</property>
                	</jdbc-store>
        	</distributed-cache>
	…
	</cache-container>
</subsystem>

When we try to start Keycloak with this config we get the following error:

]) - failure description: {"WFLYCTL0080: Failed services" => {"org.wildfly.clustering.infinispan.cache.keycloak.sessions" => "org.infinispan.commons.CacheException: Unable to invoke method public void org.infinispan.persistence.manager.PreloadManager.start() on object of type PreloadManager Caused by: org.infinispan.commons.CacheException: Unable to invoke method public void org.infinispan.persistence.manager.PreloadManager.start() on object of type PreloadManager Caused by: java.lang.RuntimeException: org.h2.jdbc.JdbcSQLException: Invalid value \"-2147483648\" for parameter \"rows\" [90008-193] Caused by: org.h2.jdbc.JdbcSQLException: Invalid value \"-2147483648\" for parameter \"rows\" [90008-193]”}}


Can you please point us to an example config for this use case or help us with some advices on how we can achieve session persistence with MySQL? We are also using MySQL as the database for Keycloak (users, clients, configs etc…)


Thank you!


More information about the keycloak-user mailing list