Unable to Start Keycloak
Unable to Start Keycloak in Keycloak Accessing Issues.
Unable to Start Keycloak#
When the Percona DB is down, then keycloak will not be able to connect and fetch the config data.
Once the connection is established, the keycloak gets started.
Follow the below steps to resolve the issue:
-
Check the status of percona
-
Check the nomad status
nomad status keycloakExpected Output:
ID = keycloak Name = keycloak Submit Date = 2023-09-27T16:51:08+05:30 Type = service Priority = 50 Datacenters = dc1 Namespace = default Status = failed Periodic = false Parameterized = false Summary Task Group Queued Starting Running Failed Complete Lost Unknown keycloak 0 0 1 0 1 0 0 Latest Deployment ID = bbe2c1bf Status = successful Description = Deployment completed successfully Deployed Task Group Desired Placed Healthy Unhealthy Progress Deadline keycloak 1 1 1 0 2023-09- 27T17:02:56+05:30 Allocations ID Node ID Task Group Version Desired Status Created Modified 61c8e78e fd797122 keycloak 2 run running 22h27m ago 22h25m ago -
Collect the allocation ID and execute the below command:
nomad status <allocation ID>For Example:
nomad status 61c8e78eExpected Output:
ID = 61c8e78e-0013-3c90-c260-b71c782f858b Eval ID = 308dce41 Name = keycloak.keycloak[0] Node ID = fd797122 Node Name = server-01.example Job ID = keycloak Job Version = 2 Client Status = failed Client Description = failed tasks Desired Status = run Desired Description = <none> Created = 8m22s ago Modified = 15s ago Deployment ID bbe2c1bf = Deployment Health unhealthy = Reschedule Eligibility = 21s from now Allocation Addresses: Label Dynamic Address *keycloak_https_port yes 192.0.2.18:8443 -> 8443 *jmx_port yes 192.0.2.18:9990 -> 9990 Task "keycloak" is "dead" Task Resources: CPU Memory Disk Addresses 29/1000 MHz 666 MiB/1.5 GiB 300 MiB Task Events: Started At = 2023-09-27T11:21:35Z Finished At = 2023-09-27T11:25:05Z Total Restarts = 2 Last Restart = 2023-09-27T13:24:16+05:30 Recent Events: Time Type Description 2023-09-27T16:51:35+05:30 killing Sent interrupt. Waiting 5s before force killing 2023-09-27T16:51:08+05:30 not started Exceeded allowed attempts 2 in interval 20m0s and mode is "fail" 2023-09-27T16:51:08+05:30 Terminated Exit Code: 1, Exit Message: "Docker container exited with non-zero exit code:1" 2023-09-27T16:51:08+05:30 Started Task started by client 2023-09-27T16:51:08+05:30 Restarting Task restarting in 15.242058095sThe output description displays the error.
-
-
Then execute the below error to check logs
nomad logs -f <keycloak allocation ID>Expected Output:
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at com.mysql@8.0.20//com.mysql.cj.jdbc.exceptions.SQLError.createCommun icationsException(SQLError.java:174) at com.mysql@8.0.20//com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping. translateException(SQLExceptionsMapping.java:64) at com.mysql@8.0.20//com.mysql.cj.jdbc.ConnectionImpl.createNewIO(Conne ctionImpl.java:836) at com.mysql@8.0.20//com.mysql.cj.jdbc.ConnectionImpl.<init> (ConnectionImpl.java:456) at com.mysql@8.0.20//com.mysql.cj.jdbc.ConnectionImpl.getInstance(Conne ctionImpl.java:246) at com.mysql@8.0.20//com.mysql.cj.jdbc.NonRegisteringDriver.connect(Non RegisteringDriver.java:197) at org.jboss.ironjacamar.jdbcadapters@1.4.20.Final//org.jboss.jca.adapt ers.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConne ction(LocalManagedConnectionFactory.java:321) ... 57 more Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failureIf the above error is displayed, then keycloak is not able to connect to percona.
-
Check the percona status
-
Percona status
nomad status perconaExpected Output:
ID = percona Name = percona Submit Date = 2023-09-25T19:38:23+05:30 Type = service Priority = 50 Datacenters = dc1 Namespace = default Status = running Periodic = false Parameterized = false Summary Task Group Queued Starting Running Failed Complete Lost Unknown percona-node1 0 0 1 0 0 0 0 Latest Deployment ID = b78388ea Status = successful Description = Deployment completed successfully Deployed Task Group Desired Placed Healthy Unhealthy Progress Deadline percona-node1 1 1 1 0 2023-09- 25T19:49:14+05:30 Allocations ID Node ID Task Group Version Desired Status Created Modified f60a7d41 fd797122 percona-node1 0 run running 2d19h ago 2d19h ago -
Collect the allocation ID and execute the below command:
nomad status f60a7d41Expected Output:
ID = f60a7d41-aedd-55cc-601f-17405021952d Eval ID = d84de7a9 Name = percona.percona-node1[0] Node ID = fd797122 Node Name = server-01.example Job ID = percona Job Version = 0 Client Status = running Client Description = Tasks are running Desired Status = run Desired Description = <none> Created = 2d19h ago Modified = 2d19h ago Deployment ID = b78388ea Deployment Health = healthy Allocation Addresses: Label Dynamic Address *db yes 192.0.2.18:3307 -> 3307 Task "percona-node1" is "running" Task Resources: CPU Memory Disk Addresses 22/1000 MHz 800 MiB/1.0 GiB 300 MiB Task Events: Started At = 2023-09-25T14:08:42Z Finished At = N/A Total Restarts = 0 Last Restart = N/A Recent Events: Time Type Description 2023-09-25T19:38:42+05:30 Started Task started by client 2023-09-25T19:38:23+05:30 Driver Downloading image 2023-09-25T19:38:23+05:30 Task Setup Building Task Directory 2023-09-25T19:38:23+05:30 Received Task received by client
If the percona is running successfully, then check the connectivity.
-
-
Check the connectivity from keycloak server
telnet <percona IP> <percona port>For Example:
telnet 192.0.2.24 3307Expected Output:
TrTrying 192.0.2.24... telnet: connect to address 192.0.2.24: No route to hostIf the above output displays the error, then there is no connectivity in the port.
-
Check the percona port is opened from keycloak to percona server.