Docs Menu

Docs HomeMongoDB Kafka Connector

Kafka Connector Tutorial Setup

The tutorials in this section run on a development environment using Docker to package the dependencies and configurations you need to run the MongoDB Connector for Apache Kafka. Make sure you complete the development environment setup steps before proceeding to the tutorials.


Next, clone the tutorial git repository with the following command:

git clone

If you do not have git installed, you can download the zip archive instead.


Select the tab that matches your OS for instructions on how to run the commands in this guide:

Start the Docker image with the following command:

docker-compose -p mongo-kafka up -d --force-recreate


Port Mappings

The sandbox maps the following services to ports on your host machine:

  • The sandbox MongoDB server maps to port 35001 on your host machine

  • The sandbox Kafka Connect JMX server maps to port 35000 on your host machine

These ports must be free to start the sandbox.

The "mongo-kafka-base" image creates a Docker container that includes all the services you need in the tutorial and runs them on a shared network called "mongodb-kafka-base_localnet" as shown in the following diagram:

Diagram that shows the Docker compose containers in mongo-kafka-base

When the command completes successfully, it outputs the following text:

Creating zookeeper ... done
Creating broker ... done
Creating schema-registry ... done
Creating connect ... done
Creating rest-proxy ... done
Creating mongo1 ... done
Creating mongo1-setup ... done

Confirm the development environment started normally by running the following commands:

docker exec mongo1 status

This command should output the following information if the Docker development environment was set up successfully:

Kafka topics:
"topic": "docker-connect-status",
"topic": "docker-connect-offsets",
"topic": "docker-connect-configs",
"topic": "__consumer_offsets",
The status of the connectors:
Currently configured connectors
Version of MongoDB Connector for Apache Kafka installed:

Since you have not started the connectors, the status and configured list are empty.

Your development environment setup is complete and you can proceed to the next step of the tutorial.


Connect To Development Environment MongoDB

You can connect to the MongoDB server running in your development environment with the following connection string:

←  TutorialsExplore MongoDB Change Streams →
Share Feedback
© 2023 MongoDB, Inc.


  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2023 MongoDB, Inc.