简体   繁体   English

AWS Redshift 连接失败 [错误设置/关闭连接:连接超时]

[英]AWS Redshift failed connect [Error setting/closing connection: Connection timed out]

Overview概述

I learn to migrate an Amazon RDS for Oracle Database to Amazon Redshift referring this tutorial https://docs.aws.amazon.com/dms/latest/sbs/CHAP_RDSOracle2Redshift.html我参考本教程https://docs.aws.amazon.com/dms/latest/sbs/CHAP_RDSOracle2Redshift.ZFC356FDC70D2FC4B6A7110B50D807BADE5Z://docs.aws.amazon.com/dms/latest/sbs/CHAP_RDSOracle2Redshift.ZFC356FDC70D22267D

Trouble麻烦

I had a trouble the below question.我在下面的问题上遇到了麻烦。 I would like migrate Oralce DB to Amazon Redshift with AWS SCT 我想使用 AWS SCT 将 Oralce DB 迁移到 Amazon Redshift

I managed to get out of trouble with the help of people.在人们的帮助下,我设法摆脱了困境。 However, I had a new trouble.然而,我遇到了新的麻烦。 I try to connect to Amazon Redshift with AWS SCT.我尝试使用 AWS SCT 连接到 Amazon Redshift。 AWS Redshift failed to connect. AWS Redshift 无法连接。 images图片

I saw the log file.我看到了日志文件。 An error was recorded in the log.日志中记录了一个错误。

2020-12-31 20:56:16.358 [  78]      LOADER ERROR   Connection to 'jdbc:redshift://oracletoredshiftdwusingdms-redshiftcluster-1dll5wg4tqddk.cnxpo3loreqp.us-east-1.redshift.amazonaws.com:5439/test' wasn't established. ERROR: code: 500150; message: [Amazon](500150) Error setting/closing connection: Connection timed out: connect.
2020-12-31 20:56:16.358 [  78]      LOADER ERROR   Error chain:
[Amazon](500150) Error setting/closing connection: Connection timed out: connect.
------------------------------
java.sql.SQLException: [Amazon](500150) Error setting/closing connection: Connection timed out: connect.
    at com.amazon.redshift.client.PGClient.connect(Unknown Source)
    at com.amazon.redshift.client.PGClient.<init>(Unknown Source)
    at com.amazon.redshift.core.PGJDBCConnection.connect(Unknown Source)
    at com.amazon.jdbc.common.BaseConnectionFactory.doConnect(Unknown Source)
    at com.amazon.jdbc.common.AbstractDriver.connect(Unknown Source)
    at com.amazon.sct.dbloader.JdbcDriverAdapter.connect(JdbcDriverAdapter.java:30)
    at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
    at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:189)
    at com.amazon.sct.dbloader.DbLoaderDataSource.testConnection(DbLoaderDataSource.java:109)
    at com.amazon.sct.dbloader.SqlLoaderEngine.testConnection(SqlLoaderEngine.java:1706)
    at com.amazon.sct.dbloader.DbLoader.checkConnection(DbLoader.java:706)
    at com.amazon.sct.dbloader.DbLoader.connect(DbLoader.java:406)
    at com.amazon.sct.dbloader.DbLoaderContainer.checkAccessibility(DbLoaderContainer.java:30)
    at com.amazon.sct.task.TestConnectionTask.call(TestConnectionTask.java:40)
    at com.amazon.sct.task.TestConnectionTask.call(TestConnectionTask.java:18)
    at javafx.concurrent.Task$TaskCallable.call(Task.java:1425)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
Caused by: com.amazon.support.exceptions.GeneralException: [Amazon](500150) Error setting/closing connection: Connection timed out: connect.
    ... 17 more
Caused by: java.net.ConnectException: Connection timed out: connect
    at java.base/sun.nio.ch.Net.connect0(Native Method)
    at java.base/sun.nio.ch.Net.connect(Net.java:476)
    at java.base/sun.nio.ch.Net.connect(Net.java:468)
    at java.base/sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:694)
    at java.base/sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:100)
    at com.amazon.redshift.client.PGClient.connect(Unknown Source)
    at com.amazon.redshift.client.PGClient.<init>(Unknown Source)
    at com.amazon.redshift.core.PGJDBCConnection.connect(Unknown Source)
    at com.amazon.jdbc.common.BaseConnectionFactory.doConnect(Unknown Source)
    at com.amazon.jdbc.common.AbstractDriver.connect(Unknown Source)
    at com.amazon.sct.dbloader.JdbcDriverAdapter.connect(JdbcDriverAdapter.java:30)
    at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
    at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:189)
    at com.amazon.sct.dbloader.DbLoaderDataSource.testConnection(DbLoaderDataSource.java:109)
    at com.amazon.sct.dbloader.SqlLoaderEngine.testConnection(SqlLoaderEngine.java:1706)
    at com.amazon.sct.dbloader.DbLoader.checkConnection(DbLoader.java:706)
    at com.amazon.sct.dbloader.DbLoader.connect(DbLoader.java:406)
    at com.amazon.sct.dbloader.DbLoaderContainer.checkAccessibility(DbLoaderContainer.java:30)
    at com.amazon.sct.task.TestConnectionTask.call(TestConnectionTask.java:40)
    at com.amazon.sct.task.TestConnectionTask.call(TestConnectionTask.java:18)
    at javafx.concurrent.Task$TaskCallable.call(Task.java:1425)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.lang.Thread.run(Thread.java:834)

2020-12-31 20:56:16.359 [  78]     GENERAL INFO    Test connecting to Amazon Redshift database finished in 0:00:21.113 sec with memory consumption of 516.25 MB (497.79 MB .. 516.25 MB).
2020-12-31 20:56:16.359 [  78]     GENERAL INFO    Test connecting to Amazon Redshift database statistics:
    GENERAL: 0:00:21.113 sec
2020-12-31 20:56:16.365 [  19]     GENERAL ERROR   com.amazon.sct.dbloader.DbLoaderHandledException: Connection wasn't established. Check connection properties.
java.util.concurrent.ExecutionException: com.amazon.sct.dbloader.DbLoaderHandledException: Connection wasn't established. Check connection properties.
    at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
    at com.amazon.sct.task.launcher.CommonTaskLauncher.lambda$run$0(CommonTaskLauncher.java:39)
    at com.sun.javafx.binding.ExpressionHelper$Generic.fireValueChangedEvent(ExpressionHelper.java:360)
    at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
    at javafx.beans.property.ObjectPropertyBase.fireValueChangedEvent(ObjectPropertyBase.java:106)
    at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:113)
    at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:147)
    at javafx.concurrent.Task.setState(Task.java:698)
    at javafx.concurrent.Task$TaskCallable.lambda$call$2(Task.java:1455)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
    at com.sun.glass.ui.win.WinApplication._enterNestedEventLoopImpl(Native Method)
    at com.sun.glass.ui.win.WinApplication._enterNestedEventLoop(WinApplication.java:201)
    at com.sun.glass.ui.Application.enterNestedEventLoop(Application.java:509)
    at com.sun.glass.ui.EventLoop.enter(EventLoop.java:107)
    at com.sun.javafx.tk.quantum.QuantumToolkit.enterNestedEventLoop(QuantumToolkit.java:635)
    at javafx.stage.Stage.showAndWait(Stage.java:465)
    at javafx.scene.control.HeavyweightDialog.showAndWait(HeavyweightDialog.java:162)
    at javafx.scene.control.Dialog.showAndWait(Dialog.java:346)
    at com.amazon.sct.handler.CreateConnectionHandler.createConnection(CreateConnectionHandler.java:51)
    at com.amazon.sct.viewmodel.AppViewModel.createConnection(AppViewModel.java:1406)
    at com.amazon.sct.viewmodel.AppViewModel.createTargetConnection(AppViewModel.java:774)
    at com.amazon.sct.view.AppView.loadTarget(AppView.java:348)
    at com.amazon.sct.view.AppView.lambda$initConnectionMenusBindings$27(AppView.java:1077)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
    at javafx.event.Event.fireEvent(Event.java:198)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3862)
    at javafx.scene.Scene.processMouseEvent(Scene.java:1849)
    at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2590)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:409)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:299)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:447)
    at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:412)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:446)
    at com.sun.glass.ui.View.handleMouseEvent(View.java:556)
    at com.sun.glass.ui.View.notifyMouse(View.java:942)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.amazon.sct.dbloader.DbLoaderHandledException: Connection wasn't established. Check connection properties.
    at com.amazon.sct.dbloader.DbLoader.checkConnection(DbLoader.java:721)
    at com.amazon.sct.dbloader.DbLoader.connect(DbLoader.java:406)
    at com.amazon.sct.dbloader.DbLoaderContainer.checkAccessibility(DbLoaderContainer.java:30)
    at com.amazon.sct.task.TestConnectionTask.call(TestConnectionTask.java:40)
    at com.amazon.sct.task.TestConnectionTask.call(TestConnectionTask.java:18)
    at javafx.concurrent.Task$TaskCallable.call(Task.java:1425)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    ... 1 more

What I try我尝试什么

[Amazon](500150) Error setting/closing connection: Connection timed out: connect.

I think the above error is similar to the issues .我认为上述错误与问题相似。 So, I launched the Security Groups console and add [Rule: Type=Redshift, Source=MyIP].因此,我启动了安全组控制台并添加了 [Rule: Type=Redshift, Source=MyIP]。

I saved it and I try to connect again.我保存了它并尝试再次连接。 Unfortunately, AWS Redshift failed to connect with same error.不幸的是,AWS Redshift 无法连接并出现同样的错误。 I have no idea to do next time.我不知道下次要做什么。 What I should do?我该做什么?

To troubleshoot this issue, you can use following steps;要解决此问题,您可以使用以下步骤;

(1) To troubleshoot faster, instead of your java application, you can use ping command to check network reachability from your host/machine/laptop/desktop. (1) 为了更快地排除故障,您可以使用 ping 命令从您的主机/机器/笔记本电脑/台式机检查网络可达性,而不是您的 java 应用程序。

(2) If step one is successful, then try following commands on your host/machine/laptop/desktop using Windows command prompt or Windows PowerShell or Any Linux shell/command line tool; (2) If step one is successful, then try following commands on your host/machine/laptop/desktop using Windows command prompt or Windows PowerShell or Any Linux shell/command line tool;

nc -vz -w 3 "${DB_HOST}" "${DB_PORT}" nc -vz -w 3 "${DB_HOST}" "${DB_PORT}"

OR或者

telnet "${DB_HOST}" "${DB_PORT}"远程登录 "${DB_HOST}" "${DB_PORT}"

(3) If commands from step (1) or (2) are failing with "Connection timed out" error, then (3) 如果步骤 (1) 或 (2) 中的命令因“连接超时”错误而失败,则

(3.1) Use VPC Reachability Analyzer : Create and analyze path with Source type Network Interfaces and Source as Network Interface Id of the machine where you application is deployed. (3.1) 使用VPC 可达性分析器:使用源类型网络接口和源作为部署应用程序的机器的网络接口 ID 创建和分析路径。 Furthermore, select Destination type as Network Interfaces and Destination as network Interface Id of the AWS Red Shift.此外,select 目标类型为网络接口,目标为 AWS Red Shift 的网络接口 ID。 Put Destination port as 5439, keep Protocol as TCP.将目标端口设置为 5439,将协议保留为 TCP。 Note : It takes few minutes for completion of this path analysis.注意:完成此路径分析需要几分钟时间。

OR或者

(3.2) If you have enabled VPC Flow Logs, then you can trace vpc flow logs to check, which AWS resource is rejecting the network traffic. (3.2) 如果您启用了 VPC 流日志,那么您可以跟踪 vpc 流日志以检查哪个 AWS 资源拒绝了网络流量。 For VPC flow logs information please refer this document from AWS.有关 VPC 流日志信息,请参阅 AWS 的文档。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM