我正在尝试为融合的kafka平台设置mongo db源连接器[https://www.confluent.io/hub/mongodb/kafka-connect-mongodb]。使用Mongo DB Atlas的连接URI时,我能够成功建立mongo db和kafka之间的流。当我在Azure kubernetes集群上运行mongo db时出现问题。我创建了具有3个副本的mongo db statefulset,并且已通过负载均衡器将mongo db服务公开到了Internet。我可以使用robo 3T连接到公开IP上的mongo数据库,并执行CRUD操作。现在,当我使用在kubernetes中运行的mongo db的连接URI看起来像“mongodb:// load-balance-ip:27017 / test?ssl = false&authSource = admin&retryWrites = true&w = majority”时,出现以下错误kafka连接日志INFO Failed to resume change stream: The $changeStream stage is only supported on replica sets 40573 (com.mongodb.kafka.connect.source.MongoSourceTask:253)
Mongo DB有状态集YML看起来像这样
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: eic-mongo-mongodb
spec:
serviceName: eic-mongo-mongodb
replicas: 3
selector:
matchLabels:
app: eic-mongo-mongodb
template:
metadata:
labels:
app: eic-mongo-mongodb
selector: eic-mongo-mongodb
spec:
affinity:
# Try to put each ES data node on a different node in the K8s cluster
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- eic-mongo-mongodb
topologyKey: kubernetes.io/hostname
containers:
- name: eic-mongo-mongodb
image: mongo:4.0.8
resources:
limits:
cpu: 500m
memory: "1Gi"
requests:
cpu: 500m
memory: "1Gi"
volumeMounts:
- name: mongo-volume
mountPath: /data/db
volumeClaimTemplates:
- metadata:
name: mongo-volume
spec:
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
resources:
requests:
storage: 3Gi
mongo DB服务yml看起来像这样
apiVersion: v1
kind: Service
metadata:
name: eic-mongo-mongodb
ports:
- name: "27017"
nodePort: 31683
port: 27017
protocol: TCP
targetPort: 27017
selector:
app: eic-mongo-mongodb
type: LoadBalancer
有人可以让我知道我在哪里出错吗?
最佳答案
关于mongodb - kafka mongo db源连接器,在kubernetes上运行mongo db,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61823999/