Tiphanie Dousset
07/12/2023, 1:10 PMCREATE TABLE `MyTable` (
`object_ID` INTEGER PRIMARY KEY NOT ENFORCED,
`Path` VARCHAR,
`Status` VARCHAR NOT NULL
) WITH (
'connector' = 'upsert-kafka',
'value.format' = 'json',
'topic' = 'my-topic',
'key.format' = 'json',
'properties.security.protocol' = 'SASL_SSL',
'properties.sasl.mechanism' = 'PLAIN',
'properties.bootstrap.servers' = 'xxxx',
'properties.sasl.jaas.config' = 'org.apache.kafka.common.security.plain.PlainLoginModule required username="xxxx" password="yyyy";'
);
My pod complains that it can't find the "PlainLoginModule".
I found this documentation: https://issues.apache.org/jira/browse/FLINK-31361
But using
<http://org.apache.flink.kafka.shaded.org|org.apache.flink.kafka.shaded.org>.apache.kafka.common.security.plain.PlainLoginModule instead of org.apache.kafka.common.security.plain.PlainLoginModule doesn't solve the issue.
What is the correct name?
Am I missing something else?
(I've tried the workaround suggested in the link above; but that leads to other errors then π)Martijn Visser
07/12/2023, 1:12 PM<http://org.apache.flink.kafka.shaded.org|org.apache.flink.kafka.shaded.org>.apache.kafka.common.security.plain.PlainLoginModuleMartijn Visser
07/12/2023, 1:12 PMTiphanie Dousset
07/12/2023, 1:13 PMTiphanie Dousset
07/12/2023, 1:13 PMMartijn Visser
07/12/2023, 1:14 PMflink-sql-connector-kafka-3.0.0-1.17.jar which is in my lib folder.Martijn Visser
07/12/2023, 1:15 PMCREATE TABLE clickstream (
ip STRING,
userid BIGINT,
remote_user STRING,
`time` STRING,
_time TIMESTAMP(3),
request STRING,
status STRING,
`bytes` STRING,
referrer STRING,
agent STRING
) WITH (
'connector' = 'kafka',
'topic' = 'clickstream',
'properties.bootstrap.servers' = 'bootstrap_server',
'properties.group.id' = 'clickstream_consumer',
'scan.startup.mode' = 'earliest-offset',
'format' = 'avro-confluent',
'avro-confluent.url' = 'srr_server',
'avro-confluent.basic-auth.credentials-source' = 'USER_INFO',
'avro-confluent.basic-auth.user-info' = 'key:secret',
'properties.security.protocol' = 'SASL_SSL',
'properties.sasl.mechanism' = 'PLAIN',
'properties.sasl.jaas.config' = 'org.apache.flink.kafka.shaded.org.apache.kafka.common.security.plain.PlainLoginModule required username="key" password="secret";'
);
This one also uses Schema Registry, hence the avro-confluent optionsTiphanie Dousset
07/12/2023, 1:27 PMflink-sql-connector-kafka .
But now i'm actually trying to use flink-sql-connector-sqlserver-cdc to skip on my own the Debezium+Kafka part. So maybe the lib i need to talk to kafka is not anymore flink-sql-connector-kafka but simply the lib flink-connector-kafkaMartijn Visser
07/12/2023, 1:43 PMTiphanie Dousset
07/12/2023, 1:45 PMTiphanie Dousset
07/12/2023, 2:03 PMkafka-clients-3.5.0.jar
flink-connector-kafka-3.0.0-1.17.jar
And i get the error:
java.lang.ClassNotFoundException: org.apache.flink.kafka.shaded.org.apache.kafka.clients.consumer.OffsetResetStrategy
π€·Martijn Visser
07/12/2023, 2:45 PMMartijn Visser
07/12/2023, 2:46 PMMartijn Visser
07/12/2023, 2:47 PMWhich library-ies do I need to use the "upsert-kafka" connector?That uses the same as the regular Kafka connector. So either use the shaded version, which contains the Kafka Client artifacts in there, or the non-shaded one, which means that you have to add the Kafka Client artifacts in there
Tiphanie Dousset
07/14/2023, 5:32 PMkafka-clients/3.2.3
flink-connector-kafka/3.0.0-1.17
If I may ask another hint from you....what do you think of this error message; any ideas/pointers for me to solve it? π
β Caused by: java.lang.ClassCastException: cannot assign instance of org.apache.flink.kafka.shaded.org.apache.kafka.clients.consumer.OffsetResetStrategy to field org.apache.flink.connector.kafka.source.enumerator.initializer.ReaderHandledOffsetsInitializer.offsetResetStrategy of type org.apache.kafka.clients.consumer.OffsetResetStrategy in instance of org.apache.flink.connector.kafka.source.enumerator.initializer.ReaderHandledOffsetsInitializer
In my use case actually I don't consume anything from Kafka, just produce to kafka; so this error surprises me π€·Tiphanie Dousset
07/17/2023, 8:02 AMkafka-clients/3.2.3
flink-connector-kafka/3.0.0-1.17
Then I get the error:
β Caused by: java.lang.ClassCastException: cannot assign instance of org.apache.flink.kafka.shaded.org.apache.kafka.clients.consumer.OffsetResetStrategy to field org.apache.flink.connector.kafka.source.enumerator.initializer.ReaderHandledOffsetsInitializer.offsetResetStrategy of type org.apache.kafka.clients.consumer.OffsetResetStrategy in instance of org.apache.flink.connector.kafka.source.enumerator.initializer.ReaderHandledOffsetsInitializer
And if I downgrade a bit the flink-connector to:
kafka-clients/3.2.3
flink-connector-kafka/1.17.1
then I get the error:
"java.lang.ClassNotFoundException: org.apache.flink.kafka.shaded.org.apache.kafka.clients.consumer.OffsetResetStrategy"
ClassCastException VS ClassNotFoundException π
Any suggestions @Martijn Visser? πMartijn Visser
07/17/2023, 8:04 AMflink-sql-connector-kafka/3.0.0-1.17 ?Rajat Ahuja
07/20/2023, 3:22 AMTiphanie Dousset
07/20/2023, 8:41 AMflink-connector-kafka instead of flink-sql-connector-kafka/3.0.0-1.17 . I thought the first one would be enough since i need to use the kafka connector to "just" stream my Flink Table into Kafka (independently of sql). π€·
But anyway, after trying some different combination; the one working is the following.
FYI @Rajat Ahuja :
β’ In my Docker file that will be use as image in my Kubernetes deployment:
RUN wget -P /opt/flink/lib <https://repo1.maven.org/maven2/org/apache/flink/flink-sql-connector-kafka/1.17.1/flink-sql-connector-kafka-1.17.1.jar> \
<https://repo1.maven.org/maven2/com/ververica/flink-sql-connector-sqlserver-cdc/2.4.0/flink-sql-connector-sqlserver-cdc-2.4.0.jar> \
<https://repo1.maven.org/maven2/org/apache/kafka/kafka-clients/3.2.3/kafka-clients-3.2.3.jar> \
<https://repo1.maven.org/maven2/org/apache/flink/flink-connector-base/1.17.1/flink-connector-base-1.17.1.jar> \
&& wget -P /opt/flink/plugins <https://repo1.maven.org/maven2/org/apache/flink/flink-s3-fs-hadoop/1.17.1/flink-s3-fs-hadoop-1.17.1.jar>
β’ My K8 deployment:
apiVersion: <http://flink.apache.org/v1beta1|flink.apache.org/v1beta1>
kind: FlinkDeployment
metadata:
name: xxxx
namespace: yyyy
spec:
flinkConfiguration:
containerized.master.env.ENABLE_BUILT_IN_PLUGINS: flink-s3-fs-hadoop-1.17.1.jar
containerized.taskmanager.env.ENABLE_BUILT_IN_PLUGINS: flink-s3-fs-hadoop-1.17.1.jar
execution.checkpointing.interval: 10s
fs.s3a.aws.credentials.provider: com.amazonaws.auth.WebIdentityTokenCredentialsProvider
high-availability.storageDir: <s3://bbbb/>
high-availability.type: kubernetes
jobmanager.memory.flink.size: 460m
jobmanager.memory.jvm-overhead.min: 3m
kubernetes.container.image.pull-secrets: aaaaa
state.backend.incremental: "true"
state.backend.type: rocksdb
state.checkpoints.dir: <s3://zzzzzz/>
state.savepoints.dir: <s3://yyyyy/>
taskmanager.memory.flink.size: 460m
taskmanager.memory.jvm-overhead.min: 3m
taskmanager.memory.managed.size: 120m
taskmanager.numberOfTaskSlots: "2"
flinkVersion: v1_17
image: <path-to-the-registry-with-image-built-from-Dockerfile-bove>
imagePullPolicy: Always
job:
args:
- /opt/sql-scripts/simple.sql
jarURI: local:///opt/flink/usrlib/sql-runner.jar
parallelism: 1
savepointTriggerNonce: 0
state: running
upgradeMode: stateless
jobManager:
podTemplate:
apiVersion: v1
kind: Pod
spec:
containers:
- name: flink-main-container
volumeMounts:
- mountPath: /opt/sql-scripts
name: sql-scripts
imagePullSecrets:
- name: eeeeeee
volumes:
- configMap:
name: sql-scripts
name: sql-scripts
replicas: 1
resource:
cpu: 0.25
memory: 760m
serviceAccount: flink
taskManager:
resource:
cpu: 0.25
memory: 760m
NB: right now i have upgradeMode: stateless but i plan on moving to upgradeMode: last-stateMartijn Visser
07/20/2023, 9:12 AMI thought the first one would be enough since i need to use the kafka connector to "just" stream my Flink Table into Kafka (independently of sql).@Tiphanie Dousset If you're using SQL, I would recommend using the SQL version of the Kafka connector. That's because it already contains the correctly shaded JARs to connect to Kafka (the Client etc). Then you're always certain that you have a bundle that has been working from a Flink POV during testing