Я развертываю тестовое приложение Springboot на AWS ECS Fargate. Для этого я использую PostgreSQL в качестве постоянного слоя. VP C, используемый для Приложения ECS и DB, одинаков. Я получаю ошибку соединения, которую не могу понять, почему. Вот журнал.
2020-04-13 01:39:05.986 ERROR 1 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 -
Exception during pool initialization.
01:39:05
org.postgresql.util.PSQLException: The connection attempt failed.
01:39:05
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:292) ~
[postgresql-42.2.6.jar!/:42.2.6]
01:39:05
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49) ~[postgresql-
42.2.6.jar!/:42.2.6]
01:39:05
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:195) ~[postgresql-42.2.6.jar!/:42.2.6]
01:39:05
at org.postgresql.Driver.makeConnection(Driver.java:458) ~[postgresql-42.2.6.jar!/:42.2.6]
01:39:05
at org.postgresql.Driver.connect(Driver.java:260) ~[postgresql-42.2.6.jar!/:42.2.6]
01:39:05
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:136) ~[HikariCP-
3.2.0.jar!/:na]
01:39:05
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:369) ~[HikariCP-3.2.0.jar!/:na]
01:39:05
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:198) ~[HikariCP-3.2.0.jar!/:na]
01:39:05
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:467) ~[HikariCP-3.2.0.jar!/:na]
01:39:05
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:541) ~[HikariCP-3.2.0.jar!/:na]
01:39:05
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) ~[HikariCP-3.2.0.jar!/:na]
01:39:05
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-
3.2.0.jar!/:na]
01:39:05
at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:157) ~
[spring-jdbc-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
01:39:05
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:115) ~
[spring-jdbc-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
01:39:05
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:78) ~
[spring-jdbc-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
01:39:05
at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:319) ~[spring-
jdbc-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
01:39:05
at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:356) ~[spring-
jdbc-5.1.9.RELEASE.jar!/:5.1.9.RELEASE]
01:39:05
at org.springframework.boot.autoconfigure.orm.jpa.DatabaseLookup.getDatabase(DatabaseLookup.java:73)
~[spring-boot-autoconfigure-2.1.7.RELEASE.jar!/:2.1.7.RELEASE]
Мой application.properties
выглядит следующим образом
# default connection pool
spring.datasource.hikari.connectionTimeout=20000
spring.datasource.hikari.maximumPoolSize=5
# Create the tables and drop them at the end of the session
spring.datasource.driverClassName=org.postgresql.Driver
spring.datasource.url=jdbc:postgresql://database-2.<DBId>.eu-west-1.rds.amazonaws.com:5432/database-2
spring.datasource.username=postgres
spring.datasource.password=<PASSWORD>
spring.jpa.show-sql=true
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQL95Dialect
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false
Для конфигурации сети этот репозиторий используется в качестве базы. Кроме того, я вручную создал экземпляр RDS в том же VP C, который уже был создан, и добавил дополнительную конфигурацию БД.