bash - Kafka MongoDB 接收器连接器错误!没有开始
问题描述
我正在尝试在 Linux Ubuntu 20.04 上将 Kafka 与 MongoDB 连接起来,以前它工作正常,但现在我在运行时遇到错误。
这是我尝试将 Kafka 与 MongoDb 连接起来的方法。
我制作了一个单独的connect-standalone_bare.properties文件,其中包含以下实体:
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# These are defaults. This file just demonstrates how to override some settings.
bootstrap.servers=localhost:9092
# The converters specify the format of data in Kafka and how to translate it into Connect data. Every Connect user will
# need to configure these based on the format they want their data in when loaded from or stored into Kafka
key.converter=org.apache.kafka.connect.json.JsonConverter
value.converter=org.apache.kafka.connect.converters.JsonConverter
# Converter-specific settings can be passed in by prefixing the Converter's setting with the converter we want to apply
# it to
key.converter.schemas.enable=false
value.converter.schemas.enable=false
rest.port:8084
offset.storage.file.filename=/tmp/connect.offsets-1
# Flush much faster than normal, which is useful for testing/debugging
offset.flush.interval.ms=10000
# Set to a list of filesystem paths separated by commas (,) to enable class loading isolation for plugins
# (connectors, converters, transformations). The list should consist of top level directories that include
# any combination of:
# a) directories immediately containing jars with plugins and their dependencies
# b) uber-jars with plugins and their dependencies
# c) directories immediately containing the package directory structure of classes of plugins and their dependencies
# Note: symlinks will be followed to discover dependencies or plugins.
# Examples:
# plugin.path=/usr/local/share/java,/usr/local/share/kafka/plugins,/opt/connectors,
plugin.path=/home/ms-batch18/Documents/kafka_2.13-2.8.0/libs/mongo-kafka-connect-1.2.0-all.jar
这是我的 MongoDb 接收器连接器:
name=mongo-sink
topics=test
connector.class=com.mongodb.kafka.connect.MongoSinkConnector
tasks.max=1
key.ignore=true
connection.uri=mongodb://localhost:27017
database=test_kafka
collection=transaction
max.num.retries=3
retries.defer.timeout=5000
type.name=kafka-connect
schemas.enable=false
运行此命令时:
bin/connect-standalone.sh config/connect-standalone_bare.properties config/MongoSinkConnector.properties
我正面临这个错误:
(org.apache.kafka.connect.runtime.WorkerInfo:71)
[2021-08-24 12:09:14,826] ERROR Stopping due to error (org.apache.kafka.connect.cli.ConnectStandalone:126)
java.nio.file.NoSuchFileException: config/connect-standalone_bare.properties
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
at java.base/java.nio.file.Files.newByteChannel(Files.java:371)
at java.base/java.nio.file.Files.newByteChannel(Files.java:422)
at java.base/java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:420)
at java.base/java.nio.file.Files.newInputStream(Files.java:156)
at org.apache.kafka.common.utils.Utils.loadProps(Utils.java:629)
at org.apache.kafka.common.utils.Utils.loadProps(Utils.java:616)
at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:75)
解决方案
错误是说您提供的属性文件在您的 shell 的相对路径中不存在。
给出绝对路径以验证它是否存在。
也建议connect-distributed
改用
推荐阅读
- r - 如何使用 R“StreamMetabolism”包中的“read.production”函数来获取格式为 mm/dd/yy hh:mm:ss 的日期(例如,01/15/19 00:06:00)
- c# - 有没有办法通过 C# 中两列的组合对列表进行排序?
- c++ - 为什么我们不能重载 C++ 中基本数据类型的运算符?
- python-3.x - 正则表达式捕获第一个分隔符,但不包括
- python - 根据文件中的数据计算平均高度
- angular - 如何在角材料表中获得选定区域?
- python - 如何通过请求库将 Curl 命令更改为 Python3?
- c++ - 即使您没有将结构显式定义为指针,为什么还要使用 -> 来访问结构成员变量?
- javascript - 如何在 Rails 5 上的 ruby 中添加人脸识别?
- javascript - 如何防止 JavaScript 动画出现奇怪的震动