Featured Post

15 Python Tips : How to Write Code Effectively

Image
 Here are some Python tips to keep in mind that will help you write clean, efficient, and bug-free code.     Python Tips for Effective Coding 1. Code Readability and PEP 8  Always aim for clean and readable code by following PEP 8 guidelines.  Use meaningful variable names, avoid excessively long lines (stick to 79 characters), and organize imports properly. 2. Use List Comprehensions List comprehensions are concise and often faster than regular for-loops. Example: squares = [x**2 for x in range(10)] instead of creating an empty list and appending each square value. 3. Take Advantage of Python’s Built-in Libraries  Libraries like itertools, collections, math, and datetime provide powerful functions and data structures that can simplify your code.   For example, collections.Counter can quickly count elements in a list, and itertools.chain can flatten nested lists. 4. Use enumerate Instead of Range     When you need both the index ...

How to Check Kafka Available Brokers

Brokers


Here's the command to check the list of brokers present in a Kafka Cluster. You can say the Broker is the heart of the Kafka cluster. In simple terms, it works as a process.

The main function is to receive messages from publishers and gives permission to access messages by consumers.

How to Check Available Brokers in Kafka

Here is the command:

linux$ ./zookeeper-shell.sh zookeeper-IPaddress:2181 | "ls /brokers/ids"

Just use the above command to get the number of brokers present in your host (Kafka Cluster).

What is Default Broker-id in Kafka 

The default broker id is -1. When you create a new broker, it adds to -1. Then, it gives a new broker id. The broker ids will be generated from reserved.broker.max.id + 1.


Types of broker ids.

  1. Use assigned
  2. Zookeeper generated broker id.


According to Wiki:

Kafka runs on a cluster of one or more servers (called brokers), and the partitions of all topics are distributed across the cluster nodes. 


Overview of Kafka

Additionally, partitions are replicated to multiple brokers. This architecture allows Kafka to deliver massive streams of messages in a fault-tolerant fashion and has allowed it to replace some of the conventional messaging systems like Java Message Service (JMS), Advanced Message Queuing Protocol (AMQP), etc. Since the 0.11.0.0 release, Kafka offers transactional writes, which provide an exactly-once stream.


Keep Reading

Comments

Popular posts from this blog

How to Fix datetime Import Error in Python Quickly

SQL Query: 3 Methods for Calculating Cumulative SUM

Big Data: Top Cloud Computing Interview Questions (1 of 4)