Featured Post

How to Check Column Nulls and Replace: Pandas

Here is a post that shows how to count Nulls and replace them with the value you want in the Pandas Dataframe. We have explained the process in two steps - Counting and Replacing the Null values. Count null values (column-wise) in Pandas ## count null values column-wise null_counts = df.isnull(). sum() print(null_counts) ``` Output: ``` Column1    1 Column2    1 Column3    5 dtype: int64 ``` In the above code, we first create a sample Pandas DataFrame `df` with some null values. Then, we use the `isnull()` function to create a DataFrame of the same shape as `df`, where each element is a boolean value indicating whether that element is null or not. Finally, we use the `sum()` function to count the number of null values in each column of the resulting DataFrame. The output shows the count of null values column-wise. to count null values column-wise: ``` df.isnull().sum() ``` ##Code snippet to count null values row-wise: ``` df.isnull().sum(axis=1) ``` In the above code, `df` is the Panda

How to Check Kafka Available 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 release, Kafka offers transactional writes, which provide an exactly-once stream.

Keep Reading


Popular posts from this blog

Explained Ideal Structure of Python Class

6 Python file Methods Real Usage