Q-1). Why the connection is not established between Mongo DB and Apache Kafka?
A-1). This one of the most common problem as faced while connecting Mongo DB with Apache Kafka by using the connector concept. The main problem to this issue is incorrect configuration of he Connector.
- At first you need to install Kafka
- Install Mongo DB
- Run Zookeeper
- Run Kafka Server
- Install Mongo Kafka Connector
- Inside the Mongo Kafka Connector folder there is a config folder
- Inside that config folder you have to put the json configuration files
- If you want a source connector means it will fetch the data from Mongo DB and published the data in a Kafka Topic, you have to put the configuration for the source connector in .json file
- And if you want a sink connector means it will fetch the data from a Kafka Topic and persist it in Mongo DB, then you have to put the sink connector related configurations in the .json file
If these configurations are not proper then one can experience the connection related problems.
Q-2). Why the connection not established between the different components?
A-2). Another problem is the Network Connectivity between the different components like Apache Kafka Server or Mongo Kafka Connector or Mongo DB instance. One must ensure that the network is functioning correctly, and both the Mongo DB instance and Kafka Servers are reachable.
Q-3). What if in the connector configuration one didn’t mention the Authentication and Authorization as used in MongoDB connection?
A-3). In such case it will not connect, and throws the exception. The MongoDB Connector requires authentication and authorization to connect to MongoDB instance. One need to ensure that the credentials provided in the connector configuration file are correct ad have sufficient privileges to access the data.
Q-4). What will happen if we use an old version Of Mongo DB or Kafka?
A-4). It will not work. Let’s say you are using an updated version of Mongo Kafka Connector while you are using an old version of MongoDB or Kafka Server it will not connect. The version of the Mongo Kafka Connector should be compatible with the version of Mongo DB and Kafka Server.
Q-5). What happens if the Data Schema is not valid?
A-5). It will not work. The Mongo Kafka Connector requires a valid schema to work properly. The data schema should be compatible with the Kafka Topic’s Schema.
Q-6). Will it create any problem if the proper Data Formats are not used in Mongo Kafka Connector?
A-6). Yes, it will create problem as most of the times Mongo Kafka Connector supports Data formats like JSON and BSON. One must need to be sure that the data format used is supported by the Mongo Kafka Connector.
Q-7). What if the port no defined in the connector is wrong?
A-7). If the port used in the configuration file for the connector is different it will not work. One must verify that the port used by the Mongo DB and the port used by the Kafka Server are properly and appropriately defined in the configuration of the Mongo Kafka Connector.