1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[JBoss] How to configure datasource for keycloak to work well with galera cluster?

Discussão em 'StackOverflow' iniciado por Stack, Setembro 10, 2021.

  1. Stack

    Stack Membro Participativo

    ENV:


    Linux: Red Hat 7.5 (Maipo)

    MariaDB: 10.2.13-MariaDB

    Keycloak: 3.4.3.Fina

    JDBC driver: mariadb-java-client-2.2.5.jar

    Decription:


    I start a keycloak instance , make it to connect to a galera-cluster.

    while :

    If I use “kill -9 mariaDB process” on a gelera node, the connection between keycloak and galera will occurred 500 error, after few seconds, 200 OK go on.

    If I use “kill -15 mariaDB process” on a gelera node, the connection between keycloak and galera will 200 OK go on, no error happened.

    "kill -9" to simulate the crash scenario for mysql service.

    what I hope is that no any error when mysql service crashed. (e.g kill -9), keycloak should auto connect to next galera node when current node is crashed , without any errors

    Below is my datasource configuration in standalone.xml


    <datasource jndi-name="java:jboss/datasources/KeycloakDS" pool-name="KeycloakDS" enabled="true" use-java-context="true">
    <connection-url>jdbc:mariadb:failover://db1,db2,db3/keycloak?autoReconnect=true&amp</connection-url>
    <driver>mariadb</driver>
    <security>
    <user-name>kc_dbuser</user-name>
    <password>7a092075c015090fe21c83ecd6f6</password>
    </security>
    <pool>
    <min-pool-size>5</min-pool-size>
    <max-pool-size>20</max-pool-size>
    <flush-strategy>IdleConnections</flush-strategy>
    </pool>
    <validation>
    <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"/>
    <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"/>
    <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
    <validate-on-match>true</validate-on-match>
    <background-validation>true</background-validation>
    <background-validation-millis>1000</background-validation-millis>
    <use-fast-fail>true</use-fast-fail>
    </validation>
    <statement>
    <share-prepared-statements>false</share-prepared-statements>
    </statement>
    </datasource>


    is a keycloak bug or JBOSS bug or JDBC driver BUG or just configuration problem ? How to resolve it?

    Continue reading...

Compartilhe esta Página