kafka 集群的部署安装

这里我们罗列一下我们的环境
10.19.18.88 zk1
10.19.16.84 zk2
10.19.11.44 zk3

 

这里公司需要接入kafka用于zipkin来定位调用链

kafka 的地址是http://kafka.apache.org/

zipkin 的地址是https://github.com/openzipkin/zipkin/tree/master/zipkin-server#environment-variables

kafka-manager 地址是https://github.com/yahoo/kafka-manager

这里首先我们现在kafka的下载包

kafka     download      http://kafka.apache.org/downloads      https://archive.apache.org/dist/kafka/0.11.0.0/kafka_2.11-0.11.0.0.tgz

 


下载包之后我们直接解压使用,因为这里我们环境已经配置过zookeeper

所以这里我就不配置kafka/config/zookeeper.properties

我们直接修改kafka的配置文件:

# The id of the broker. This must be set to a unique integer for each broker.  
broker.id=1
############################# Socket Server Settings #############################  
listeners=PLAINTEXT://10.19.18.88:1092
port=1092
host.name=10.19.18.88
# The number of threads handling network requests  
num.network.threads=8
# The number of threads doing disk I/O  
num.io.threads=8
# The send buffer (SO_SNDBUF) used by the socket server  
socket.send.buffer.bytes=1048576
# The receive buffer (SO_RCVBUF) used by the socket server  
socket.receive.buffer.bytes=1048576
# The maximum size of a request that the socket server will accept (protection against OOM)  
socket.request.max.bytes=104857600
# The number of queued requests allowed before blocking the network threads  
queued.max.requests=100
# The purge interval (in number of requests) of the fetch request purgatory  
fetch.purgatory.purge.interval.requests=200
# The purge interval (in number of requests) of the producer request purgatory  
producer.purgatory.purge.interval.requests=200############################# Log Basics #############################  
# A comma seperated list of directories under which to store log files  
log.dirs=/data/package/kafka/kafka-logs
# The default number of log partitions per topic.   
num.partitions=24
# The number of threads per data directory to be used for log recovery at startup and flushing at shutdown.  
num.recovery.threads.per.data.dir=2
# The maximum size of message that the server can receive  
message.max.bytes=1000000
# Enable auto creation of topic on the server  
auto.create.topics.enable=true
# The interval with which we add an entry to the offset index  
log.index.interval.bytes=4096
# The maximum size in bytes of the offset index  
log.index.size.max.bytes=10485760
# Allow to delete topics
delete.topic.enable=true
############################# Log Flush Policy #############################  
# The number of messages to accept before forcing a flush of data to disk  
log.flush.interval.messages=20000
# The maximum amount of time a message can sit in a log before we force a flush  
log.flush.interval.ms=10000
# The frequency in ms that the log flusher checks whether any log needs to be flushed to disk  
log.flush.scheduler.interval.ms=2000
############################# Log Retention Policy #############################  
# The minimum age of a log file to be eligible for deletion  
log.retention.hours=168
# A size-based retention policy for logs.   
log.retention.bytes=1073741824
# The maximum size of a log segment file. When this size is reached a new log segment will be created.  
log.segment.bytes=1073741824
# The interval at which log segments are checked to see if they can be deleted according  
# to the retention policies  
log.retention.check.interval.ms=300000
# The maximum time before a new log segment is rolled out (in hours)  
log.roll.hours=168
############################# Zookeeper #############################  
# Zookeeper connection string (see zookeeper docs for details).  
zookeeper.connect=10.19.18.88:12081,10.19.16.84:12081,10.19.11.44:12081
# Timeout in ms for connecting to zookeeper  
zookeeper.connection.timeout.ms=6000
# How far a ZK follower can be behind a ZK leader  
zookeeper.sync.time.ms=2000############################# Replication configurations ################  
# default replication factors for automatically created topics  
default.replication.factor=3
# Number of fetcher threads used to replicate messages from a source broker.  
num.replica.fetchers=4
# The number of bytes of messages to attempt to fetch for each partition.  
replica.fetch.max.bytes=1048576
# max wait time for each fetcher request issued by follower replicas.   
replica.fetch.wait.max.ms=500
# The frequency with which the high watermark is saved out to disk  
replica.high.watermark.checkpoint.interval.ms=5000
# The socket timeout for network requests.  
replica.socket.timeout.ms=30000
# The socket receive buffer for network requests  
replica.socket.receive.buffer.bytes=65536
# If a follower hasn't sent any fetch requests or hasn't consumed up to the leaders log end offset for at least this time, the leader will remove the follower from isr  
replica.lag.time.max.ms=10000
# The socket timeout for controller-to-broker channels  
controller.socket.timeout.ms=30000
controller.message.queue.size=10

这里不同的就是上面红色标注的,我们这里有三台机器组成的kafka集群

 

vim bin/kafka-server-start.sh
修改最后一行#exec $base_dir/kafka-run-class.sh $EXTRA_ARGS kafka.Kafka "$@"
exec $base_dir/kafka-run-class.sh $EXTRA_ARGS kafka.Kafka "/data/package/kafka/config/server.properties"

 同样的方法,我们修改一下其他的两台server的配置文件

然后我们就可以一次启动kafka了。

最后我们安装kafka-manager

功能:
为了简化开发者和服务工程师维护Kafka集群的工作,yahoo构建了一个叫做Kafka管理器的基于Web工具,叫做 Kafka Manager。这个管理工具可以很容易地发现分布在集群中的哪些topic分布不均匀,或者是分区在整个集群分布不均匀的的情况。它支持管理多个集群、选择副本、副本重新分配以及创建Topic。同时,这个管理工具也是一个非常好的可以快速浏览这个集群的工具,有如下功能:1.管理多个kafka集群
2.便捷的检查kafka集群状态(topics,brokers,备份分布情况,分区分布情况)
3.选择你要运行的副本
4.基于当前分区状况进行
5.可以选择topic配置并创建topic(0.8.1.1和0.8.2的配置不同)
6.删除topic(只支持0.8.2以上的版本并且要在broker配置中设置delete.topic.enable=true)
7.Topic list会指明哪些topic被删除(在0.8.2以上版本适用)
8.为已存在的topic增加分区
9.为已存在的topic更新配置
10.在多个topic上批量重分区
11.在多个topic上批量重分区(可选partition broker位置)
安装步骤1、获取kafka-manager源码,并编译打包
# cd /usr/local
# git clone https://github.com/yahoo/kafka-manager
# cd kafka-manager
# ./sbt clean dist
注: 执行sbt编译打包可能花费很长时间,如果你hang在如下情况
将project/plugins.sbt 中的logLevel参数修改为logLevel := Level.Debug(默认为Warn)2、安装配置
编译成功后,会在target/universal下生成一个zip包# cd /usr/local/kafka-manager/target/universal
# unzip kafka-manager-1.3.3.7.zip  
将application.conf中的kafka-manager.zkhosts的值设置为你的zk地址
如:kafka-manager.zkhosts="172.16.218.201:2181,172.16.218.202:2181,172.16.218.203:2181"
3、启动,指定配置文件位置和启动端口号,默认为9000
直接启动:# cd kafka-manager-1.3.3.7/bin 
# ./kafka-manager -Dconfig.file=../conf/application.conf
后台运行:# ./kafka-manager -h 
# nohup ./kafka-manager -Dconfig.file=../conf/application.conf &
指定端口,例如:# nohup bin/kafka-manager -Dconfig.file=conf/application.conf -Dhttp.port=9001 &
第一次进入web UI要进行kafka cluster的相关配置,根据自己的信息进行配置。

 

参考文章链接:

kafka
https://www.cnblogs.com/shiyiwen/p/6150213.html
http://blog.51cto.com/xiangcun168/1933509
http://orchome.com/41
http://www.360doc.com/content/16/1117/16/37253246_607304757.shtml
http://jayveehe.github.io/2017/02/01/elk-stack/
http://blog.51cto.com/wuyebamboo/1963786
https://facingissuesonit.com/2017/05/29/integrate-filebeat-kafka-logstash-elasticsearch-and-kibana/
https://www.yuanmas.com/info/GlypPG18y2.html
https://www.cnblogs.com/yinchengzhe/p/5111635.html  kafka 参数
https://www.cnblogs.com/weixiuli/p/6413109.html        kafka 配置文件参数详解

 

转载于:https://www.cnblogs.com/smail-bao/p/7987340.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/428490.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Ubuntu 16.04 设置MySQL远程访问权限

第一步:修改配置文件的端口绑定 打开的目录可能会根据MySQL的版本稍有不同,可以先尝试打开/etc/mysql/my.cnf这个配置文件,若该文件不存在或文件内容为空,则尝试下面的文件路径。 sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf 在下…

spring mysql整合_springboot mybatis mysql 整合

1、pom文件配置mysqlmysql-connector-javaruntimeorg.springframework.bootspring-boot-starter-testtestorg.mybatis.spring.bootmybatis-spring-boot-starter1.2.0org.springframework.bootspring-boot-starter-jdbc2、mybatis 数据库连接配置spring.datasource.driver-class…

Android 平台电容式触摸屏的驱动基本原理

Android 平台电容式触摸屏的驱动基本原理 Android 平台电容式触摸屏硬件基本原理 Linux 与 Android 的多点触摸协议 Linux输入子系统:事件的编码 转载于:https://www.cnblogs.com/LittleTiger/p/7992840.html

微信小程序怎么取mysql_微信小程序如何加载数据库真实数据?

微信小程序要加载网站数据库里面的真实数据,有一个硬性的要求,就是你的网站域名必须是https协议才行,要不然你第一步服务器域名配置你都通过不了,小编我也是前不久申请的https://www.100txy.com,具体申请步骤大家自行去…

mysql定时任务

1. 查看是否开启定时策略 show variables like %event_sche%; 若出现如下图,则此时是关闭状态 开启定时策略(重启无效) set global event_scheduler 1; 则需要在配置文件my.ini的设置(重启有效) [mysqld] event_schedulerON //这一行加入mysqld标签下 2. 创建存储过…

java 中jtable_java中使用JTable控件

JTable是java桌面软件设计的一个很有用的UI控件,是一个表格控件,完整位置是:javax.swing.JTable。以下是我的一些使用经验:添加行:不能直接向JTable插入行,需要借助JTable的tableModel,代码如下…

02使用常规步骤编译NanoPiM1Plus的Android4.4.2

02使用常规步骤编译NanoPiM1Plus的Android4.4.2 大文实验室/大文哥 壹捌陆捌零陆捌捌陆捌贰 21504965 AT qq.com 完成时间:2017/12/5 17:51 版本:V1.0 开发板:NanoPi M1 Plus/zh SDK:Android4.4.2 按照全志A33平台编译调通的功能&…

java 精灵线程_Java线程的状态分析

/*** 线程的状态分析*authoraa**/public classThreadState {public static void main(String[] args) throwsException {/*** 新建线程,线程为新建状态* jdk:至今尚未启动的线程的状态。* 如果不给线程设置名称,线程的名称将会是:…

【02】koala编译中文出错(已放弃不用)

http://koala-app.com/index-zh.html koala 下载地址。sass。中文编译出错:打开 Koala文件夹位置->rubygems->gems->sass->lib->sass->engine.rb。添加这句话。在所有的request XXXX 之后即可。复制添加Encoding.default_external Encoding.find…

java jlabel里面加button_在Java Swing中通过JLabel覆盖JButton?

是否可以在Swing中将Button叠加在Label上?例如,如果有一个带有图像的JLabel而没有文本,我想在我的JLabel上覆盖我的按钮.标签定义如下:myLabel new javax.swing.JLabel(new ImageIcon( myPicture ));如果没有,那么任何想法我怎么能意识到这一点,谢谢.编…

项目管理之码云和git

目录 学习链接 1 码云 1 第一步,注册 2 第二部,登录 2 创建项目 2 git管理 4 如何生成公钥 5 clone项目 5 提交项目 6 1.本地初始化一个项目 6 2.开始第一次上传你的项目 7 5.Git基本操作 8 学习链接 https://www.cnblogs.com/xiaoxiaoccaiya/p/7125136.…

java 传递脚本给c_java – JNI将参数传递给c的方法

我有一个c文件myCppTest.cpp,它有方法int myFunction(int argv, char **argc) {}和myClass.java中的Java本机方法public native int myFunction (int argv, char[][] argc);使用javah -jni myClass生成头文件后,我有头JNIEXPORT jint JNICALL Java_JPTokenizer_init(JNIEnv *, …

【例3-4】求后序遍历

【例3-4】求后序遍历 链接:http://ybt.ssoier.cn:8088/problem_show.php?pid1339时间限制: 1000 ms 内存限制: 65536 KB【题目描述】 输入一棵二叉树的先序和中序遍历序列,输出其后序遍历序列。 【输入】 共两行,第一行一个字符串&a…

java classpath bat_tomcat启动批处理——setclasspath.bat | 学步园

除了上面两个批处理,还有一个比较重要的脚本,即是setclasspath.bat,它主要负责寻找、检查JAVA_HOME和JRE_HOME两个变量。********************************************************************************************if ""%1&q…

验证 Swarm 数据持久性 - 每天5分钟玩转 Docker 容器技术(104)

上一节我们成功将 Rex-Ray Volume 挂载到了 Service。本节验证 Failover 时,数据不会丢失。 Scale Up 增加一个副本: docker service update --replicas 2 my_web 运行之前我们先推测一下,理想的结果应该是:swarm 在 swarm-worker…

SQL Server安全级别2的阶梯:身份验证

SQL Server安全级别2的阶梯:身份验证作者:Don Kiely,2014/06/18 该系列本文是“Stairway系列:SQL Server安全性的阶梯”的一部分 SQL Server提供了保护服务器和数据免受当今复杂攻击所需的一切。但是,在您有效使用这些…

java file 堵塞_单元测试最终在Java 6中阻塞

首先考虑使用IOUtils.closeQuietly(),它会将未经测试的代码(可能是重复代码)减少为:try {f new BufferedInputStream(new FileInputStream(source));f.read(buffer);} finally {IoUtils.closeQuietly(f);}现在变得艰难. “正确”的方法是将BufferedInputStream的创…

java jna调用dll文件_关于java jna调用dll的问题

public interface User32 extends StdCallLibrary{User32 INSTANCE (User32)Native.loadLibrary("User32",User32.class);//加载系统User32 DLL文件,也可以是C写的DLL文件int SendMessageA(int hwnd,int msg,int wparam,int lparam);int FindWindowA(Str…

【bzoj4444】[Scoi2015]国旗计划 倍增

题目描述 给出一个圈和若干段,问:对于所有的 $i$ ,选择第 $i$ 段的情况下,最少需要选择多少段(包括第 $i$ 段)能够覆盖整个圈?输入 第1行,包含2个正整数N,M,分别表示边防…

java multimap 序列化_C++ JSON库的使用

1. 如何使用?2. 常用方法2.1 创建json对象2.1.1 使用cin,cout输入输出流2.1.2 提供根据键直接生成键值对的方法2.1.3 json::array json::object2.1.4 几个区别2.2 序列化2.2.1 标准输出自动序列化2.2.2 使用dump()函数2.3 反序列化2.3.1 从标准输入反序列化2.3.2 通…