treasure-data / digdag

Workload Automation System
https://www.digdag.io/
Apache License 2.0
1.31k stars 221 forks source link

Base Issue: #1363 Unable to connect with Postgres Database #1619

Closed revanna7226 closed 3 years ago

revanna7226 commented 3 years ago

@hiroyuki-sato, Hope you are doing great!

I have used tried to interface Digdag with Postgresql. Digdag and Postgres are installed on two different Linux Servers. I followed your procedure below to create database for Digdag. $ psql -h host -U super_user -d postgres postgres=# CREATE ROLE digdag WITH PASSWORD 'digdagpass' NOSUPERUSER NOCREATEDB NOCREATEROLE LOGIN; CREATE ROLE -- worked fine postgres=# CREATE DATABASE digdag_db WITH OWNER digdag; CREATE DATABASE -- worked fine postgres=# CREATE EXTENSION "uuid-ossp"; CREATE EXTENTION -- Did not work. ERROR: could not open extension control file "/usr/pgsql-13/share/extension/uuid-ossp.control": No such file or directory

I ignored the installation of "uuid-ossp" and set up the postgres configurations in server.properties file of Digdag.

Secret key also added.

But while running the server Digdag ending up with the below error. Jul 27 15:30:55 melcoq1.localdomain java[6190]: while locating io.digdag.core.agent.TaskCallbackApi Jul 27 15:30:55 melcoq1.localdomain java[6190]: Caused by: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: The authentication type 10 is not supported. Check that you have configured the pg_hba.conf file to include the client's IP address or subnet, and that it is using an authentication scheme supported by the driver.

Could you please help me why is this?

Thanks and Regards, Revanna

Originally posted by @revanna7226 in https://github.com/treasure-data/digdag/issues/1363#issuecomment-887447084

hiroyuki-sato commented 3 years ago

Hello, @revanna7226

It seems that your environment doesn't install uuid-ossp plugin. Maybe, you need to install postgresql13-contrib. (ex. yum install postgresql13-contrib) Could you try to install the contrib, restart PostgreSQL and execute CREATE EXTENSION "uuid-ossp"; again?

What OS are you using?

revanna7226 commented 3 years ago

@hiroyuki-sato,

Thanks for your quick reply. OS is RHEL 7.3 Beta.

And I will install postgresql13-contrib and try once again.

Thanks and Regards, Revanna

revanna7226 commented 3 years ago

Hi @hiroyuki-sato ,

I have installed postgresql13-contrib and created uuid-ossp extension in the postgres server.

But, even after on running digdag server. I'm facing the same error.

/opt/digdag/server.properties server.bind = 0.0.0.0 server.port = 8083 server.access-log.path = /opt/digdag/logs/access log-server.type = local log-server.local.path = /opt/digdag/logs/task

database.type = h2

database.path = /opt/digdag/database

database.type = postgresql database.user = digdag database.password = digdagpass database.host = database.port = 5432 database.database = digdag_db digdag.secret-encryption-key = YW55MTZieXRlc3BocmFzZQ==

[root@system01 opt]# digdag server --log /opt/digdag/logs/server/server.log --config /opt/digdag/server.properties 2021-07-28 11:27:48 +0800: Digdag v0.9.42 error: com.google.inject.CreationException: Unable to create injector, see the following errors:

1) Error in custom provider, com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: The authentication type 10 is not supported. Check that you have configured the pg_hba.conf file to include the client's IP address or subnet, and that it is using an authentication scheme supported by the driver. while locating io.digdag.core.database.DataSourceProvider at io.digdag.core.database.DatabaseModule.configure(DatabaseModule.java:30) (via modules: com.google.inject.util.Modules$OverrideModule -> io.digdag.core.database.DatabaseModule) while locating javax.sql.DataSource Caused by: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: The authentication type 10 is not supported. Check that you have configured the pg_hba.conf file to include the client's IP address or subnet, and that it is using an authentication scheme supported by the driver. at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:516) at com.zaxxer.hikari.pool.HikariPool.(HikariPool.java:118) at com.zaxxer.hikari.HikariDataSource.(HikariDataSource.java:71) at io.digdag.core.database.DataSourceProvider.createPooledDataSource(DataSourceProvider.java:98) at io.digdag.core.database.DataSourceProvider.get(DataSourceProvider.java:41) at io.digdag.core.database.DataSourceProvider.get(DataSourceProvider.java:17) at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:85) at com.google.inject.internal.BoundProviderFactory.provision(BoundProviderFactory.java:77) at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:59) at com.google.inject.internal.BoundProviderFactory.get(BoundProviderFactory.java:61) at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) at com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:168) at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:39) at com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:211) at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:182) at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109) at com.google.inject.Guice.createInjector(Guice.java:87) at org.embulk.guice.Bootstrap.start(Bootstrap.java:168) at org.embulk.guice.Bootstrap.build(Bootstrap.java:130) at org.embulk.guice.Bootstrap.initializeCloseable(Bootstrap.java:125) at io.digdag.guice.rs.server.undertow.UndertowBootstrap.initialize(UndertowBootstrap.java:70) at io.digdag.guice.rs.GuiceRsServletContainerInitializer.processBootstrap(GuiceRsServletContainerInitializer.java:61) at io.digdag.guice.rs.GuiceRsServletContainerInitializer.onStartup(GuiceRsServletContainerInitializer.java:36) at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:186) at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:171) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42) at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:234) at io.digdag.guice.rs.server.undertow.UndertowServer.start(UndertowServer.java:179) at io.digdag.server.ServerBootstrap.start(ServerBootstrap.java:81) at io.digdag.cli.Server.startServer(Server.java:136) at io.digdag.cli.Server.main(Server.java:100) at io.digdag.cli.Main.cli(Main.java:191) at io.digdag.cli.Main.main(Main.java:83) Caused by: org.postgresql.util.PSQLException: The authentication type 10 is not supported. Check that you have configured the pg_hba.conf file to include the client's IP address or subnet, and that it is using an authentication scheme supported by the driver. at org.postgresql.Driver$ConnectThread.getResult(Driver.java:358) at org.postgresql.Driver.connect(Driver.java:282) at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:95) at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:316) at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:506) ... 33 more

Could you please help me to resolve this?

Thanks and Regards, Revanna

hiroyuki-sato commented 3 years ago

Hello, @revanna7226 Could you search The authentication type 10 is not supported.? It seems that you need to change the encryption algorithm. https://stackoverflow.com/a/64336274/6577569

revanna7226 commented 3 years ago

Hi @hiroyuki-sato,

Thanks for your suggestions. I followed the settings from https://stackoverflow.com/a/64336274/6577569 It is working fine now.

Thanks and Regards, Revanna