MAPREDUCE服务 MRS-Kafka表开发规则:Kafka作为source表时必须指定“properties.group.id”配置项

时间:2024-11-22 09:36:13

Kafka作为source表时必须指定“properties.group.id”配置项

【示例】以“testGroup”为用户组读取主题为“test_sink”的Kafka消息:

CREATE TABLE KafkaSource(
   `user_id` VARCHAR,
   `user_name` VARCHAR,
   `age` INT 
) WITH (
   'connector' = 'kafka',
   'topic' = 'test_sink',
   'properties.bootstrap.servers' = 'Kafka的Broker实例业务IP:Kafka端口号',
   'scan.startup.mode' = 'latest-offset',
   'properties.group.id' = 'testGroup',
   'value.format' = 'csv',
   'properties.sasl.kerberos.service.name' = 'kafka',
   'properties.security.protocol' = 'SASL_PLAINTEXT',
   'properties.kerberos.domain.name' = 'hadoop.系统 域名 ' 
);
SELECT * FROM KafkaSource;
support.huaweicloud.com/devg-rule-mrs/mrs_07_450150.html