Upgrade Keycloak from 14.0.0 to 20.0.0

703 views
Skip to first unread message

Minh Huy Vo

unread,
Apr 28, 2023, 3:57:24 PM4/28/23
to Keycloak User
Hi,

I'm using Keycloak 14.0.0 and I want to upgrade it to 20.0.0. There are three approaches that I have used:
  1. Export data from KC 14.0.0 using the export button in the UI ->  install KC 20.0.0 -> import the JSON file. This way works but I notice that some users in a realm are not imported to the new KC.
  2. Export data from KC 14.0.0 with pg_dump (I'm using Postgres as the database). -> import this data dump to the new database of the new KC ->  install KC 20.0.0 and connect it to the imported database ->failed to start KC server. The error message is very general as well "ERROR: Failed to start server in (production) mode".
  3. Export data from KC 14.0.0 with pg_dump  -> import this data dump to a new database -> Manually upgrade KC to 15.0.0, 16.0.0, etc. I manage to upgrade KC up to 19.0.0. But then when I try to upgrade from 19.0.0 to 20.0.0. The same message appears: "ERROR: Failed to start server in (production) mode"
Attached is a screenshot of the error message. I tried passing --verbose but then it said invalid option (?).

Any guidance to the correct upgrading approach is appreciated,
Huy
Capture.PNG

Vlasta Ramik

unread,
Apr 29, 2023, 2:49:21 AM4/29/23
to keyclo...@googlegroups.com, huyvol...@gmail.com

Hello,

keycloak should be automatically upgraded once it's started with same database connection properties. Please see https://www.keycloak.org/server/db

There is migration guide where you can find more information about migration a such and additional capabilities (e.g. manual migration): https://www.keycloak.org/docs/latest/upgrading/index.html

Since Keycloak 17 the distribuition is powered by Quarkus, there are some additional information regarding migration from Wildfly based dist to Quarkus one: https://www.keycloak.org/migration/migrating-to-quarkus

--
You received this message because you are subscribed to the Google Groups "Keycloak User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keycloak-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/keycloak-user/7ea47934-950a-4f35-aa88-3c74ca1488f1n%40googlegroups.com.

Minh Huy Vo

unread,
May 9, 2023, 5:10:24 PM5/9/23
to Keycloak User
Hi Vlasta,

Thanks for the guidance, unfortunately it does not help with my specific case. Since I've tried updating a default Keycloak 14.0.0 database to 20.0.0 and that went smoothly,  I suspect that there is something in my current Keycloak 14.0.0 database that prevents me from updating it to Keycloak 20.0.0. The "JDBC resources leaked: 1 ResultSet(s) and 1 Statement(s)" is very suspicious but I do not know how to resolve it (see log below).

Changes detected in configuration. Updating the server image.
Updating the configuration and installing your custom providers, if any. Please wait.
2023-05-09 20:32:33,663 INFO  [io.quarkus.deployment.QuarkusAugmentor] (main) Quarkus augmentation completed in 70109ms
Server configuration updated and persisted. Run the following command to review the configuration:

        kc.sh show-config

Next time you run the server, just run:

        kc.sh start --optimized --http-port=8080 --http-enabled=true

WARNING: The '--auto-build' option for 'start' command is DEPRECATED and no longer needed. When executing the 'start' command, a new server image is automatically built based on the configuration. If you want to disable this behavior and achieve an optimal startup time, use the '--optimized' option instead.
2023-05-09 20:32:35,874 INFO  [org.keycloak.quarkus.runtime.hostname.DefaultHostnameProvider] (main) Hostname settings: Base URL: <unset>, Hostname: localhost, Strict HTTPS: true, Path: <request>, Strict BackChannel: false, Admin URL: <unset>, Admin: <request>, Port: -1, Proxied: true
2023-05-09 20:32:38,564 WARN  [io.quarkus.agroal.runtime.DataSources] (main) Datasource <default> enables XA but transaction recovery is not enabled. Please enable transaction recovery by setting quarkus.transaction-manager.enable-recovery=true, otherwise data may be lost if the application is terminated abruptly
2023-05-09 20:32:43,065 INFO  [org.keycloak.broker.provider.AbstractIdentityProviderMapper] (main) Registering class org.keycloak.broker.provider.mappersync.ConfigSyncEventListener
2023-05-09 20:32:43,079 WARN  [org.infinispan.PERSISTENCE] (keycloak-cache-init) ISPN000554: jboss-marshalling is deprecated and planned for removal
2023-05-09 20:32:43,183 WARN  [org.infinispan.CONFIG] (keycloak-cache-init) ISPN000569: Unable to persist Infinispan internal caches as no global state enabled
2023-05-09 20:32:43,191 INFO  [org.infinispan.CONTAINER] (keycloak-cache-init) ISPN000556: Starting user marshaller 'org.infinispan.jboss.marshalling.core.JBossUserMarshaller'
2023-05-09 20:32:43,379 INFO  [org.infinispan.CONTAINER] (keycloak-cache-init) ISPN000128: Infinispan version: Infinispan 'Triskaidekaphobia' 13.0.10.Final
2023-05-09 20:32:43,436 INFO  [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000078: Starting JGroups channel `ISPN`
2023-05-09 20:32:43,436 INFO  [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000088: Unable to use any JGroups configuration mechanisms provided in properties {}. Using default JGroups configuration!
2023-05-09 20:32:43,487 WARN  [org.jgroups.protocols.UDP] (keycloak-cache-init) JGRP000015: the send buffer of socket MulticastSocket was set to 1.00MB, but the OS only allocated 212.99KB
2023-05-09 20:32:43,487 WARN  [org.jgroups.protocols.UDP] (keycloak-cache-init) JGRP000015: the receive buffer of socket MulticastSocket was set to 20.00MB, but the OS only allocated 212.99KB
2023-05-09 20:32:43,487 WARN  [org.jgroups.protocols.UDP] (keycloak-cache-init) JGRP000015: the send buffer of socket MulticastSocket was set to 1.00MB, but the OS only allocated 212.99KB
2023-05-09 20:32:43,487 WARN  [org.jgroups.protocols.UDP] (keycloak-cache-init) JGRP000015: the receive buffer of socket MulticastSocket was set to 25.00MB, but the OS only allocated 212.99KB
2023-05-09 20:32:45,493 INFO  [org.jgroups.protocols.pbcast.GMS] (keycloak-cache-init) keycloak-0-44539: no members discovered after 2001 ms: creating cluster as coordinator
2023-05-09 20:32:45,501 INFO  [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000094: Received new cluster view for channel ISPN: [keycloak-0-44539|0] (1) [keycloak-0-44539]
2023-05-09 20:32:45,503 INFO  [org.infinispan.CLUSTER] (keycloak-cache-init) ISPN000079: Channel `ISPN` local address is `keycloak-0-44539`, physical addresses are `[172.17.0.3:59251]`
2023-05-09 20:32:46,368 INFO  [org.keycloak.connections.infinispan.DefaultInfinispanConnectionProviderFactory] (main) Node name: keycloak-0-44539, Site name: null
2023-05-09 20:32:55,268 WARN  [io.agroal.pool] (main) Datasource '<default>': JDBC resources leaked: 1 ResultSet(s) and 1 Statement(s)
2023-05-09 20:32:55,760 INFO  [org.infinispan.CLUSTER] (main) ISPN000080: Disconnecting JGroups channel `ISPN`
2023-05-09 20:32:56,181 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Failed to start server in (production) mode
2023-05-09 20:32:56,181 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) For more details run the same command passing the '--verbose' option. Also you can use '--help' to see the details about the usage of the particular command 

Thank you,
Huy
Reply all
Reply to author
Forward
0 new messages