0

概述

我参考本教程https://docs.aws.amazon.com/dms/latest/sbs/CHAP_RDSOracle2Redshift.html学习将 Amazon RDS for Oracle Database 迁移到 Amazon Redshift

麻烦

我在下面的问题上遇到了麻烦。 我想使用 AWS SCT 将 Oralce DB 迁移到 Amazon Redshift

在人们的帮助下,我设法摆脱了困境。然而,我遇到了新的麻烦。我尝试使用 AWS SCT 连接到 Amazon Redshift。AWS Redshift 无法连接。 图片

我看到了日志文件。日志中记录了一个错误。

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

我尝试什么

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

我认为上述错误与问题相似。因此,我启动了安全组控制台并添加了 [Rule: Type=Redshift, Source=MyIP]。

我保存了它并尝试再次连接。不幸的是,AWS Redshift 无法连接并出现同样的错误。我不知道下次要做什么。我该做什么?

4

1 回答 1

0

要解决此问题,您可以使用以下步骤;

(1) 为了更快地排除故障,您可以使用 ping 命令从您的主机/机器/笔记本电脑/桌面检查网络可达性,而不是您的 java 应用程序。

(2) 如果第一步成功,则尝试使用 Windows 命令提示符或 Windows PowerShell 或任何 Linux shell/命令行工具在您的主机/机器/笔记本电脑/桌面上执行以下命令;

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

或者

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

(3) 如果步骤 (1) 或 (2) 中的命令因“连接超时”错误而失败,则

(3.1) 使用VPC 可达性分析器:使用源类型网络接口和源作为部署应用程序的机器的网络接口 ID 创建和分析路径。此外,选择目标类型作为网络接口和目标作为 AWS Red Shift 的网络接口 ID。将目标端口设置为 5439,将协议保持为 TCP。 注意:完成此路径分析需要几分钟时间。

或者

(3.2) 如果您启用了 VPC 流日志,那么您可以跟踪 vpc 流日志以检查哪个 AWS 资源拒绝了网络流量。有关 VPC 流日志信息,请参阅AWS 的文档。

于 2020-12-31T12:57:39.477 回答