Couchbase
Supported pipeline types:
|
The destination writes each record to a document in an existing bucket in the Couchbase database. Each Couchbase document has a unique ID or key that identifies the document. You specify the key for the document where the destination writes each record. You can configure the destination to use the compare and swap (CAS) value to detect conflicts with other processes before writing a record.
The Couchbase destination can use CRUD operations defined in the
sdc.operation.type record header attribute to write
data. You can define a default operation for records without the header
attribute or value. You can also configure how to handle records with
unsupported operations.
For information about Data Collector change data
processing and a list of CDC-enabled origins, see Processing Changed Data.
When you configure the Couchbase destination, you enter connection information, such as the nodes and bucket to connect to, as well as timeout properties for the connection. Optionally, you can enable TLS for the connection. You also enter information to authenticate with Couchbase Server.
Define the CRUD Operation
The Couchbase destination can insert, update, delete, or upsert data. The destination writes the records based on the CRUD operation defined in a CRUD operation header attribute or in operation-related stage properties.
You define the CRUD operation in the following ways:
- CRUD record header attribute
- You can define the CRUD
operation in a CRUD operation record header attribute. The
destination looks for the CRUD operation to use in the
sdc.operation.typerecord header attribute. - Operation stage properties
- You define a default operation in the destination
properties. The destination uses the default operation when the
sdc.operation.typerecord header attribute is not set.
Compare and Swap
You can configure the Couchbase destination to use the Couchbase compare and swap (CAS) value to detect conflicts with other processes before writing a record.
The Couchbase Lookup
processor creates the couchbase.cas record header attribute
for key/value lookups. The attribute stores a value that represents the state of the
looked-up document.
couchbase.cas record header attribute
exists, the destination sends Couchbase Server the attribute value with the write
operation request. Couchbase Server compares the attribute value to the current CAS
value for the document:- If the value of the record header attribute equals the current CAS value, then Couchbase Server writes the record to the document as requested.
- If the value of the record header attribute does not equal the CAS value, then Couchbase Server perceives a conflict with another process and sends the unwritten record back to the destination. The destination sends the record to the pipeline for error handling.
When the couchbase.cas record header attribute does not exist, such as
for records that originate from N1QL lookups, the destination cannot use the CAS value
to detect conflicts.
Data Formats
The Couchbase destination writes data to Couchbase Server based on the data format that you select.
- Avro
- The destination writes records based on the Avro schema. You can use one of the following methods to specify the location of the Avro schema definition:
- Binary
- The stage writes binary data to a single field in the record.
- Delimited
- The destination writes records as delimited data. When you use this data format, the root field must be list or list-map.
- JSON
- The destination writes records as JSON data.
- Protobuf
- Writes a batch of messages in each file.
- SDC Record
- The destination writes records in the SDC Record data format.
- Text
- The destination writes data from a single text field to the destination system. When you configure the stage, you select the field to use.
Configuring a Couchbase Destination
Configure a Couchbase destination to write data to a Couchbase database.