【开发问题】flink的sql任务,用命令行执行

flink-sql

  • 命令行
    • flink-sql的客户端
    • sql文件地址
    • sql的内容

命令行

 /mnt/flink/flink-1.17.1/bin/sql-client.sh embedded -f /mnt/flink/flink-1.17.1/examples/sql/oracle2Oracle 

flink-sql的客户端

 /mnt/flink/flink-1.17.1/bin/sql-client.sh

sql文件地址

/mnt/flink/flink-1.17.1/examples/sql/oracle2Oracle

sql的内容

CREATE TABLE TEST_SOURCE_source(
    ID STRING
    ,NAME STRING
    ,AGE STRING
    ,PRIMARY KEY(ID) NOT ENFORCED
) WITH ( 
    'connector' = 'oracle-cdc',
    'hostname' = '192.168.1.135',
    'port' = '1521',
    'username' = 'flink',
    'password' = 'xxx',
    'schema-name' = 'flink',
    'database-name' = 'dbc',
    'table-name' = 'TEST_SOURCE'
);

CREATE TABLE TEST_SINK_sink(
    ID STRING
    ,NAME STRING
    ,AGE STRING
    ,PRIMARY KEY(ID) NOT ENFORCED
) WITH ( 
    'connector' = 'jdbc',
    'url' = 'jdbc:oracle:thin:@//192.168.1.135:1521/dbc',
    'username' = 'flink',
    'password' = 'xxx',
    'table-name' = 'TEST_SINK'
);

INSERT INTO TEST_SINK_sink ( ID,NAME,AGE )  SELECT ID,NAME,AGE FROM TEST_SOURCE_source;

你可能感兴趣的:(flink,sql,大数据)