Skip to content

Exporting the Current Configuration


Hint - initial service start required

Before you export the configuration, you have to start the installed Keycloak version in its service context at least once. This start initializes the runtime environment under /opt/seal/data/seal-keycloak.


Exporting from Version 15.0.0

The following instructions use /opt/seal/data/seal-keycloak-export as an example.

  1. Stop the service:

    sudo systemctl stop seal-keycloak
    
  2. Export the current configuration to the /opt/seal/data/seal-keycloak-export directory:

    sudo -u seal /opt/seal/seal-keycloak/bin/standalone.sh -Djboss.socket.binding.port-offset=10000 -Djboss.server.base.dir=/opt/seal/data/seal-keycloak -Dkeycloak.migration.action=export -Dkeycloak.migration.provider=dir -Dkeycloak.migration.dir=/opt/seal/data/seal-keycloak-export
    
  3. List the exported files:

    ls -l /opt/seal/data/seal-keycloak-export
    

    The result includes the following files:

    Example - file list

    • master-realm.json
    • master-users-0.json
    • ... (potentially further numbered files, like master-users-1.json)
    • SEAL-realm.json
    • SEAL-users-0.json
    • ... (potentially further numbered files, like SEAL-users-1.json)
  4. Cancel Keycloak:

    Ctrl-C
    
  5. Restart the service:

    sudo systemctl start seal-keycloak
    

Exporting from Version 21.0.0

The following instructions use /opt/seal/data/seal-keycloak-export as an example.

  1. Stop the service:

    sudo systemctl stop seal-keycloak
    
  2. Export the current configuration to the /opt/seal/data/seal-keycloak-export directory:

    sudo -u seal /opt/seal/data/seal-keycloak/bin/kc.sh --config-file=/opt/seal/etc/keycloak.conf export --dir=/opt/seal/data/seal-keycloak-export
    
  3. List the exported files:

    ls -l /opt/seal/data/seal-keycloak-export
    

    The result includes the following files:

    Example - file list

    • master-realm.json
    • master-users-0.json
    • ... (potentially further numbered files, like master-users-1.json)
    • SEAL-realm.json
    • SEAL-users-0.json
    • ... (potentially further numbered files, like SEAL-users-1.json)
  4. Restart the service:

    sudo systemctl start seal-keycloak
    

Literature

For details on exporting, see the original documentation.


Back to top