Important
You are viewing documentation for an older version of Confluent Platform. For the latest, click here.
Kafka Connect MapR DB Sink Connector¶
The MapR DB Connector provides a way to export data from a Apache Kafka® topic and write data to a MapR DB cluster.
Prerequisites¶
The following are required to run the Kafka Connect MapR DB Sink Connector:
- Kafka Broker: Confluent Platform 3.3.0 or above, or Kafka 0.11.0 or above
- Connect: Confluent Platform 4.1.0 or above, or Kafka 1.1.0 or above (requires header support in Connect)
- MapR DB 5.x or higher
- MapR DB (Installed locally in opt/mapr)
- Java 1.8
Install MapR DB Connector¶
- Prerequisite
This connector requires that the MapR Client is installed and working properly on the host running the connect worker process. The Kafka Connect worker process must be started with this command:
-Dmapr.home.dir=/opt/mapr -Dmapr.library.flatclass
You can do this by exporting the KAFKA_OPTS environment variable before starting Kafka Connect. For example:
export KAFKA_OPTS="-Dmapr.home.dir=/opt/mapr -Dmapr.library.flatclass"
You can install this connector by using the Confluent Hub client (recommended) or you can manually download the ZIP file.
Install the connector using Confluent Hub¶
- Prerequisite
- Confluent Hub Client must be installed. This is installed by default with Confluent Enterprise.
Navigate to your Confluent Platform installation directory and run this command to install the latest (latest
) connector version.
The connector must be installed on every machine where Connect will be run.
confluent-hub install confluentinc/kafka-connect-maprdb:latest
You can install a specific version by replacing latest
with a version number. For example:
confluent-hub install confluentinc/kafka-connect-maprdb:1.0.0-preview
Install Connector Manually¶
Download and extract the ZIP file for your connector and then follow the manual connector installation instructions.
License¶
You can use this connector for a 30-day trial period without a license key.
After 30 days, this connector is available under a Confluent enterprise license. Confluent issues enterprise license keys to subscribers, along with providing enterprise-level support for Confluent Platform and your connectors. If you are a subscriber, please contact Confluent Support at support@confluent.io for more information.
See Confluent Platform license for license properties and License topic configuration for information about the license topic.
Usage Notes¶
The table on the MapR DB cluster is selected based on the topic name. If you need to change this take a look at the RegexRouter transformation which can be used to change the topic name before it’s sent to MapR DB.
Examples¶
Property-based example¶
This configuration is used typically along with standalone workers.
name=MapRDBSinkConnector1
connector.class=io.confluent.connect.mapr.db.MapRDBSinkConnector
tasks.max=1
topics=< Required Configuration >
REST-based example¶
This configuration is used typically along with distributed workers. Write the following json to connector.json, configure all of the required values, and use the command below to post the configuration to one the distributed connect worker(s). Check here for more information about the Kafka Connect REST API
Connect Distributed REST example:
{
"config" : {
"name" : "MapRDBSinkConnector1",
"connector.class" : "io.confluent.connect.mapr.db.MapRDBSinkConnector",
"tasks.max" : "1",
"topics" : "< Required Configuration >"
}
}
Use curl to post the configuration to one of the Kafka Connect Workers. Change http://localhost:8083/ the endpoint of one of your Kafka Connect worker(s).
Create a new connector:
curl -s -X POST -H 'Content-Type: application/json' --data @connector.json http://localhost:8083/connectors
Update an existing connector:
curl -s -X PUT -H 'Content-Type: application/json' --data @connector.json http://localhost:8083/connectors/MapRDBSinkConnector1/config