2

我想从 oracle 创建一个原始源。所以我选择作为origin oracle cdc。然后我配置了每个参数:

  • 架构名称

  • 桌子

  • 用户名

  • 密码

  • JDBC 连接字符串

    但是当我运行该过程时,我发现我的日志:

2017-08-22 11:07:22,447 test/testb156f588-dbd7-4e4c-8896-caf658d14d77   ERROR   Error while connecting to DB

com.streamsets.pipeline.api.StageException: JDBC_06 - Failed to initialize connection pool: java.lang.RuntimeException: Unable to get driver instance for jdbcUrl=jdbc:oracle:thin:@(DESCRIPTION =
(ENABLE=BROKEN)
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = myport))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl.WORLD)))
    at com.streamsets.pipeline.lib.jdbc.JdbcUtil.createDataSourceForRead(JdbcUtil.java:638)
    at com.streamsets.pipeline.stage.origin.jdbc.cdc.oracle.OracleCDCSource.init(OracleCDCSource.java:643)
    at com.streamsets.pipeline.api.base.BaseStage.init(BaseStage.java:52)
    at com.streamsets.pipeline.configurablestage.DStage.init(DStage.java:40)
    at com.streamsets.datacollector.runner.StageRuntime.init(StageRuntime.java:156)
    at com.streamsets.datacollector.runner.StagePipe.init(StagePipe.java:105)
    at com.streamsets.datacollector.runner.StagePipe.init(StagePipe.java:53)
    at com.streamsets.datacollector.runner.Pipeline.initPipe(Pipeline.java:299)
    at com.streamsets.datacollector.runner.Pipeline.init(Pipeline.java:214)
    at com.streamsets.datacollector.execution.runner.common.ProductionPipeline.run(ProductionPipeline.java:96)
    at com.streamsets.datacollector.execution.runner.common.ProductionPipelineRunnable.run(ProductionPipelineRunnable.java:79)
    at com.streamsets.datacollector.execution.runner.standalone.StandaloneRunner.start(StandaloneRunner.java:646)
    at com.streamsets.datacollector.execution.runner.common.AsyncRunner.lambda$start$3(AsyncRunner.java:143)
    at com.streamsets.pipeline.lib.executor.SafeScheduledExecutorService$SafeCallable.call(SafeScheduledExecutorService.java:233)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Unable to get driver instance for jdbcUrl=jdbc:oracle:thin:@(DESCRIPTION =
(ENABLE=BROKEN)
(ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = myport))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl.WORLD)))
    at com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:88)
    at com.zaxxer.hikari.pool.PoolElf.initializeDataSource(PoolElf.java:157)
    at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:113)
    at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:73)
    at com.streamsets.pipeline.lib.jdbc.JdbcUtil.createDataSourceForRead(JdbcUtil.java:630)
    ... 19 more
Caused by: java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getDriver(DriverManager.java:315)
    at com.zaxxer.hikari.util.DriverDataSource.<init>(DriverDataSource.java:81)
    ... 23 more

你有什么主意吗?

4

3 回答 3

1

似乎缺少设置环境变量STREAMSETS_LIBRARIES_EXTRA_DIR,这是安装外部库安装过程的一部分。

根据 Data Collector 的初始化方式,有三种安装类型:

  • 手动启动
  • 使用SysV Init(由CentOS 6、Oracle Linux 6、Red Hat Enterprise Linux 6Ubuntu 14.04 LTS支持)
  • 使用Systemd Init(由CentOS 7、Oracle Linux 7、Red Hat Enterprise Linux 7Ubuntu 16.04 LTS支持)

如果您要安装SDC

  • 手动启动,则变量STREAMSETS_LIBRARIES_EXTRA_DIR预计将通过命令行设置

    export STREAMSETS_LIBRARIES_EXTRA_DIR="/opt/streamsets-data-collector/streamsets-data-collector-3.15.0/streamsets-libs-extras/"
    
  • 作为服务启动,则此参数已经存在于$SDC_DIST/libexec/_sdc文件中

    STREAMSETS_LIBRARIES_EXTRA_DIR="${STREAMSETS_LIBRARIES_EXTRA_DIR:=${SDC_DIST}/streamsets-libs-extras}" 
    

其中$SDC_DIST变量是 SDC 安装文件(tarballRPM)的提取目录。

并且应该将相同的路径添加到文件$SDC_CONF/sdc-security.policy中,例如

grant codebase "file:///opt/streamsets-data-collector/streamsets-data-collector-3.15.0/streamsets-libs-extras/-" {
  permission java.security.AllPermission;
};

其中$SDC_CONF变量通常由路径/etc/sdc定义

现在,我们已准备好登录 Data Collector Console,以便按照以下步骤添加JDBC 外部库:

  1. 在 Data Collector 的右上角工具栏中,单击Package Manager图标: 在此处输入图像描述

  2. 在导航面板中,单击外部库

在此处输入图像描述

Data Collector 列出所有当前安装的外部库。

  1. 立即在右上角的工具栏下,单击安装外部库图标:

在此处输入图像描述

  1. Install External Libraries对话框中,从文件系统中选择阶段库JDBC(假设您已经注册并下载了 streamets-datacollector-jdbc-lib);

在此处输入图像描述

并选择可以从JDBC 和 UCP 下载页面下载的.jar文件,例如ojdbc8.jar(在我的情况下,由于我的远程数据库版本,我选择了名为Oracle Database 12c Release 2 (12.2.0.1) 驱动程序的链接)。

  1. 作为最后一步,不要忘记在“安装外部库”窗口中单击“取消” ,然后运行以下命令:

    service sdc restart ( for SysV Init)
    

    或者

    systemctl restart sdc ( for Systemd Init )
    

(您可以安装外部库窗口中单击重新启动 Data Collector ,前提是您从命令行手动启动了 Data Collector。

于 2020-05-19T09:11:14.013 回答
1

我必须在存储库下添加 ojdbc jar

/opt/streamsets-extra/streamsets-datacollector-jdbc-lib/lib
于 2017-09-11T14:11:03.630 回答
0

Legacy configuration 选项卡下尝试将JDBC Driver Class name指定为oracle.jdbc.driver.OracleDriver

于 2017-08-24T18:24:16.557 回答