Skip to content
官方QQ交流群
技术交流1:87208295   点此加入
技术交流2:787747122   点此加入
官网
云控制台
开放平台
关注微信公众号
代码仓库: 码云

Kafka安装与配置

Kafka是由Apache软件基金会开发的一个开源流处理平台,由Scala和Java编写。Kafka是一种高吞吐量的分布式发布订阅消息系统,它可以处理消费者规模的网站中的所有动作流数据。 这种动作(网页浏览,搜索和其他用户的行动)是在现代网络上的许多社会功能的一个关键因素。 这些数据通常是由于吞吐量的要求而通过处理日志和日志聚合来解决。

在云上购买镜像后,请参考本章关于kafka镜像的安装路径、配置说明以及常见的操作命令等

版本

以镜像的最新版本为例:
软件版本:Kafka1.0.1-1(Bitnami版)
环境软件:Java1.8.0_16,Zookeeper3.4.9,OpenSSL

目录

名称路径
Kafka安装路径/opt/kafka-*
Kafka配置文件路径/opt/kafka-*/config
Kafka日志文件路径/opt/kafka-*/kafka/logs/
Java安装路径/opt/kafka-*/java/
Zookeeper配置文件路径/opt/zookeeper/conf/
Zookeeper日志文件/opt/zookeeper/tmp/zookeeper.out.

*代指版本号

端口 Kafka使用的默认端口号为:9092 Zookeeper使用的默认端口号为:2181

开始使用

如何使用kafka构建Broker Cluster?
https://docs.bitnami.com/virtual-machine/infrastructure/kafka//#kafka-default-configuration

如何在一个服务器实例上运行Kafka生产者和消费者?
https://docs.bitnami.com/virtual-machine/infrastructure/kafka//#how-to-run-a-kafka-producer-and-consumer-from-the-server-itself

如何在从外部访问Kafka?
https://docs.bitnami.com/virtual-machine/infrastructure/kafka//#how-to-connect-to-kafka-from-a-different-machine

常见命令

本镜像提供了启停脚本,cd到安装目录后,运行./ctlscript.sh

[root@iZ2ze6yhnik25xrq39dyxnZ ~]# cd /opt/kafka-1.0.1-0/
[root@iZ2ze6yhnik25xrq39dyxnZ kafka-1.0.1-0]# ./ctlscript.sh
usage: ./ctlscript.sh help
       ./ctlscript.sh (start|stop|restart|status)
       ./ctlscript.sh (start|stop|restart|status) zookeeper
       ./ctlscript.sh (start|stop|restart|status) kafka

help       - this screen
start      - start the service(s)
stop       - stop  the service(s)
restart    - restart or start the service(s)
status     - show the status of the service(s)
[root@iZ2ze6yhnik25xrq39dyxnZ ~]# cd /opt/kafka-1.0.1-0/
[root@iZ2ze6yhnik25xrq39dyxnZ kafka-1.0.1-0]# ./ctlscript.sh
usage: ./ctlscript.sh help
       ./ctlscript.sh (start|stop|restart|status)
       ./ctlscript.sh (start|stop|restart|status) zookeeper
       ./ctlscript.sh (start|stop|restart|status) kafka

help       - this screen
start      - start the service(s)
stop       - stop  the service(s)
restart    - restart or start the service(s)
status     - show the status of the service(s)

Copyright © 2017 10yun.com | 十云提供计算服务-IPV6 | ctocode组开发