Thursday, 31 May 2018

PART1 - Step by step Kafka setup on CentOS.

FYI, ZooKeeper  need to setup before start the Kafka.

[root@sankar-devops opt]# wget http://redrockdigimark.com/apachemirror/kafka/1.1.0/kafka_2.12-1.1.0.tgz

[root@sankar-devops opt]# ls -ltrh
total 48M
-rw-r--r--.  1 root root  48M Mar 28 17:35 kafka_2.12-1.1.0.tgz
drwxr-xr-x.  3 root root   60 May 31 02:16 jdk
drwxr-xr-x. 11 1000 1000 4.0K May 31 03:27 zookeeper-3.4.12
[root@sankar-devops opt]#

[root@sankar-devops opt]# tar -xvzf kafka_2.12-1.1.0.tgz 

[root@sankar-devops opt]# ls -ltrh
total 48M
drwxr-xr-x.  6 root root   89 Mar 24 04:25 kafka_2.12-1.1.0
-rw-r--r--.  1 root root  48M Mar 28 17:35 kafka_2.12-1.1.0.tgz
drwxr-xr-x.  3 root root   60 May 31 02:16 jdk
drwxr-xr-x. 11 1000 1000 4.0K May 31 03:27 zookeeper-3.4.12

[root@sankar-devops opt]# cd kafka_2.12-1.1.0
[root@sankar-devops kafka_2.12-1.1.0]# ll
total 48
drwxr-xr-x. 3 root root  4096 Mar 24 04:25 bin
drwxr-xr-x. 2 root root  4096 Mar 24 04:25 config
drwxr-xr-x. 2 root root  4096 May 31 03:30 libs
-rw-r--r--. 1 root root 28824 Mar 24 04:21 LICENSE
-rw-r--r--. 1 root root   336 Mar 24 04:21 NOTICE
drwxr-xr-x. 2 root root    44 Mar 24 04:25 site-docs
[root@sankar-devops kafka_2.12-1.1.0]# cd bin
[root@sankar-devops bin]# ls -l
total 132
-rwxr-xr-x. 1 root root 1421 Mar 24 04:21 connect-distributed.sh
-rwxr-xr-x. 1 root root 1418 Mar 24 04:21 connect-standalone.sh
-rwxr-xr-x. 1 root root  861 Mar 24 04:21 kafka-acls.sh
-rwxr-xr-x. 1 root root  873 Mar 24 04:21 kafka-broker-api-versions.sh
-rwxr-xr-x. 1 root root  864 Mar 24 04:21 kafka-configs.sh
-rwxr-xr-x. 1 root root  945 Mar 24 04:21 kafka-console-consumer.sh
-rwxr-xr-x. 1 root root  944 Mar 24 04:21 kafka-console-producer.sh
-rwxr-xr-x. 1 root root  871 Mar 24 04:21 kafka-consumer-groups.sh
-rwxr-xr-x. 1 root root  948 Mar 24 04:21 kafka-consumer-perf-test.sh
-rwxr-xr-x. 1 root root  871 Mar 24 04:21 kafka-delegation-tokens.sh
-rwxr-xr-x. 1 root root  869 Mar 24 04:21 kafka-delete-records.sh
-rwxr-xr-x. 1 root root  863 Mar 24 04:21 kafka-log-dirs.sh
-rwxr-xr-x. 1 root root  862 Mar 24 04:21 kafka-mirror-maker.sh
-rwxr-xr-x. 1 root root  886 Mar 24 04:21 kafka-preferred-replica-election.sh
-rwxr-xr-x. 1 root root  959 Mar 24 04:21 kafka-producer-perf-test.sh
-rwxr-xr-x. 1 root root  874 Mar 24 04:21 kafka-reassign-partitions.sh
-rwxr-xr-x. 1 root root  868 Mar 24 04:21 kafka-replay-log-producer.sh
-rwxr-xr-x. 1 root root  874 Mar 24 04:21 kafka-replica-verification.sh
-rwxr-xr-x. 1 root root 7864 Mar 24 04:21 kafka-run-class.sh
-rwxr-xr-x. 1 root root 1376 Mar 24 04:21 kafka-server-start.sh
-rwxr-xr-x. 1 root root  997 Mar 24 04:21 kafka-server-stop.sh
-rwxr-xr-x. 1 root root  870 Mar 24 04:21 kafka-simple-consumer-shell.sh
-rwxr-xr-x. 1 root root  945 Mar 24 04:21 kafka-streams-application-reset.sh
-rwxr-xr-x. 1 root root  863 Mar 24 04:21 kafka-topics.sh
-rwxr-xr-x. 1 root root  958 Mar 24 04:21 kafka-verifiable-consumer.sh
-rwxr-xr-x. 1 root root  958 Mar 24 04:21 kafka-verifiable-producer.sh
-rwxr-xr-x. 1 root root 1722 Mar 24 04:21 trogdor.sh
drwxr-xr-x. 2 root root 4096 Mar 24 04:21 windows
-rwxr-xr-x. 1 root root  867 Mar 24 04:21 zookeeper-security-migration.sh
-rwxr-xr-x. 1 root root 1393 Mar 24 04:21 zookeeper-server-start.sh
-rwxr-xr-x. 1 root root 1001 Mar 24 04:21 zookeeper-server-stop.sh
-rwxr-xr-x. 1 root root  968 Mar 24 04:21 zookeeper-shell.sh
[root@sankar-devops bin]#

--------error---
[root@sankar-devops bin]# ./kafka-server-start.sh  config/server.properties
[2018-05-31 03:36:34,288] INFO Registered kafka:type=kafka.Log4jController MBean (kafka.utils.Log4jControllerRegistration$)
[2018-05-31 03:36:34,346] ERROR Exiting Kafka due to fatal exception (kafka.Kafka$)
java.io.FileNotFoundException: config/server.properties (No such file or directory)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:195)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at java.io.FileInputStream.<init>(FileInputStream.java:93)
        at org.apache.kafka.common.utils.Utils.loadProps(Utils.java:510)
        at kafka.Kafka$.getPropsFromArgs(Kafka.scala:44)
        at kafka.Kafka$.main(Kafka.scala:81)
        at kafka.Kafka.main(Kafka.scala)

-----------------


[root@sankar-devops kafka_2.12-1.1.0]# bin/kafka-server-start.sh  config/server.properties
[2018-05-31 03:39:24,455] INFO Registered kafka:type=kafka.Log4jController MBean (kafka.utils.Log4jControllerRegistration$)
[2018-05-31 03:39:25,415] INFO starting (kafka.server.KafkaServer)
[2018-05-31 03:39:25,416] INFO Connecting to zookeeper on localhost:2181 (kafka.server.KafkaServer)
[2018-05-31 03:39:25,455] INFO [ZooKeeperClient] Initializing a new session to localhost:2181. (kafka.zookeeper.ZooKeeperClient)
[2018-05-31 03:39:25,466] INFO Client environment:zookeeper.version=3.4.10-39d3a4f269333c922ed3db283be479f9deacaa0f, built on 03/23/2017 10:13 GMT (org.apache.zookeeper.ZooKeeper)
[2018-05-31 03:39:25,467] INFO Client environment:host.name=sankar-devops.as.domcorp.zetainteractive.com (org.apache.zookeeper.ZooKeeper)
[2018-05-31 03:39:25,467] INFO Client environment:java.version=1.8.0_171 (org.apache.zookeeper.ZooKeeper)
[2018-05-31 03:39:25,467] INFO Client environment:java.vendor=Oracle Corporation (org.apache.zookeeper.ZooKeeper)
[2018-05-31 03:39:25,467] INFO Client environment:java.home=/opt/jdk/jdk1


[root@sankar-devops ~]# jps
11064 QuorumPeerMain
11726 Kafka
12062 Jps

Above two daemons running on the terminal, where QuorumPeerMain is related to ZooKeeper daemon and another one is Kafka daemon.

PART2-Kafka

No comments:

Post a Comment