Tuesday, October 10, 2023

Apacha Kafka Java producer and consumer

HOWTO 


 Java producer code
package dave;

import java.util.Properties;

import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.common.serialization.StringSerializer;

public class SimpleProducer {
    public static void main(String args[])
    {
        String bootstrapServers="127.0.0.1:9092";
        Properties properties=new Properties();
        properties.setProperty(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
        properties.setProperty(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());
        properties.setProperty(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());

        KafkaProducer<String,String> producer = new KafkaProducer<String, String>(properties);

        ProducerRecord<String, String> record = new ProducerRecord<String, String>("topic", "Hello");
        producer.send(record);
        producer.flush();
        producer.close();
    }
}

CLI start
$ mvn exec:java -Dexec.mainClass="dave.SimpleProducer"

Java consumer code
package dave;

import java.util.Arrays;
import java.time.Duration;
import java.util.Properties;

import org.apache.kafka.clients.consumer.KafkaConsumer;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.apache.kafka.clients.consumer.ConsumerRecords;
import org.apache.kafka.common.serialization.StringDeserializer;

public class SimpleConsumer {
    public static void main(String args[])
    {
        String bootstrapServers="127.0.0.1:9092";
        String group_id="my_consumer_group";
        String topic="topic";

        Properties properties=new Properties();
        properties.setProperty(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
        properties.setProperty(ConsumerConfig.GROUP_ID_CONFIG, group_id);
        properties.setProperty(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
        properties.setProperty(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, StringDeserializer.class.getName());
        properties.setProperty(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "earliest");

        KafkaConsumer<String,String> consumer= new KafkaConsumer<String,String>(properties);
        consumer.subscribe(Arrays.asList(topic));

        while(true) {
            ConsumerRecords<String,String> records=consumer.poll(Duration.ofMillis(100));
            for(ConsumerRecord<String,String> record: records){
                System.out.println("Key: "+ record.key() + ", Value:" +record.value());
                System.out.println("Partition:" + record.partition()+",Offset:"+record.offset());
            }
        }
    }
}

CLI start
 mvn exec:java -Dexec.mainClass="dave.SimpleConsumer"

Apache Kafka Connect

 HOWTO


Check plugin.path


config/connect-standalone.properties

plugin.path=libs/

File connector

$ bin/connect-standalone.sh config/connect-standalone.properties config/connect-file-sink.properties

file connector config
name=local-file-sink
connector.class=FileStreamSink
tasks.max=1
file=test.sink.txt
topics=connect-test
key.converter=org.apache.kafka.connect.storage.StringConverter
value.converter=org.apache.kafka.connect.storage.StringConverter
key.converter.schemas.enable=false
value.converter.schemas.enable=false
JSON connector
name=local-file-sink
connector.class=FileStreamSink
tasks.max=1
file=test.sink.txt
topics=connect-test
key.converter=org.apache.kafka.connect.json.JsonConverter
value.converter=org.apache.kafka.connect.json.JsonConverter
key.converter.schemas.enable=false
value.converter.schemas.enable=false

Apacha Kafka Partition replications

HOWTO 

 Partition replications 
Topic with one partition that is replicated 3 times
$ bin/kafka-topics.sh --bootstrap-server localhost:9094 --create --topic test_topic_2 --replication-factor 3
WARNING: Due to limitations in metric names, topics with a period ('.') or underscore ('_') could collide. To avoid issues it is best to use either, but not both.
Created topic test_topic_2.
[dave@dave kafka_2.12-3.5.1]$ bin/kafka-topics.sh --bootstrap-server localhost:9094 --describe --topic test_topic_2
Topic: test_topic_2    TopicId: q-EXSFY7RCq3RpSDblxW9Q    PartitionCount: 1    ReplicationFactor: 3    Configs: 
    Topic: test_topic_2    Partition: 0    Leader: 103    Replicas: 103,102,106    Isr: 103,102,106

server log
[2023-10-10 10:33:55,854] WARN [ReplicaFetcher replicaId=106, leaderId=103, fetcherId=0] Received UNKNOWN_TOPIC_ID from the leader for partition test_topic_2-0. This error may be returned transiently when the partition is being created or deleted, but it is not expected to persist. (kafka.server.ReplicaFetcherThread)

Topic with three partitions that are replicated
$ bin/kafka-topics.sh --bootstrap-server localhost:9094 --create --topic test_topic_3 --replication-factor 3 --partitions 3
WARNING: Due to limitations in metric names, topics with a period ('.') or underscore ('_') could collide. To avoid issues it is best to use either, but not both.
Created topic test_topic_3.

$ bin/kafka-topics.sh --bootstrap-server localhost:9094 --describe --topic test_topic_3
Topic: test_topic_3    TopicId: lMuEiHIXSZGtJnSkdxSdUg    PartitionCount: 3    ReplicationFactor: 3    Configs: 
    Topic: test_topic_3    Partition: 0    Leader: 106    Replicas: 106,103,102    Isr: 106,103,102
    Topic: test_topic_3    Partition: 1    Leader: 103    Replicas: 103,102,106    Isr: 103,102,106
    Topic: test_topic_3    Partition: 2    Leader: 102    Replicas: 102,106,103    Isr: 102,106,103

Kafka logs
$ ls  -lt /app/kafka/logs2/
total 32
-rw-r--r--. 1 dave dave  72 Oct 10 10:41 replication-offset-checkpoint
-rw-r--r--. 1 dave dave   4 Oct 10 10:40 log-start-offset-checkpoint
-rw-r--r--. 1 dave dave  72 Oct 10 10:40 recovery-point-offset-checkpoint
drwxr-xr-x. 1 dave dave 242 Oct 10 10:37 test_topic_3-0
drwxr-xr-x. 1 dave dave 242 Oct 10 10:37 test_topic_3-1
drwxr-xr-x. 1 dave dave 242 Oct 10 10:37 test_topic_3-2
drwxr-xr-x. 1 dave dave 242 Oct 10 10:33 test_topic_2-0
-rw-r--r--. 1 dave dave  91 Oct 10 10:04 meta.properties
-rw-r--r--. 1 dave dave   0 Oct 10 09:53 cleaner-offset-checkpoint

Specify replica assignments
$ bin/kafka-topics.sh --bootstrap-server localhost:9094 --create --topic test_topic_4 --replica-assignment 102:103,103:106
WARNING: Due to limitations in metric names, topics with a period ('.') or underscore ('_') could collide. To avoid issues it is best to use either, but not both.
[dave@dave kafka_2.12-3.5.1]$ bin/kafka-topics.sh --bootstrap-server localhost:9094 --create --topic test_topic_5 --replica-assignment 102:103:106
WARNING: Due to limitations in metric names, topics with a period ('.') or underscore ('_') could collide. To avoid issues it is best to use either, but not both.
Created topic test_topic_5.

describe topic
$ bin/kafka-topics.sh --bootstrap-server localhost:9094 --describe --topic test_topic_3
Topic: test_topic_3    TopicId: lMuEiHIXSZGtJnSkdxSdUg    PartitionCount: 3    ReplicationFactor: 3    Configs: 
    Topic: test_topic_3    Partition: 0    Leader: 106    Replicas: 106,103,102    Isr: 106,103,102
    Topic: test_topic_3    Partition: 1    Leader: 103    Replicas: 103,102,106    Isr: 103,102,106
    Topic: test_topic_3    Partition: 2    Leader: 102    Replicas: 102,106,103    Isr: 102,106,103

Apacha Kafka list active brokers

HOWTO

$ ./bin/zookeeper-shell.sh localhost:2181 ls /brokers/ids
Connecting to localhost:2181

WATCHER::

WatchedEvent state:SyncConnected type:None path:null
[102, 103, 106]

Server config - broker.id
$ grep broker.id config/server*
config/server1.properties:broker.id=106
config/server2.properties:broker.id=102
config/server3.properties:broker.id=103

JPS
$ jps -l
20116 kafka.Kafka
19685 kafka.Kafka
22633 jdk.jcmd/sun.tools.jps.Jps
20538 kafka.Kafka
18650 org.apache.zookeeper.server.quorum.QuorumPeerMain

Apache Kafka CLI kcat

 HOWTO


Install kcat
$ sudo dnf install kafkacat
[sudo] password for dave: 
Last metadata expiration check: 0:30:11 ago on Tue 10 Oct 2023 08:36:11 AM CEST.
Dependencies resolved.
=================================================================================================================================================
 Package                            Architecture                   Version                                 Repository                       Size
=================================================================================================================================================
Installing:
 kcat                               x86_64                         1.7.1-1.fc37                            updates                          39 k
Installing dependencies:
 librdkafka                         x86_64                         1.6.1-5.fc37                            fedora                          662 k

Transaction Summary
=================================================================================================================================================
Install  2 Packages

Total download size: 701 k
Installed size: 2.1 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): kcat-1.7.1-1.fc37.x86_64.rpm                                                                              192 kB/s |  39 kB     00:00    
(2/2): librdkafka-1.6.1-5.fc37.x86_64.rpm                                                                        2.8 MB/s | 662 kB     00:00    
-------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                            1.0 MB/s | 701 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                         1/1 
  Installing       : librdkafka-1.6.1-5.fc37.x86_64                                                                                          1/2 
  Installing       : kcat-1.7.1-1.fc37.x86_64                                                                                                2/2 
  Running scriptlet: kcat-1.7.1-1.fc37.x86_64                                                                                                2/2 
  Verifying        : librdkafka-1.6.1-5.fc37.x86_64                                                                                          1/2 
  Verifying        : kcat-1.7.1-1.fc37.x86_64                                                                                                2/2 

Installed:
  kcat-1.7.1-1.fc37.x86_64                                             librdkafka-1.6.1-5.fc37.x86_64                                            

Complete!
[dave@dave go]$ which kcat
/usr/bin/kcat

list server state
$ kcat -b localhost:9094 -L
Metadata for all topics (from broker -1: localhost:9094/bootstrap):
 3 brokers:
  broker 106 at dave:9096 (controller)
  broker 103 at dave:9095
  broker 102 at dave:9094
 7 topics:
  topic "test_topic_5" with 1 partitions:
    partition 0, leader 102, replicas: 102,103,106, isrs: 102,103,106
  topic "test1" with 1 partitions:
    partition 0, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
  topic "test_topic_2" with 1 partitions:
    partition 0, leader 103, replicas: 103,102,106, isrs: 103,102,106
  topic "__consumer_offsets" with 50 partitions:
    partition 0, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 1, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 2, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 3, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 4, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 5, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 6, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 7, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 8, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 9, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 10, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 11, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 12, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 13, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 14, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 15, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 16, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 17, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 18, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 19, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 20, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 21, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 22, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 23, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 24, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 25, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 26, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 27, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 28, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 29, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 30, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 31, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 32, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 33, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 34, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 35, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 36, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 37, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 38, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 39, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 40, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 41, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 42, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 43, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 44, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 45, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 46, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 47, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 48, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 49, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
  topic "test_topic_3" with 3 partitions:
    partition 0, leader 106, replicas: 106,103,102, isrs: 106,103,102
    partition 1, leader 103, replicas: 103,102,106, isrs: 103,102,106
    partition 2, leader 102, replicas: 102,106,103, isrs: 102,106,103
  topic "test_topic_4" with 2 partitions:
    partition 0, leader 102, replicas: 102,103, isrs: 102,103
    partition 1, leader 103, replicas: 103,106, isrs: 103,106
  topic "T3" with 1 partitions:
    partition 0, leader -1, replicas: 100, isrs: 100, Broker: Leader not available

Monday, October 9, 2023

Kafka producer and consumer

 HOWTO

 

 

Kafka producer

 bin/kafka-console-producer.sh --bootstrap-server=localhost:9092 --topic=test1 
>Hi from dave
[2023-10-09 14:29:27,126] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 4 : {test1=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
[2023-10-09 14:29:27,231] WARN [Producer clientId=console-producer] Error while fetching metadata with correlation id 5 : {test1=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)
>dave
>dave

Server logs

[2023-10-09 13:52:42,475] INFO [MetadataCache brokerId=0] Updated cache from existing <empty> to latest FinalizedFeaturesAndEpoch(features=Map(), epoch=0). (kafka.server.metadata.ZkMetadataCache)
[2023-10-09 13:52:42,479] INFO [TransactionCoordinator id=0] Starting up. (kafka.coordinator.transaction.TransactionCoordinator)
[2023-10-09 13:52:42,483] INFO [TxnMarkerSenderThread-0]: Starting (kafka.coordinator.transaction.TransactionMarkerChannelManager)
[2023-10-09 13:52:42,483] INFO [TransactionCoordinator id=0] Startup complete. (kafka.coordinator.transaction.TransactionCoordinator)
[2023-10-09 13:52:42,542] INFO [ExpirationReaper-0-AlterAcls]: Starting (kafka.server.DelayedOperationPurgatory$ExpiredOperationReaper)
[2023-10-09 13:52:42,566] INFO [Controller id=0, targetBrokerId=0] Node 0 disconnected. (org.apache.kafka.clients.NetworkClient)
[2023-10-09 13:52:42,570] WARN [Controller id=0, targetBrokerId=0] Connection to node 0 (dave/192.168.0.115:9092) could not be established. Broker may not be available. (org.apache.kafka.clients.NetworkClient)
[2023-10-09 13:52:42,575] INFO [Controller id=0, targetBrokerId=0] Client requested connection close from node 0 (org.apache.kafka.clients.NetworkClient)
[2023-10-09 13:52:42,580] INFO [/config/changes-event-process-thread]: Starting (kafka.common.ZkNodeChangeNotificationListener$ChangeEventProcessThread)
[2023-10-09 13:52:42,603] INFO [SocketServer listenerType=ZK_BROKER, nodeId=0] Enabling request processing. (kafka.network.SocketServer)
[2023-10-09 13:52:42,608] INFO Awaiting socket connections on 0.0.0.0:9092. (kafka.network.DataPlaneAcceptor)
[2023-10-09 13:52:42,650] INFO Kafka version: 3.5.1 (org.apache.kafka.common.utils.AppInfoParser)
[2023-10-09 13:52:42,650] INFO Kafka commitId: 2c6fb6c54472e90a (org.apache.kafka.common.utils.AppInfoParser)
[2023-10-09 13:52:42,650] INFO Kafka startTimeMs: 1696852362645 (org.apache.kafka.common.utils.AppInfoParser)
[2023-10-09 13:52:42,652] INFO [KafkaServer id=0] started (kafka.server.KafkaServer)
[2023-10-09 13:52:42,756] INFO [zk-broker-0-to-controller-forwarding-channel-manager]: Recorded new controller, from now on will use node dave:9092 (id: 0 rack: null) (kafka.server.BrokerToControllerRequestThread)
[2023-10-09 13:52:42,833] INFO [zk-broker-0-to-controller-alter-partition-channel-manager]: Recorded new controller, from now on will use node dave:9092 (id: 0 rack: null) (kafka.server.BrokerToControllerRequestThread)
[2023-10-09 14:29:27,102] INFO Creating topic test1 with configuration {} and initial partition assignment Map(0 -> ArrayBuffer(0)) (kafka.zk.AdminZkClient)
[2023-10-09 14:29:27,170] INFO [Controller id=0, targetBrokerId=0] Node 0 disconnected. (org.apache.kafka.clients.NetworkClient)
[2023-10-09 14:29:27,200] INFO [ReplicaFetcherManager on broker 0] Removed fetcher for partitions Set(test1-0) (kafka.server.ReplicaFetcherManager)
[2023-10-09 14:29:27,260] INFO [LogLoader partition=test1-0, dir=/app/kafka/logs] Loading producer state till offset 0 with message format version 2 (kafka.log.UnifiedLog$)
[2023-10-09 14:29:27,278] INFO Created log for partition test1-0 in /app/kafka/logs/test1-0 with properties {} (kafka.log.LogManager)
[2023-10-09 14:29:27,279] INFO [Partition test1-0 broker=0] No checkpointed highwatermark is found for partition test1-0 (kafka.cluster.Partition)
[2023-10-09 14:29:27,281] INFO [Partition test1-0 broker=0] Log loaded for partition test1-0 with initial high watermark 0 (kafka.cluster.Partition)

Kafka consumer

$ bin/kafka-console-consumer.sh --bootstrap-server=localhost:9092 --topic=test1  
aa
bb

Kafka
]$ ls -l /app/kafka/logs/
total 220
-rw-r--r--. 1 dave dave    0 Oct  9 13:52 cleaner-offset-checkpoint
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-0
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-1
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-10
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-11
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-12
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-13
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-14
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-15
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-16
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-17
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-18
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-19
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-2
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-20
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-21
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-22
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-23
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-24
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-25
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-26
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-27
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-28
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-29
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-3
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-30
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-31
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-32
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-33
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-34
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-35
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-36
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-37
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-38
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-39
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-4
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-40
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-41
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-42
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-43
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-44
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-45
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-46
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-47
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-48
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-49
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-5
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-6
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-7
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-8
drwxr-xr-x. 1 dave dave  242 Oct  9 14:35 __consumer_offsets-9
-rw-r--r--. 1 dave dave    4 Oct  9 14:37 log-start-offset-checkpoint
-rw-r--r--. 1 dave dave   89 Oct  9 13:52 meta.properties
-rw-r--r--. 1 dave dave 1205 Oct  9 14:37 recovery-point-offset-checkpoint
-rw-r--r--. 1 dave dave 1205 Oct  9 14:38 replication-offset-checkpoint
drwxr-xr-x. 1 dave dave  242 Oct  9 14:29 test1-0

topic test-1
$ ls -l /app/kafka/logs/test1-0/
total 12
-rw-r--r--. 1 dave dave 10485760 Oct  9 14:29 00000000000000000000.index
-rw-r--r--. 1 dave dave      364 Oct  9 14:35 00000000000000000000.log
-rw-r--r--. 1 dave dave 10485756 Oct  9 14:29 00000000000000000000.timeindex
-rw-r--r--. 1 dave dave        8 Oct  9 14:29 leader-epoch-checkpoint
-rw-r--r--. 1 dave dave       43 Oct  9 14:29 partition.metadata

Consumer group
 bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --describe --group skupina1

GROUP           TOPIC           PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG             CONSUMER-ID                                           HOST            CLIENT-ID
skupina1        T3              0          76              76              0               console-consumer-0b468664-6bfe-4185-ac0f-cc27d6dd857a /192.168.0.115  console-consumer

list groups
 bin/kafka-consumer-groups.sh --bootstrap-server localhost:9092 --list
skupina1
skupina2

Kafka shells