Spring boot connect to MongoDB replica set of mongo container running - mongodb

I have set 2 mongo container which having 27017:27017 and 27018:27017 as port. mongo1 is set as primary while mongo2 set as secondary and used replica set.
mongo1 as primary has both write, read access and mongo2 has only read access
spring.data.mongodb.uri = mongodb://abc.xyz:27017/user_demo
//monog1, abc.xyz is the hostname
spring.data.mongodb.uri = mongodb://abc.xyz:27018/user_demo
//mongo2
If I connect only monogo1 in my normal spring boot program, it works(read, write) and if I set mongo2 it works(only read), but when I set both in one line it gives error
spring.data.mongodb.uri = mongodb://abc.xyz:27017,abc.xyz:27018/user_demo?replicaSet=idea-mongo-set
I checked replica set is working by storing in mongo1, in mongo2 I can read
So, what is wrong with the last line. Is there any other way to store uri for replica set
In official spring site it is given
spring.data.mongodb.uri=mongodb://user:secret#mongo1.example.com:12345,mongo2.example.com:23456/test
Error I am getting is this
2019-01-08 15:56:35.245 INFO 29804 --- [ main] c.j.bootifulmongodb.BootMongoDBApp : Started BootMongoDBApp in 3.603 seconds (JVM running for 4.373)
2019-01-08 15:56:54.466 INFO 29804 --- [azure.com:27018] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server abc.xyz:27018
com.mongodb.MongoSocketOpenException: Exception opening socket
at com.mongodb.connection.SocketStream.open(SocketStream.java:63) ~[mongodb-driver-core-3.4.3.jar:na]
at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:115) ~[mongodb-driver-core-3.4.3.jar:na]
at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:113) ~[mongodb-driver-core-3.4.3.jar:na]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_181]
Caused by: java.net.SocketTimeoutException: connect timed out
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) ~[na:1.8.0_181]
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85) ~[na:1.8.0_181]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_181]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_181]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_181]
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) ~[na:1.8.0_181]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_181]
at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_181]
at com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:57) ~[mongodb-driver-core-3.4.3.jar:na]
at com.mongodb.connection.SocketStream.open(SocketStream.java:58) ~[mongodb-driver-core-3.4.3.jar:na]
... 3 common frames omitted

It looks like your uri is on the right track for connecting to a replica set.
spring.data.mongodb.uri = mongodb://abc.xyz:27017,abc.xyz:27018/user_demo?replicaSet=idea-mongo-set
Is it just a typo that credentials (user, password) are omitted here?
This exact syntax is what we use for our replica set connection uri:
mongodb://user:pwd#server1:27017,server2:27017,server3:27017/our_collection?replicaSet=replica_set_name&authSource=authagainstthiscollection&authMechanism=SCRAM-SHA-1

Because you set abc.xyz:27018 hostname in mongo rs.initiate, so client will try to access this hostname directly. But this hostname is unreachable for client, it's just a FQDN in your azure cluster.
I think this document will help you clients use the hostnames listed in the replica set config not the seed list

Related

MongoSocketOpenException while using mongo uri with ocp mongodb route

2023-01-13 11:02:36.291 INFO 1 --- [ main]
org.mongodb.driver.cluster: Cluster created with settings {hosts=mongo.apps.lab.pacosta.com:27017], mode=SINGLE, requiredClusterType=UNKNOWN, derverSelectionTimeout='30000 ms'}
2023-01-13 11:02:36.429 INFO 1 --- [costa.com:27017] org.mongodb.driver.cluster: Exception in monitor thread
while connecting to server mongo.apps.lab.pacosta.com:27017
com.mongodb.MongoSocketOpenException: Exception opening socket
at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:70) ~[mongodb-driver-core-4.1.1.jar!/:na]
at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:143) ~[mongodb-driver-core-4.1.1.jar!/:na]
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.lookupServerDescription(DefaultServerMonitor.java:188) ~[mongodb-driver-core-4.1.1.jar!/:na]
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:144) ~[mongodb-driver-core-4.1.1.jar!/:na]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_212] Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_212]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_212]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_212]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_212]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_212]
at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_212]`
Here are screenshots of OCP routes and environment variables.
We are doing the same thing in our spring boot service using OCP version 4.11 but instead of using service ip we are taking it as a domain in mongo uri which is unable to create the connection

Apache Storm Starter 2.2.0 in Eclipse in Windows - Exception while trying to get leader nimbus info from localhost NimbusLeaderNotFound

I have downloaded the zip file for Apache Storm 2.2.0.
I imported the storm-starter maven project into eclipse in Windows 10. Did a Maven--> Update Project
My project did not have any errors. I did not do any updates to pom.xml.
I executed the WordCountTopology.java
I get the error NimbusLeaderNotFoundException.
I tried after stopping firewall also.
00:54:00.584 [main] INFO o.a.s.StormSubmitter - Generated ZooKeeper secret payload for MD5-digest: -xxxxxxxxxxxxxx
00:54:00.668 [main] WARN o.a.s.v.ConfigValidation - task.heartbeat.frequency.secs is a deprecated config please see class org.apache.storm.Config.TASK_HEARTBEAT_FREQUENCY_SECS for more information.
00:54:16.923 [main] WARN o.a.s.u.NimbusClient - Ignoring exception while trying to get leader nimbus info from localhost. will retry with a different seed host.
java.lang.RuntimeException: java.lang.RuntimeException: org.apache.storm.thrift.transport.TTransportException: java.net.ConnectException: Connection refused: connect
at org.apache.storm.security.auth.ThriftClient.reconnect(ThriftClient.java:108) ~[storm-client-2.2.0.jar:2.2.0]
at org.apache.storm.security.auth.ThriftClient.<init>(ThriftClient.java:69) ~[storm-client-2.2.0.jar:2.2.0]
at org.apache.storm.utils.NimbusClient.<init>(NimbusClient.java:80) ~[storm-client-2.2.0.jar:2.2.0]
at org.apache.storm.utils.NimbusClient.getConfiguredClientAs(NimbusClient.java:221) [storm-client-2.2.0.jar:2.2.0]
at org.apache.storm.utils.NimbusClient.getConfiguredClientAs(NimbusClient.java:179) [storm-client-2.2.0.jar:2.2.0]
at org.apache.storm.utils.NimbusClient.getConfiguredClient(NimbusClient.java:138) [storm-client-2.2.0.jar:2.2.0]
at org.apache.storm.blobstore.NimbusBlobStore.prepare(NimbusBlobStore.java:47) [storm-client-2.2.0.jar:2.2.0]
at org.apache.storm.utils.Utils.validateTopologyBlobStoreMap(Utils.java:1178) [storm-client-2.2.0.jar:2.2.0]
at org.apache.storm.StormSubmitter.validateConfs(StormSubmitter.java:530) [storm-client-2.2.0.jar:2.2.0]
at org.apache.storm.StormSubmitter.submitTopologyAs(StormSubmitter.java:236) [storm-client-2.2.0.jar:2.2.0]
at org.apache.storm.StormSubmitter.submitTopology(StormSubmitter.java:210) [storm-client-2.2.0.jar:2.2.0]
at org.apache.storm.StormSubmitter.submitTopology(StormSubmitter.java:173) [storm-client-2.2.0.jar:2.2.0]
at org.apache.storm.topology.ConfigurableTopology.submit(ConfigurableTopology.java:119) [storm-client-2.2.0.jar:2.2.0]
at org.apache.storm.starter.WordCountTopology.run(WordCountTopology.java:58) [classes/:?]
at org.apache.storm.topology.ConfigurableTopology.start(ConfigurableTopology.java:68) [storm-client-2.2.0.jar:2.2.0]
at org.apache.storm.starter.WordCountTopology.main(WordCountTopology.java:36) [classes/:?]
Caused by: java.lang.RuntimeException: org.apache.storm.thrift.transport.TTransportException: java.net.ConnectException: Connection refused: connect
at org.apache.storm.security.auth.TBackoffConnect.retryNext(TBackoffConnect.java:59) ~[storm-client-2.2.0.jar:2.2.0]
at org.apache.storm.security.auth.TBackoffConnect.doConnectWithRetry(TBackoffConnect.java:51) ~[storm-client-2.2.0.jar:2.2.0]
at org.apache.storm.security.auth.ThriftClient.reconnect(ThriftClient.java:98) ~[storm-client-2.2.0.jar:2.2.0]
... 15 more
Caused by: org.apache.storm.thrift.transport.TTransportException: java.net.ConnectException: Connection refused: connect
at org.apache.storm.thrift.transport.TSocket.open(TSocket.java:226) ~[storm-shaded-deps-2.2.0.jar:2.2.0]
at org.apache.storm.thrift.transport.TFramedTransport.open(TFramedTransport.java:91) ~[storm-shaded-deps-2.2.0.jar:2.2.0]
at org.apache.storm.security.auth.SimpleTransportPlugin.connect(SimpleTransportPlugin.java:101) ~[storm-client-2.2.0.jar:2.2.0]
at org.apache.storm.security.auth.TBackoffConnect.doConnectWithRetry(TBackoffConnect.java:48) ~[storm-client-2.2.0.jar:2.2.0]
at org.apache.storm.security.auth.ThriftClient.reconnect(ThriftClient.java:98) ~[storm-client-2.2.0.jar:2.2.0]
... 15 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) ~[?:1.8.0_241]
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85) ~[?:1.8.0_241]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[?:1.8.0_241]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[?:1.8.0_241]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[?:1.8.0_241]
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) ~[?:1.8.0_241]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:1.8.0_241]
at java.net.Socket.connect(Socket.java:606) ~[?:1.8.0_241]
at org.apache.storm.thrift.transport.TSocket.open(TSocket.java:221) ~[storm-shaded-deps-2.2.0.jar:2.2.0]
at org.apache.storm.thrift.transport.TFramedTransport.open(TFramedTransport.java:91) ~[storm-shaded-deps-2.2.0.jar:2.2.0]
at org.apache.storm.security.auth.SimpleTransportPlugin.connect(SimpleTransportPlugin.java:101) ~[storm-client-2.2.0.jar:2.2.0]
at org.apache.storm.security.auth.TBackoffConnect.doConnectWithRetry(TBackoffConnect.java:48) ~[storm-client-2.2.0.jar:2.2.0]
at org.apache.storm.security.auth.ThriftClient.reconnect(ThriftClient.java:98) ~[storm-client-2.2.0.jar:2.2.0]
... 15 more
org.apache.storm.utils.NimbusLeaderNotFoundException: Could not find leader nimbus from seed hosts [localhost]. Did you specify a valid list of nimbus hosts for config nimbus.seeds?
at org.apache.storm.utils.NimbusClient.getConfiguredClientAs(NimbusClient.java:250)
at org.apache.storm.utils.NimbusClient.getConfiguredClientAs(NimbusClient.java:179)
at org.apache.storm.utils.NimbusClient.getConfiguredClient(NimbusClient.java:138)
at org.apache.storm.blobstore.NimbusBlobStore.prepare(NimbusBlobStore.java:47)
at org.apache.storm.utils.Utils.validateTopologyBlobStoreMap(Utils.java:1178)
at org.apache.storm.StormSubmitter.validateConfs(StormSubmitter.java:530)
at org.apache.storm.StormSubmitter.submitTopologyAs(StormSubmitter.java:236)
at org.apache.storm.StormSubmitter.submitTopology(StormSubmitter.java:210)
at org.apache.storm.StormSubmitter.submitTopology(StormSubmitter.java:173)
at org.apache.storm.topology.ConfigurableTopology.submit(ConfigurableTopology.java:119)
at org.apache.storm.starter.WordCountTopology.run(WordCountTopology.java:58)
at org.apache.storm.topology.ConfigurableTopology.start(ConfigurableTopology.java:68)
at org.apache.storm.starter.WordCountTopology.main(WordCountTopology.java:36)
Same Eclipse in Windows 10, Under a different eclipse project, For previous storm versions' code (Version 0.0.1) Zookeeper starts, nimbus starts fine. I am able to get the output.
I did not do any cluster configuration in local/eclipse.Success Topology with version 0.0.1

Not able to acsess existing MongoDb from Spring Boot App Deploy in Docker Container

I have been reading all sort of answers to connect my local MongoDB from Spring boot app which is deployed in Docker Container.
But I am getting below error:
2020-04-24 06:39:29.425 INFO 1 --- [ main] org.mongodb.driver.cluster : Adding discovered server 127.0.0.1:27017 to client view of cluster
2020-04-24 06:39:29.542 INFO 1 --- [127.0.0.1:27017] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server 127.0.0.1:27017
com.mongodb.MongoSocketOpenException: Exception opening socket
at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:67) ~[mongodb-driver-core-3.8.2.jar!/:na]
at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:126) ~[mongodb-driver-core-3.8.2.jar!/:na]
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:117) ~[mongodb-driver-core-3.8.2.jar!/:na]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_252]
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_252]
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_252]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_252]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_252]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_252]
at java.net.Socket.connect(Socket.java:607) ~[na:1.8.0_252]
at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:64) ~[mongodb-driver-core-3.8.2.jar!/:na]
at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:62) ~[mongodb-driver-core-3.8.2.jar!/:na]
... 3 common frames omitted
2020-04-24 06:39:30.833 INFO 1 --- [ main] pertySourcedRequestMappingHandlerMapping : Mapped URL path [/v2/api-docs] onto method [public org.springframework.http.ResponseEntity<springfox.documentation.spring.web.json.Json> springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)]
If I run this spring boot app out of docker container, it works fine.
But from inside docker container its not able to access my mongoDB which is outside of docker container.
This how I am running docker container:
docker build -f .\Dockerfile -t dockerspringboot .
docker run -p 8085:8080 dockerspringboot
This is my Dockerfile:
FROM openjdk:8
ADD build/libs/SpringBoot-1.0.jar SpringBoot-1.0.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "SpringBoot-1.0.jar"]
-I tried changing ipaddress to 0.0.0.0 and 127.0.0.1, but of no use.
-I tried changing mondod.conf with below commented/uncommented options:
# network interfaces
net:
#port: 27017
bindIp: 0.0.0.0
# bindIpAll: true
# bindIp: 127.0.0.1
-I tried changing firewall settings to allow all programs access to docker backend process as well.
Also tried changing local ipaddresses by using ipconfig command but still no luck.
You should specify the authorizations to access the database if they exist, try this :
spring.data.mongodb.authentication-database=admin
spring.data.mongodb.database=app1
spring.data.mongodb.host=host.docker.internal
spring.data.mongodb.port=27017
spring.data.mongodb.password=PASSWORD
spring.data.mongodb.username=USERNAME
Add --network="host" to your docker run command. Then your docker container is able to access localhost:27017

Mongo DB Canonical address does not match server address

I am connecting my spring boot application with mongo db.
The code is working fine on local environment where the db has a single node and not running in cluster mode.
But when the db is running on staging environment with cluster mode and a single node and 1 replica set, the spring application shows the following error:
INFO | | | 2019-04-18 12:43:25 | [cluster-ClusterId{value='5cb823951a734cea7f7eebe1', description='null'}-10.202.41.254:27017] com.mongodb.diagnostics.logging.SLF4JLogger - Canonical address educationelasticsearch-digital-v1-41-254:27017 does not match server address. Removing 10.20.41.254:27017 from client view of cluster
INFO | | | 2019-04-18 12:43:25 | [cluster-ClusterId{value='5cb823951a734cea7f7eebe1', description='null'}-educationelasticsearch-digital-v1-41-254:27017] com.mongodb.diagnostics.logging.SLF4JLogger - Exception in monitor thread while connecting to server educationelasticsearch-digital-v1-41-254:27017
com.mongodb.MongoSocketException: educationelasticsearch-digital-v1-41-254: nodename nor servname provided, or not known
at com.mongodb.ServerAddress.getSocketAddress(ServerAddress.java:188) ~[mongodb-driver-core-3.8.2.jar:?]
at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:64) ~[mongodb-driver-core-3.8.2.jar:?]
at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:62) ~[mongodb-driver-core-3.8.2.jar:?]
at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:126) ~[mongodb-driver-core-3.8.2.jar:?]
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:117) [mongodb-driver-core-3.8.2.jar:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_171]
Caused by: java.net.UnknownHostException: educationelasticsearch-digital-v1-41-254: nodename nor servname provided, or not known
at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) ~[?:1.8.0_171]
at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928) ~[?:1.8.0_171]
at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323) ~[?:1.8.0_171]
at java.net.InetAddress.getAllByName0(InetAddress.java:1276) ~[?:1.8.0_171]
at java.net.InetAddress.getAllByName(InetAddress.java:1192) ~[?:1.8.0_171]
at java.net.InetAddress.getAllByName(InetAddress.java:1126) ~[?:1.8.0_171]
at java.net.InetAddress.getByName(InetAddress.java:1076) ~[?:1.8.0_171]
at com.mongodb.ServerAddress.getSocketAddress(ServerAddress.java:186) ~[mongodb-driver-core-3.8.2.jar:?]
... 5 more
In both the case, application properties are same except the change in IP of staging server in place of localhost:
spring.elasticsearch.education.hostname=localhost // staging server IP
spring.elasticsearch.education.scheme=http
spring.elasticsearch.education.port=9200
###### Mongo properties ########
spring.data.mongodb.host=localhost //staging server ip
spring.data.mongodb.port=27017
spring.data.mongodb.database=ddddd
spring.data.mongodb.authentication-database=admin
spring.data.mongodb.username=root
spring.data.mongodb.password=root
spring.data.mongodb.repositories.enabled=true
logging.level.org.springframework.data.mongodb.core.MongoTemplate=DEBUG
I checked this question but not much resolution in this.
Please suggest what's wrong here?
Look here https://stackoverflow.com/a/34373673/5712629.
Maybe spring.data.mongodb.host and spring.data.mongodb.port are not supported in this version of mongodb driver.
You could try:
spring.data.mongodb.uri=mongodb://root:root#localhost:27017
instead.

Kafka Connect Debezium postgres

I am trying to connect a Postgres SQL db hosted in Amazon RDS with a Kafka topic using Debezium.
I am following the following tutorial :
http://debezium.io/docs/tutorial/
My kafka and kafka connect services start up fine and the kafka connect service also picks up my debezium postgres connector jars in /usr/share/java dir.
However on trying to attach the postgres config json via the kafka connect API using the following curl command :
curl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" localhost:8083/connectors/ -d #connector1.json
I end up getting the following error:
[2018-06-13 23:45:44,749] ERROR Uncaught exception in REST call to /connectors/ (org.apache.kafka.connect.runtime.rest.errors.ConnectExceptionMapper:61)
org.apache.kafka.connect.errors.ConnectException: Could not intialize type registry
at io.debezium.connector.postgresql.connection.PostgresConnection.<init>(PostgresConnection.java:68)
at io.debezium.connector.postgresql.PostgresConnector.validate(PostgresConnector.java:95)
at org.apache.kafka.connect.runtime.AbstractHerder.validateConnectorConfig(AbstractHerder.java:277)
at org.apache.kafka.connect.runtime.distributed.DistributedHerder$6.call(DistributedHerder.java:534)
at org.apache.kafka.connect.runtime.distributed.DistributedHerder$6.call(DistributedHerder.java:531)
at org.apache.kafka.connect.runtime.distributed.DistributedHerder.tick(DistributedHerder.java:267)
at org.apache.kafka.connect.runtime.distributed.DistributedHerder.run(DistributedHerder.java:216)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.postgresql.util.PSQLException: The connection attempt failed.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:275)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:194)
at org.postgresql.Driver.makeConnection(Driver.java:431)
at org.postgresql.Driver.connect(Driver.java:247)
at io.debezium.jdbc.JdbcConnection.lambda$patternBasedFactory$1(JdbcConnection.java:161)
at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:585)
at io.debezium.connector.postgresql.connection.PostgresConnection.<init>(PostgresConnection.java:65)
... 11 more
Caused by: java.net.SocketTimeoutException: connect timed out
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.postgresql.core.PGStream.<init>(PGStream.java:62)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:144)
... 18 more
Could some please advice on the exception and how to resolve it?
Is there a property/configuratuion that I may be missing here?
Do you have postgres database port configured to be accessible from outside?
IIRC RDS database uses SSL for connection so it might be necessary to configure SSL also in postgres connector.