Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readWriteSplitting plugin is unable to connect to reader host if enabled iam authentication #1253

Open
smaliebsco opened this issue Jan 22, 2025 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@smaliebsco
Copy link

Describe the bug

readWriteSplitting plugin works fine with master username and password but fails to connect reader instance with IAM authentication plugging. It falls back to the writer's instance and the application works by redirecting all the queries to writer's instance

Getting error as

    The plugin was unable to establish a reader connection to any reader instance.
    Failed to switch to a reader. The plugin was unable to establish a reader connection to any reader instance.. The current writer will be used as a fallback

I am using Spring and below are the datasource configs:

    hikari:
      data-source-properties:
        autoSortWrapperPluginOrder: true
        wrapperPlugins: iam,readWriteSplitting,failover,efm,auroraConnectionTracker,initialConnection
        wrapperDialect: aurora-mysql
        readerHostSelectorStrategy: random # is configured only for internal pooling
        readerInitialConnectionHostSelectorStrategy: random
        dynamicHostListProvider: com.amazonaws.jdbc.AwsWrapperDataSource

and using the @Trasactional(readOnly=true)

It seems I have the right policy configured for IAM authenticate rds-connect as its able to establish the connection with writer intance.

Expected Behavior

It should be able to connect to reader instances and redirect queries to the reader

What plugins are used? What other connection properties were set?

iam,readWriteSplitting,failover,efm,auroraConnectionTracker,initialConnection

Current Behavior

The plugin was unable to establish a reader connection to any reader instance.

Failed to switch to a reader. The plugin was unable to establish a reader connection to any reader instance.. The current writer will be used as a fallback

"software.amazon.jdbc.plugin.readwritesplitting.ReadWriteSplittingPlugin","message":"Failed to switch to a reader. The plugin was unable to establish a reader connection to any reader instance.. The current writer will be used as a fallback:

Reproduction Steps

configure the iam, and readwritesplit plugin with 1 reader and 1 writer instance and try to redirect to the reader using the annotation

@transactional(readOnly=true)

Possible Solution

No response

Additional Information/Context

No response

The AWS Advanced JDBC Driver version used

2.5.4

JDK version used

17

Operating System and version

Docker

@smaliebsco smaliebsco added the bug Something isn't working label Jan 22, 2025
@smaliebsco
Copy link
Author

With these plugins its working fine:
iam,readWriteSplitting,failover,efm2

@aaron-congo
Copy link
Contributor

Hi @smaliebsco,

Thanks for reaching out and raising this issue. We'll take a look at this and keep you updated as we investigate. Thank you for your patience!

@karenc-bq karenc-bq self-assigned this Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants