Kafka-2.11 Study notes (ii) Shell script Introduction

Source: Internet
Author: User
Tags zookeeper

Welcome to: Ruchunli's work notes, learning is a faith that allows time to test the strength of persistence.


Kafka The main shell scripts are

[[Email protected] kafka0.8.2.1]$ ll Total  80-rwxr-xr-x 1 hadoop hadoop   943 2015-02-27 kafka-console-consumer.sh-rwxr-xr-x 1 hadoop hadoop   942 2015-02-27 kafka-console-producer.sh-rwxr-xr-x 1 hadoop hadoop  870  2015-02-27 kafka-consumer-offset-checker.sh-rwxr-xr-x 1 hadoop hadoop  946  2015-02-27 kafka-consumer-perf-test.sh-rwxr-xr-x 1 hadoop hadoop  860  2015-02-27 kafka-mirror-maker.sh-rwxr-xr-x 1 hadoop hadoop  884  2015-02-27 kafka-preferred-replica-election.sh-rwxr-xr-x 1 hadoop hadoop  946  2015-02-27 kafka-producer-perf-test.sh-rwxr-xr-x 1 hadoop hadoop  872  2015-02-27 kafka-reassign-partitions.sh-rwxr-xr-x 1 hadoop hadoop  866  2015-02-27 kafka-replay-log-producer.sh-rwxr-xr-x 1 hadoop hadoop  872 2015-02-27  kafka-replica-verification.sh-rwxr-xr-x 1 hadoop hadoop 4185 2015-02-27  kafka-run-class.sh-rwxr-xr-x 1 hadoop hadoop 1333 2015-02-27  kafka-server-start.sh-rwxr-xr-x 1 hadoop hadoop  891 2015-02-27  kafka-server-stop.sh-rwxr-xr-x 1 hadoop hadoop  868 2015-02-27  kafka-simple-consumer-shell.sh-rwxr-xr-x 1 hadoop hadoop  861 2015-02-27  Kafka-topics.shdrwxr-xr-x 2 hadoop hadoop 4096 2015-02-27 windows-rwxr-xr-x  1 hadoop hadoop 1370 2015-02-27 zookeeper-server-start.sh-rwxr-xr-x 1  hadoop hadoop  875 2015-02-27 zookeeper-server-stop.sh-rwxr-xr-x 1  hadoop hadoop  968 2015-02-27 zookeeper-shell.sh[[email protected] kafka0.8.2.1]$ 

Description: Kafka also provides a bat script that runs under Windows in the Bin/windows directory.


Zookeeper script

Kafka each component is dependent on the zookeeper environment, so you need to have a zookeeper environment first before using Kafka, you can configure zookeeper clusters, or you can use Kafka integrated zookeeper scripts to start a standalone The zookeeper node of mode.

#  Start zookeeper server[[email protected] kafka0.8.2.1]$ bin/zookeeper-server-start.sh  USAGE: bin/zookeeper-server-start.sh zookeeper.properties#  configuration file path is config/ Zookeeper.properties, the primary configuration of the zookeeper local storage path (DATADIR) #  internal implementation to invoke exec  $base _dir/kafka-run-class.sh $ extra_args org.apache.zookeeper.server.quorum.quorumpeermain [email protected]#  Stop zookeeper server[[email protected] kafka0.8.2.1]$ bin/zookeeper-server-stop.sh #   internal implementation for calling ps ax | grep -i  ' zookeeper '  | grep -v grep |  awk  ' {print $1} '  | xargs kill -SIGINT#  setting server parameters [[email protected]  kafka0.8.2.1]$ zookeeper-shell.shusage: bin/zookeeper-shell.sh zookeeper_host:port[/path]  [args ...] #  internal implementation is called exec $ (dirname $0)/kafka-run-class.sh org.apache.zookeeper.zookeepermain - server  "[Email protectEd] " 

Description:[email protected] represents all parameter lists. $# the number of arguments added to the shell .


Kafka Start and stop

# start Kafka Server[[email protected] kafka0.8.2.1]$ bin/kafka-server-start.sh usage:bin/kafka-server-start.sh [-daemon] Server.properties# is implemented internally to call exec $base _dir/kafka-run-class.sh $EXTRA _args Kafka. Kafka [email protected]# [email protected] kafka0.8.2.1]$ bin/kafka-run-class.sh # Stop Kafka server[[email protected] Kaf ka0.8.2.1]$ kafka-server-stop.sh# internal implementation for calling PS Ax | Grep-i ' Kafka\. Kafka ' | grep java | Grep-v grep | awk ' {print '} ' | Xargs Kill-sigterm

Description: The configuration information is read from Config/server.properties at Kafka startup, where the three core configuration items that Kafka server starts are:

The unique identifier of the Broker.id:broker, which is a non-negative integer (the last group of IP can be taken) Port:server the connection information for the port that listens for client connections (default is 9092) Zookeeper.connect:ZK, in the format hostname1 :p ort1[,hostname2:port2,hostname3:port3]# The path to the optional Log.dirs:Kafka data store (default is/tmp/kafka-logs), one or more directory lists separated by commas. When a new partition is created, at this point in which directory partition the fewest number, the newly created partition will be placed in that directory. Num.partitions:Topic number of partition (default is 1), you can specify # other references when creating topic Http://kafka.apache.org/documentation.html#configuration


Kafka Message

kafka-console-producer.sh


kafka-console-consumer.sh


kafka-topics.sh

This article is from the "world of Stuffy Gourd" blog, please be sure to keep this source http://luchunli.blog.51cto.com/2368057/1712530

Kafka-2.11 Study notes (ii) Shell script Introduction

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.