I am trying to have a single Postgresql DB for a Master -> Slave setup.
I start the master without problems and the postgresql runs without any problems (on master@192.168.5.11).
From the second VM (the slave) I can psql -h 192.168.5.11 -U keycloak -W
without any problems (the connection is there)
My datasource configuration:
<datasource jndi-name="java:jboss/datasources/PostgresDS" pool-name="PostgresDS" enabled="true" use-java-context="true" use-ccm="true" statistics-enabled="true">
<connection-url>jdbc:postgresql://192.168.5.11/keycloak</connection-url>
<connection-property name="url">jdbc:postgresql://192.168.5.11/keycloak</connection-property>
<driver>postgresql</driver>
<driver-class>org.postgresql.Driver</driver-class>
<pool>
<max-pool-size>20</max-pool-size>
</pool>
<security>
<user-name>keycloak</user-name>
<password>keycloak</password>
</security>
<validation>
<check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
<background-validation>true</background-validation>
<background-validation-millis>60000</background-validation-millis>
</validation>
</datasource>
<drivers>
<driver name="postgresql" module="org.postgresql">
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
<datasource-class>org.postgresql.ds.PGPoolingDataSource</datasource-class>
</driver>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
</drivers>
I know you will say that the config has too much information, but I started from the config in the documentation that didn’t work for me (all on KeycloakDS without connection-property, driver-class, datasourc-class, validation) to all combinations from stackoverflow and other blogs.
The error:
[Server:server-two] Caused by: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "keycloak" [Server:server-two] at org.postgresql@42.2.14//org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:525) [Server:server-two] at org.postgresql@42.2.14//org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:146) [Server:server-two] at org.postgresql@42.2.14//org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:197) [Server:server-two] at org.postgresql@42.2.14//org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49) [Server:server-two] at org.postgresql@42.2.14//org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:217) [Server:server-two] at org.postgresql@42.2.14//org.postgresql.Driver.makeConnection(Driver.java:458) [Server:server-two] at org.postgresql@42.2.14//org.postgresql.Driver.connect(Driver.java:260) [Server:server-two] at org.jboss.ironjacamar.jdbcadapters@1.4.20.Final//org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:321) [Server:server-two] ... 57 more [Server:server-two] [Server:server-two] 22:00:50,207 FATAL [org.keycloak.services] (ServerService Thread Pool -- 63) java.lang.RuntimeException: Failed to connect to database
Remember the psql direct connection from slave-vm works (with password and user). Only from datasource I get that the password auth failed.
I’ve tried to encode base64 also the password, but didn’t help me in any way.
Is there something that I’m missing?