簡體   English   中英

使用 MuleSoft RTF EKS 訪問 AWS 數據庫

[英]Access AWS DB using MuleSoft RTF EKS

MuleSoft 版本:4.3.0 AWS-RTF EKS DB:AWS RDS (Aurora MySQL) 5.7

能夠從 anypoint studio 成功連接到 AWS DB,但無法從 RTF EKS Pod 連接。

org.mule.runtime.api.connection.ConnectionException: Could not obtain connection from data source
Caused by: org.mule.db.commons.shaded.api.exception.connection.ConnectionCreationException: Could not obtain connection from data source
Caused by: org.mule.runtime.extension.api.exception.ModuleException: java.sql.SQLException: Cannot get connection for URL jdbc:mysql://<host>:3306/DBNAME?verifyServerCertificate=false&useSSL=true&requireSSL=true : Communications link failure

The last packet successfully received from the server was 99 milliseconds ago. The last packet sent successfully to the server was 94 milliseconds ago.
Caused by: java.sql.SQLException: Cannot get connection for URL jdbc:mysql://<host>:3306/DBNAME?verifyServerCertificate=false&useSSL=true&requireSSL=true : Communications link failure

我可以通過使用 --image=mysql:5.7 創建一個默認 pod 從 EKS 訪問數據庫。 但不是來自 MuleSoft App。

嘗試過的用例:

 1. verifyServerCertificate=false&useSSL=true&requireSSL=true
 2. verifyServerCertificate=true&useSSL=true&requireSSL=true. (passing truststore in java arguments )

 -Djavax.net.ssl.trustStore=/opt/mule/apps/test-rds/mySqlKeyStore.jks 
 -Djavax.net.ssl.trustStoreType=JKS 
 -Djavax.net.ssl.trustStorePassword=xxxxxx
 (Generated jks file from .pem file using below commands)

openssl x509 -outform der -in us-west-2-bundle.pem -out us-west-2-bundle.der
keytool -import -alias mysql -keystore mySqlKeyStore -file us-west-2-bundle.der

我在這里還缺少什么? 請幫忙

我相信您不能更改在 Anypoint Runtime Fabric 中部署的應用程序的默認 Java 信任庫或密鑰庫。 這可能適用於部署在 Studio 或本地 Mule 運行時中的應用程序。 Runtime Fabric 是一個容器化環境,您無法在其中更改運行時的默認值。 相反,您應該查看是否有適合您的數據庫的連接器,該連接器允許在應用程序內部的連接器級別配置信任庫和密鑰庫。

我能夠解決這個問題。

通過添加這個 jvm 參數,我知道它與 ssl 握手有關。 - M-Djavax.net.debug=ssl

它給出了這樣的調試日志

javax.net.ssl|SEVERE|43|[MuleRuntime].uber.03: [test-rds].uber@org.mule.runtime.module.extension.internal.runtime.config.LifecycleAwareConfigurationInstance.testConnectivity:179 @3781e9a3|2021-12-23 09:55:53.715 PST|TransportContext.java:316|Fatal (HANDSHAKE_FAILURE): Couldn't kickstart handshaking (
"throwable" : {
javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
enter code here

在經歷了這個問題之后,很明顯我需要通過enabledTLSProtocols=TLSv1.2

為什么在最新的JDK更新后Java無法連接到MySQL 5.7,應該如何解決? (ssl.SSLHandshakeException:沒有合適的協議)

所以這是我在 DB Config 中傳遞的參數

<db:connection-properties >                 
                <db:connection-property key="verifyServerCertificate" value="false" />
                <db:connection-property key="useSSL" value="true" />
                <db:connection-property key="requireSSL" value="true" />
                <db:connection-property key="enabledTLSProtocols" value="TLSv1.2" />
            </db:connection-properties>
enter code here

即使添加了 enabledTLSProtocols 標志,如果您收到錯誤,請確保數據庫版本正確(我遇到了非產品和產品問題)

非產品:MySQL 5.7 工作正常

產品:即使啟用了 TLSProtocols,MySQL 5.6 也無法正常工作。 我必須將 DB 更新到 5.7 才能正常工作

謝謝,希望對某人有所幫助

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM