如果一天或更长时间内未使用 Keycloak,则需要很长时间才能唤醒

如果一天或更长时间内未使用 Keycloak,则需要很长时间才能唤醒

我在 NGINX 反向代理后面使用 docker compose 安装了 Keycloak。Keycloack 现在仅用于测试。

当我停止使用它几天或更长时间时,下次出现“请求超时”错误时,我需要刷新页面两次才能成功。调试日志对我没有帮助,每 5 秒就会出现相同的日志:

keycloak    | 21:55:07,896 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) new JtaTransactionWrapper
keycloak    | 21:55:07,897 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) was existing? false
keycloak    | 21:55:07,897 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) JtaTransactionWrapper  commit
keycloak    | 21:55:07,897 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) JtaTransactionWrapper end
keycloak    | 21:55:07,897 DEBUG [org.keycloak.services.scheduled.ScheduledTaskRunner] (Timer-2) Executed scheduled task AbstractLastSessionRefreshStoreFactory$$Lambda$1335/0x0000000841587c

你有什么想法 ?

这是我的 docker-compose 文件:

version: '3'
services:
  mariadb:
    image: "mariadb:10.5"
    restart: always
    volumes:
      - /app/keycloak/mysql:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: ***
      MYSQL_DATABASE: keycloak_db
      MYSQL_USER: keycloak
      MYSQL_PASSWORD: ***
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "--silent"]
  keycloak: 
    image: "quay.io/keycloak/keycloak:10.0.1"
    environment:
        PROXY_ADDRESS_FORWARDING: 'true'
        DB_VENDOR: MARIADB
        DB_ADDR: mariadb
        DB_DATABASE: keycloak_db
        DB_USER: keycloak
        DB_PASSWORD: ***
        KEYCLOAK_LOGLEVEL: DEBUG
        # ROOT_LOGLEVEL: DEBUG
    depends_on:
      - mariadb
    ports:
      - 8080:8080
    container_name: keycloak

相关内容