How do define DB connection pool in Keycloak docker - docker

Im using Keycloak docker 16.1.1 with postgres database.
Is there any way to define DB connection pool settings and max http connections?
Because Im getting Unable to acquire JDBC Connection error

Related

Why can I not connect to DSE nodes running in Docker?

I'm trying to set up a cassandra ring with five nodes in docker using dse-server and dse-studio. The docker containers are up and running and I can access the casandra database and do CRUD operations, but it does not connect to all the nodes. I believe I have not created the docker compose networks correctly or it may be another issue. Here is the code for the project:
https://github.com/juanpujazon/DockerCassandraNodes
If I use the connector connecting to 192.168.3.19:9042 I can do the CRUD for the tables but only the conection to the first node is succesfull. The CRUD completes succesfully, but all the hosts ips other than the first one get the error "Connection[/172.30.0.4:9042-1, inFlight=0, closed=false] Error connecting to /172.30.0.4:9042 (connection timed out: /172.30.0.4:9042)"
I tried to create a connector adding all the ips from the different nodes as contact points but is not working as intended:
Exception in thread "main" java.lang.IllegalArgumentException: Failed to add contact point: "127.0.0.1";"172.30.0.2";"172.30.0.3";"172.30.0.4";"172.30.0.5";"172.30.0.6"
at com.datastax.driver.core.Cluster$Builder.addContactPoint(Cluster.java:943)
at cassandra.java.client.CassandraConnector.connectNodes(CassandraConnector.java:30)
at cassandra.java.client.Main.main(Main.java:13)
Caused by: java.net.UnknownHostException: Host desconocido ("127.0.0.1";"172.30.0.2";"172.30.0.3";"172.30.0.4";"172.30.0.5";"172.30.0.6")
at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(InetAddress.java:933)
at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1529)
at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:852)
at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1519)
at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1377)
at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1305)
at com.datastax.driver.core.Cluster$Builder.addContactPoint(Cluster.java:939)
Any idea about what should I change?
If you can only connect to the cluster on 192.168.3.19, it indicates to me that the containers are not accessible on the host. You will need to configure your Docker environment so that the containers are exposed to public access.
For this error:
Connection[/172.30.0.4:9042-1, inFlight=0, closed=false] \
Error connecting to /172.30.0.4:9042 (connection timed out: /172.30.0.4:9042)
you are connecting to the container using the default CQL port 9042 but you've exposed it on a different port in your docker-compose.yml:
ports:
- 9044:9042
I recommend you re-map all the container ports to just 9042 to make it easier for yourself to connect to them. Otherwise, you'll need to specify the port together with the IP addresses when you configure the contact points like:
"ip1:port1", "ip2:port2", "ip3:port3"
I've also noted that you've included localhost in the contact points:
Failed to add contact point: "127.0.0.1";"172.30.0.2";"172.30.0.3";"172.30.0.4";"172.30.0.5";"172.30.0.6"
If you have a node that is only listening for client connections on localhost then it is configured incorrectly and you need to fix its configuration.
Finally, if your goal is to build a cluster for app development, you might want to consider using Astra DB so you don't have to worry about configuring/maintaining your own Cassandra installation. With Astra DB, you can launch a cluster on the free tier with literally just 5 clicks in just over a minute with no credit card required. Cheers!

neo4j load balancer access issue

I installed neo4j enterprise edition load balancer with helm chart. but when i try to connect using LB ingress url i get the below error.
$ cypher-shell -a neo4j://a0b41a459c98447b8affdd85bbbd7c0a-1305064690.us-east-1.elb.amazonaws.com -u neo4j -p secret
Connection to the database terminated. Please ensure that your database is listening on the correct host and port and that you have compatible encryption settings both on Neo4j server and driver. Note that the default encryption setting has changed in Neo4j 4.0.

Cloud Run fail to connect to Postgres Cloud SQL: Device or resource busy (os error 16)

Building an app in deno v1.1.0 and I have it in a docker container. I'm able to connect to my local postgres instance from the container as well as the gcloud postgres instance via the cloudsql proxy and via adding my IP to the authorized networks list.
I've added Cloud SQL Client role to the service account of the Cloud Run service and I've also added the connection as stated in the directions here:
https://cloud.google.com/sql/docs/postgres/connect-run#configuring
The SQL instance and Cloud Run service are in the same GCP project.
However, whenever I deploy a revision, I keep facing the same error:
Error: Device or resource busy (os error 16)

How to allow outbound requests from a Google Cloud Run to external MySql instance

I've created a google cloud run service, acting as an api which needs to connect to a mysql instance correctly hosted in aws rds. I can see that the google cloud run container is unable to connect to the mysql server instance.
My suspicion is that outbound connections are blocked from the google cloud run container.
Hence my question is if anyone knows how to allow/configure outbound requests in gcloud.
I can run the container locally and connect to AWS RDS successfully. On Cloud Run I get this error:
MySql.Data.MySqlClient.MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts. ---> MySql.Data.MySqlClient.MySqlException (0x80004005): Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

Docker on Windows Connecting to sql server from dotnetcore app

I've built a simple api using asp.net core that returns some data from a sql server database.
It runs fine in VS and from the command line, but when i build and run the app as a docker container on my windows 10 machine when i call the api i keep getting this error
System.Data.SqlClient.SqlException: Connection Timeout Expired. The
timeout period elapsed during the post-login phase. The connection
could have timed out while waiting for server to complete the login
process and respond; Or it could have timed out while attempting to
create multiple active connections. The duration spent while
attempting to connect to this server was - [Pre-Login]
initialization=425; handshake=265; [Login] initialization=5;
authentication=9; [Post-Login] complete=14034; --->
System.ComponentModel.Win32Exception: Unknown error 258
I'm not really sure what this is telling me, it's as if it cant find the sql server machine. Do i have to expose port 1433 somehow in the docker config or when i run the container up?
As Tseng explained in his comment, your containers are in their own network, not in your host's network. You'll want indeed to expose that port (or map to another available port on your host), which you can easily do with Docker Compose. In the example below (that you'd but in a docker-compose.yml file), sql is the name of your database container, 1337 is the local port, and 1433 is the container's port.
sql:
ports:
- "1337:1433"
Not sure if my case was the same as your case, but in my case I was connecting from a docker container to a sql server 2008 R2 running on the host (real pc). I had to install SP3 for sql server 2008 R2 to fix it.
More info here

Resources