Visão geral
Nesta página, você pode visualizar todas as propriedade de configuração disponíveis para o connector de sink do MongoDB Kafka. Esta página duplica o conteúdo das outras páginas de propriedade de configuração do connector de pia.
Para exibir uma lista de todas as páginas de propriedades de configuração do conector de pia, consulte a páginade configuração do conector de pia.Connector
Conexão do MongoDB
Use as seguintes definições de configuração para especificar como o de MongoDB Kafka coletor do connector se conecta e se comunica com o MongoDB cluster.
Para exibir apenas as opções relacionadas à configuração da conexão do MongoDB, consulte a página propriedade de configuração de conexão do MongoDB .
| Nome | Descrição | 
|---|---|
| connection.uri | Required Type: string Description: The MongoDB connection URI string
to connect to your MongoDB instance or cluster. For more information, see the Connect to MongoDB guide IMPORTANTE: para evitar expor suas credenciais de autenticação na sua configuração do  Default:  mongodb://localhost:27017Accepted Values: A MongoDB connection URI string | 
| server.api.version | Type: string Description: The Stable API version you want to use with your MongoDB
server. For more information on the Stable API and versions of
the server that support it, see the Stable API
MongoDB server manual guide. Default:  ""Accepted Values: An empty string or a valid Stable API version. | 
| server.api.deprecationErrors | Type: boolean Description: When set to  true, if the connector calls a command on your
MongoDB instance that's deprecated in the declared Stable API
version, it raises an exception.You can set the API version with the  server.api.versionconfiguration option. For more information on the Stable API, see
the MongoDB manual entry on the
Stable API.Default:  falseAccepted Values:  trueorfalse | 
| server.api.strict | Type: boolean Description: When set to  true, if the connector calls a command on your
MongoDB instance that's not covered in the declared Stable API
version, it raises an exception.You can set the API version with the  server.api.versionconfiguration option. For more information on the Stable API, see
the MongoDB manual entry on the
Stable API.Default:  falseAccepted Values:  trueorfalse | 
Namespace MongoDB
Use as seguintes definições de configuração para especificar em qual MongoDB database e collection o connector de sink do MongoDB Kafka grava os dados. Você pode utilizar o DefaultNamespaceMapper padrão ou especificar uma classe personalizada.
Para exibir apenas as opções relacionadas à especificação de onde o connector grava os dados, consulte a página propriedade de Configuração de namespace MongoDB .
| Nome | Descrição | |
|---|---|---|
| namespace.mapper | Type: string Description: The fully-qualified class name of the class that specifies which
database or collection in which to sink the data. The default
 DefaultNamespaceMapperuses values specified in thedatabaseandcollectionproperties.The connector includes an alternative class for specifying the database and collection called  FieldPathNamespaceMapper. Seefor more information. Default: Accepted Values: A fully qualified Java class name of a class that implements the  NamespaceMapperinterface. | |
| database | Required Type: string Description: The name of the MongoDB database to which the sink connector writes. Accepted Values: A MongoDB database name | |
| collection | Type: string Description: The name of the MongoDB collection to which the sink connector
writes. If your sink connector follows multiple topics, this
is the default collection for any writes that are not otherwise
specified. Default: The topic name. Accepted Values: A MongoDB collection name | 
Configurações do FieldPathNamespaceMapper
Se você configurar o conector de pia para usar o FieldPathNamespaceMapper, poderá especificar qual banco de dados e coleção coletará um documento com base nos valores de campo dos dados.
Para habilitar esse comportamento de mapeamento, defina a propriedade de configuração do conector de pia namespace.mapper como o nome da classe totalmente qualificado, conforme mostrado abaixo:
namespace.mapper=com.mongodb.kafka.connect.sink.namespace.mapping.FieldPathNamespaceMapper 
O FieldPathNamespaceMapper exige que você especifique as seguintes configurações:
- Uma ou ambas as propriedade de mapeamento para um reconhecimento de data center e collection 
- Um dos mapeamentos do - keyou- valuepara um banco de dados
- Um dos mapeamentos - keyou- valuepara uma collection
Você pode usar as seguintes configurações para personalizar o comportamento do FieldPathNamespaceMapper:
| Nome | Descrição | 
|---|---|
| namespace.mapper.key.database.field | Type: string Description: The name of the key document field that specifies the name of the
database in which to write. | 
| namespace.mapper.key.collection.field | Type: string Description: The name of the key document field that specifies the name of the
collection in which to write. | 
| namespace.mapper.value.database.field | Type: string Description: The name of the value document field that specifies the name of the
database in which to write. | 
| namespace.mapper.value.collection.field | Type: string Description: The name of the value document field that specifies the name of the
collection in which to write. | 
| namespace.mapper.error.if.invalid | Type: boolean Description: Whether to throw an exception when either the document is missing the
mapped field or it has an invalid BSON type. When set to  true, the connector does not process documents
missing the mapped field or that contain an invalid BSON type.
The connector may halt or skip processing depending on the related
error-handling configuration settings.When set to  false, if a document is missing the mapped field or
if it has an invalid BSON type, the connector defaults to
writing to the specifieddatabaseandcollectionsettings.Default:  falseAccepted Values:  trueorfalse | 
Tópico do conector
Use as seguintes definições de configuração para especificar quais tópicos do Kafka o connector de pia do MongoDB Kafka deve observar os dados.
Para exibir apenas as opções relacionadas à especificação de tópicos do Kafka, consulte a página Propriedades do tópico Kafka para o conector de coletor.
| Nome | Descrição | |
|---|---|---|
| topics | Required Type: list Description: A list of Kafka topics that the sink connector watches. Você pode definir a configuração  Accepted Values: A comma-separated list of valid Kafka topics | |
| topics.regex | Required Type: string Description: A regular expression that matches the Kafka topics that the sink
connector watches. Por exemplo, o regex a seguir corresponde a nomes de tópicos como "atividade.anding.cliques" e "atividade.support.cliques". Não corresponde aos nomes do tópico " Activity.Landing.views " e "atividade.cliques". Você pode definir a configuração  Accepted Values: A valid regular expression pattern using  java.util.regex.Pattern. | 
Processamento de mensagens do conector
Use as configurações nesta página para configurar o comportamento de processamento de mensagens do connector de pia MongoDB Kafka, incluindo o seguinte:
- Tamanho do lote da mensagem 
- Limites de taxa 
- Número de tarefas paralelas 
Para exibir apenas as opções relacionadas à alteração de manipuladores de captura de dados, consulte a página Propriedades de Processamento de Mensagens do Conector .
| Nome | Descrição | ||
|---|---|---|---|
| max.batch.size | Type: int Description: Maximum number of sink records to batch together for processing. Consider the batch that contains the following records: When set to  0, the connector performs a single bulk write for
the entire batch.When set to  1, the connector performs one bulk write for each
record in the batch, for a total of five bulk writes as shown in
the following example:Default:  0Accepted Values: An integer | ||
| bulk.write.ordered | Type: boolean Description: Whether the connector writes a batch of records
as an ordered or unordered bulk write operation.
When set to  true, the default value, the
connector writes a batch of records as an ordered bulk write
operation.To learn more about bulk write operations, see
Bulk Write Operations. Default:  trueAccepted Values:  trueorfalse | ||
| rate.limiting.every.n | Type: int Description: Number of batches of records the sink connector processes in
order to trigger the rate limiting timeout. A value of 0 means no
rate limiting. Default:  0Accepted Values: An integer | ||
| rate.limiting.timeout | Type: int Description: How long (in milliseconds) to wait before the sink connector
should resume processing after reaching the rate limiting
threshold. Default:  0Accepted Values: An integer | ||
| tasks.max | Type: int Description: The maximum number of tasks to create for this connector. The
connector may create fewer than the maximum tasks specified if it
cannot handle the level of parallelism you specify. IMPORTANT: If you specify a value greater than  1,
the connector enables parallel processing of the tasks.
If your topic has multiple partition logs, which enables
the connector to read from the topic in parallel,
the tasks may process the messages out of order.Default:  1Accepted Values: An integer | 
Tratamento de erros do conector
Use as seguintes definições de configuração para especificar como o conector do coletor do MongoDB Kafka lida com erros e para configurar a fila de letras mortas.
Para exibir apenas as opções relacionadas ao tratamento de erros, consulte a página propriedade de tratamento de erros do connector .
| Nome | Descrição | 
|---|---|
| mongo.errors.tolerance | Type: string Description: Whether to continue processing messages if the connector encounters
an error. Allows the connector to override  the  errors.toleranceKafka cluster setting.When set to  none, the connector reports any error and
blocks further processing of the rest of the messages.When set to  all, the connector ignores any problematic messages.When set to  data, the connector tolerates only data errors and
fails on all other errors.To learn more about error handling strategies, see the
Handle Errors page. This property overrides the errors.tolerance property of the Connect Framework. Default: Inherits the value from the  errors.tolerancesetting.Accepted Values:  "none"or"all" | 
| mongo.errors.log.enable | Type: boolean Description: Whether the connector should write details of errors including
failed operations to the log file. The connector classifies
errors as "tolerated" or "not tolerated" using the
 errors.toleranceormongo.errors.tolerancesettings.When set to  true, the connector logs both "tolerated" and
"not tolerated" errors.When set to  false, the connector logs "not tolerated" errors.This property overrides the errors.log.enable property of the Connect Framework. Default:  falseAccepted Values:  trueorfalse | 
| errors.log.include.messages | Type: boolean Description: Whether the connector should include the invalid message when
logging an error. An invalid message includes data such as record
keys, values, and headers. Default:  falseAccepted Values:  trueorfalse | 
| errors.deadletterqueue.topic.name | Type: string Description: Name of topic to use as the dead letter queue. If blank, the
connector does not send any invalid messages to the dead letter
queue. To learn more about the dead letter queue, see the
Dead Letter Queue Configuration Example. Default:  ""Accepted Values: A valid Kafka topic name | 
| errors.deadletterqueue.context.headers.enable | Type: boolean Description: Whether the connector should include context headers when it
writes messages to the dead letter queue. To learn more about the dead letter queue, see the
Dead Letter Queue Configuration Example. To learn about the exceptions the connector defines and
reports through context headers, see
Bulk Write Exceptions. Default:  falseAccepted Values:  trueorfalse | 
| errors.deadletterqueue.topic.replication.factor | Type: integer Description: The number of nodes on which to replicate the dead letter queue
topic. If you are running a single-node Kafka cluster, you must
set this to  1.To learn more about the dead letter queue, see the
Dead Letter Queue Configuration Example. Default:  3Accepted Values: A valid number of nodes | 
Pós-processadores
Use as seguintes definições de configuração para especificar como o connector de coletor do MongoDB Kafka deve transformar os dados do Kafka antes de inseri-los no MongoDB.
Para exibir apenas as opções relacionadas aos pós-processadores, consulte a página propriedade do pós-processador do connector de pia .
| Nome | Descrição | |
|---|---|---|
| post.processor.chain | Type: list Description: A list of post-processor classes the connector should apply to
process the data before saving it to MongoDB. To learn more about post-processors and see examples of their usage, see Default: Accepted Values: A comma-separated list of fully qualified Java class names | |
| field.renamer.mapping | Type: string Description: A list of field name mappings for key and value fields. Define
the mappings in an inline JSON array in the following format: Default:  []Accepted Values: A valid JSON array | |
| field.renamer.regexp | Type: string Description: A list of field name mappings for key and value fields using
regular expressions. Define the mappings in an inline JSON array
in the following format: Default:  []Accepted Values: A valid JSON array | |
| key.projection.list | Type: string Description: A list of field names the connector should include in the key
projection. Default:  ""Accepted Values: A comma-separated list of field names | |
| key.projection.type | Type: string Description: The key projection type the connector should use. Default:  noneAccepted Values:   none,BlockList, orAllowList(Deprecated: blacklist, whitelist) | |
| value.projection.list | Type: string Description: A list of field names the connector should include in the value
projection. Default:  ""Accepted Values: A comma-separated list of field names | |
| value.projection.type | Type: string Description: The type of value projection the connector should use. Default:  noneAccepted Values:  none,BlockList, orAllowList(Deprecated: blacklist, whitelist) | |
| writemodel.strategy | Type: string Description: The class that specifies the  WriteModelStrategythe connector should
use for Bulk Writes.To learn more about how to create your own strategy, see Default: Accepted Values: A fully qualified Java class name | 
Estratégia de ID
Use as seguintes configurações para especificar como o conector MongoDB Kafka sink deve determinar o valor _id para cada documento que ele grava no MongoDB.
Para exibir apenas as opções relacionadas à determinar o campo _id dos seus documentos, consulte a página Propriedades de estratégia de ID do conector de coletor.
| Nome | Descrição | |
|---|---|---|
| document.id.strategy | Type: string Description: The class the connector should use to generate a unique  _idfield.Default: Accepted Values: An empty string or a fully qualified Java class name | |
| document.id.strategy.overwrite.existing | Type: boolean Description: Whether the connector should overwrite existing values in the  _idfield when it applies the strategy defined by thedocument.id.strategyproperty.Default:  falseAccepted Values:  trueorfalse | |
| document.id.strategy.uuid.format | Type: string Description: Whether the connector should output the UUID in the  _idfield
in string format or in
BsonBinary
format.Default:  stringAccepted Values:  stringorbinary | |
| delete.on.null.values | Type: boolean Description: Whether the connector should delete documents when the key value
matches a document in MongoDB and the value field is null. This setting applies when you specify an id generation strategy that
operates on the key document such as  FullKeyStrategy,PartialKeyStrategy, andProvidedInKeyStrategy.Default:  falseAccepted Values:  trueorfalse | 
Estratégia do modelo de escrita
Você pode definir propriedades de configuração para especificar como o de MongoDB Kafka coletor do connector grava dados no MongoDB. As seções a seguir descrevem as propriedades de configuração que você pode definir para personalizar este comportamento.
WriteModel
Configure a propriedade de configuração writemodel.strategy para especificar como o connector do coletor grava dados quando recebe um registro do coletor.
Você pode definir o valor de writemodel.strategy para qualquer um dos nomes de classe totalmente qualificados das estratégias de modelo de gravação descritas na seção Estratégias desta página. Você pode especificar uma estratégia definindo a seguinte configuração:
writemodel.strategy=<a write model strategy> 
Excluir modelo de gravação
Configure a propriedade de configuração delete.writemodel.strategy para especificar como o connector do coletor grava dados quando recebe um evento de marca para exclusão. Um evento de marca de exclusão é um registro que contém uma chave, mas nenhum valor, o que significa um registro excluído.
Você pode definir o valor de delete.writemodel.strategy para qualquer um dos nomes de classe totalmente qualificados das estratégias de modelo de gravação descritas na seção Estratégias desta página. Você pode especificar uma estratégia definindo a seguinte configuração:
delete.writemodel.strategy=<a write model strategy> 
Para exibir apenas as opções relacionadas às estratégias de modelo de gravação, consulte a página Estratégias de modelo de gravação do conector do coletor.
| Nome | Descrição | |
|---|---|---|
| DefaultWriteModelStrategy | Description: This strategy uses the  ReplaceOneDefaultStrategyby
default, and theInsertOneDefaultStrategyif you set thetimeseries.timefieldoption.This is the default value value for the  writemodel.strategyconfiguration property. | |
| InsertOneDefaultStrategy | Description: Insert each sink record into MongoDB as a document. To specify this strategy, set the configuration property to the
following class name:  | |
| ReplaceOneDefaultStrategy | Description: Replaces at most one document in MongoDB that matches a sink
record by the  _idfield. If no documents match, the
connector inserts the sink record as a new document.To specify this strategy, set the configuration property to the
following class name:  | |
| ReplaceOneBusinessKeyStrategy | Description: Replaces at most one document that matches a sink record by a
specified business key. If no documents match, the
connector inserts the sink record as a new document. To specify this strategy, set the configuration property to the
following class name: To see an example showing how to use this strategy, see our
guide on write model strategies. | |
| DeleteOneDefaultStrategy | Description: Deletes at most one document that matches your sink connector's
key structure by the  _idfield only when the document
contains a null value structure.This is the default value for the
 delete.writemodel.strategyconfiguration property.This strategy is set as the default value of the
 writemodel.strategyproperty when you setmongodb.delete.on.null.values=true.To specify this strategy, set the configuration property to the
following class name:  | |
| DeleteOneBusinessKeyStrategy | Description: Deletes at most one MongoDB document that matches a sink record by a business key. To specify this strategy, set the configuration property to the
following class name: To see an example showing how to use this strategy, see our
guide on write model strategies. | |
| UpdateOneDefaultStrategy | Description: Updates at most one document in MongoDB that matches a sink
record by the  _idfield. If no documents match, the
connector inserts the sink record as a new document.To specify this strategy, set the configuration property to the
following class name:  | |
| UpdateOneTimestampsStrategy | Description: Add  _insertedTS(inserted timestamp) and_modifiedTS(modified timestamp) fields into documents.To specify this strategy, set the configuration property to the
following class name: To see an example showing how to use this strategy, see our
guide on write model strategies. | |
| UpdateOneBusinessKeyTimestampStrategy | Description: Add  _insertedTS(inserted timestamp) and_modifiedTS(modified timestamp) fields into documents that match a business
key.To specify this strategy, set the configuration property to the
following class name:  | 
Substituição de tópico
Use as seguintes definições de configuração do conector do coletor do MongoDB Kafka para substituir as configurações de propriedade globais ou padrão para tópicos específicos.
Para exibir apenas as opções relacionadas à substituição das configurações do tópico, consulte a página propriedade de substituição do tópico .
| Nome | Descrição | 
|---|---|
| topic.override.<topicName>.<propertyName> | Type: string Description: Specify a topic and property name to override the corresponding
global or default property setting. For example, the  topic.override.foo.collection=barsetting instructsthe sink connector to store data from the  footopic in thebarcollection. You can specify any valid configuration setting in the <propertyName>segment on a per-topic basis exceptconnection.uriandtopics.Default:   ""Accepted Values: Accepted values specific to the overridden property | 
Alterar captura de dados
Use as seguintes definições de configuração para especificar uma classe que o de MongoDB Kafka coletor do connector usa para processar eventos de captura de dados de alteração (CDC).
Consulte o guia sobre Sink Connector Change Data Capture para obter exemplos usando o ChangeStreamHandler e os manipuladores integrados para os produtores de evento Debezium e Qlik Replicate.
Para exibir apenas as opções relacionadas aos manipuladores de captura de dados de alteração, consulte a página propriedade de captura de dados de alteração .
| Nome | Descrição | 
|---|---|
| change.data.capture.handler | Type: string Description: The class name of the CDC handler to use for converting changes
into event streams. See
Available CDC Handlers
for a list of CDC handlers. Default:  ""Accepted Values: An empty string or a fully qualified Java
class name | 
Séries temporais
Use as seguintes definições de configuração para especificar como o conector de coletor do MongoDB Kafka deve coletar dados em uma coleção de séries temporais do MongoDB.
Para exibir apenas as opções relacionadas à coleção de time-series, consulte a página propriedade da time-series Kafka .
| Nome | Descrição | |
|---|---|---|
| timeseries.timefield | Type: string Description: The name of the top-level field in the source data that contains time
information that you want to associate with the new document in the
time series collection. Default:  ""Accepted Values: An empty string or the name of a field
that contains a BSON  DateTimevalue | |
| timeseries.timefield.auto.convert.date.format | Type: string Description: The date format pattern the connector should use to convert the
source data contained in the field specified by the
 timeseries.timefieldsetting.The connector passes the date format pattern to the Java
DateTimeFormatter.ofPattern(pattern, locale)
method to perform date and time conversions on the time field. If the date value from the source data only contains date information,
the connector sets the time information to the start of the specified
day. If the date value does not contain the timezone offset, the
connector sets the offset to UTC. Default: Accepted Values: A valid  DateTimeFormatterformat | |
| timeseries.timefield.auto.convert | Type: boolean Description: Whether to convert the data in the field into the BSON  Dateformat.When set to  true, the connector uses the milliseconds
after epoch and discards fractional parts if the value is
a number. If the value is a string, the connector uses the
setting in the following configuration to parse the date:If the connector fails to convert the value, it sends the
original value to the time series collection. Default:  falseAccepted Values:  trueorfalse | |
| timeseries.timefield.auto.convert.locale.language.tag | Type: string Description: Which  DateTimeFormatterlocale language tag to use with the date
format pattern (e.g."en-US").To learn more about locales, see the Java SE documentation of Locale. Default:  ROOTAccepted Values: A valid  Localelanguage tag format | |
| timeseries.metafield | Type: string Description: Which top-level field to read from the source data to describe
a group of related time series documents. IMPORTANT: This field must not be the  _idfield nor the field you specified
in thetimeseries.timefieldsetting.Default:  ""Accepted Values: An empty string or the name of a field
that contains any BSON type except  BsonArray. | |
| timeseries.expire.after.seconds | Type: int Description: The number of seconds MongoDB should wait before automatically
removing the time series collection data. The connector disables
timed expiry when the setting value is less than  1.To learn more, see Set up Automatic Removal for Time Series Collections
in the MongoDB manual. Default:  0Accepted Values: An integer | |
| timeseries.granularity | Type: string Description: The expected interval between subsequent measurements of your
source data. To learn more, see Set Granularity for Time Series Data in the MongoDB manual. Optional Default:  ""Accepted Values:  "","seconds","minutes","hours" | 
Para obter um exemplo de como converter uma coleção existente em uma coleção de séries temporais, consulte o tutorial sobre como migrar uma coleção existente para uma coleção de séries temporais.