0.拓扑图

参考:https://www.cnblogs.com/JetpropelledSnake/p/10057545.html

官网: http://kafka.apache.org/documentation.html#introduction  kafka原理

https://www.cnblogs.com/jixp/articles/9435699.html    Kafka全解析  https://blog.csdn.net/vinfly_li/article/details/79397201

1.logstash的配置

[root@VM_0_4_centos config]# cat wxqyh.yml|egrep -v '^$|^#'
input {
file {
type => "4personal20001"
path => "/mnt/data/logs/personal_20001/log4j.log"
start_position => "beginning"
sincedb_path => "/dev/null"
codec => multiline {
pattern => "^%{TIMESTAMP_ISO8601}"
negate => true
what => "previous"
}
}
file {
type => "4personal20002"
path => "/mnt/data/logs/personal_20002/log4j.log"
start_position => "beginning"
sincedb_path => "/dev/null"
codec => multiline {
pattern => "^%{TIMESTAMP_ISO8601}"
negate => true
what => "previous"
}
}
}
filter { grok {
match => {
"message" => "^%{TIMESTAMP_ISO8601}\[%{WORD:level} %{GREEDYDATA:ajpcon}\| %{GREEDYDATA:data}"
}
match => {
"message" => "^%{TIMESTAMP_ISO8601}\[ %{WORD:level} %{GREEDYDATA:ajpcon}\| %{GREEDYDATA:data}"
}
remove_field => "message"
}
}
output {
if [type] == "4personal20001" {
kafka {
max_request_size => 10485761
bootstrap_servers => "10.0.0.134:9092"
topic_id => "topic4personal1"
compression_type => "snappy"
}
}
if [type] == "4personal20002" {
kafka {
max_request_size => 10485761
bootstrap_servers => "10.0.0.134:9092"
topic_id => "topic4personal2"
compression_type => "snappy"
}
}
}

2.kafka的配置

[root@VM_0_134_centos config]# cat server.properties|egrep -v '^$|^#'
broker.id=
listeners=PLAINTEXT://10.0.0.134:9092
advertised.listeners=PLAINTEXT://10.0.0.134:9092
num.network.threads=
num.io.threads=
socket.send.buffer.bytes=
socket.receive.buffer.bytes=
socket.request.max.bytes=
message.max.bytes=
replica.fetch.max.bytes=
log.dirs=/mnt/data/monitor01/kafka_2.-1.1./data
num.partitions=
num.recovery.threads.per.data.dir=
offsets.topic.replication.factor=
transaction.state.log.replication.factor=
transaction.state.log.min.isr=
log.retention.hours=
log.segment.bytes=
log.retention.check.interval.ms=
zookeeper.connect=localhost:
zookeeper.connection.timeout.ms=
group.initial.rebalance.delay.ms=

3.logstash2的配置

[root@VM_0_134_centos config]# cat haode.yml|egrep -v '^$|^#'
input {
kafka {
type => "topic12wxqyh8"
codec => "plain"
topics => ["topic12wxqyh8"]
client_id => "es1"
group_id => "es1"
bootstrap_servers => "10.0.0.134:9092"
} kafka {
type => "topic12wxqyh9"
codec => "plain"
topics => ["topic12wxqyh9"]
client_id => "es2"
group_id => "es2"
bootstrap_servers => "10.0.0.134:9092"
}
kafka {
type => "topic24wxqyh6"
codec => "plain"
topics => ["topic24wxqyh6"]
client_id => "es3"
group_id => "es3"
bootstrap_servers => "10.0.0.134:9092"
} kafka {
type => "topic24wxqyh7"
codec => "plain"
topics => ["topic24wxqyh7"]
client_id => "es4"
group_id => "es4"
bootstrap_servers => "10.0.0.134:9092"
} kafka {
type => "topic4personal1"
codec => "plain"
topics => ["topic4personal1"]
client_id => "es5"
group_id => "es5"
bootstrap_servers => "10.0.0.134:9092"
}
kafka {
type => "topic4personal2"
codec => "plain"
topics => ["topic4personal2"]
client_id => "es6"
group_id => "es6"
bootstrap_servers => "10.0.0.134:9092"
} } output {
if [type] == "topic12wxqyh8" {
elasticsearch {
index => "topic12wxqyh8"
hosts => ["10.0.0.7:9200"]
}
} if [type] == "topic12wxqyh9" {
elasticsearch {
index => "topic12wxqyh9"
hosts => ["10.0.0.7:9200"]
}
}
if [type] == "topic24wxqyh6" {
elasticsearch {
index => "topic24wxqyh6"
hosts => ["10.0.0.7:9200"]
}
}
if [type] == "topic24wxqyh7" {
elasticsearch {
index => "topic24wxqyh7"
hosts => ["10.0.0.7:9200"]
}
}
if [type] == "topic4personal1" {
elasticsearch {
index => "topic4personal1"
hosts => ["10.0.0.7:9200"]
}
}
if [type] == "topic4personal2" {
elasticsearch {
index => "topic4personal2"
hosts => ["10.0.0.7:9200"]
}
}
}

参考:https://www.cnblogs.com/swordfall/p/8860941.html#auto_id_4

4.kafka的问题:

4.1zookeeper--选主,提供访问入口

4.2 Kafka的原理

生产者将数据发送到Broker代理,Broker代理有多个话题topic,消费者从Broker获取数据。

参考: https://zhuanlan.zhihu.com/p/97030680

5.partion--相当于es的shard

最新文章

  1. python网络编程-TCP协议中的三次握手和四次挥手(图解)
  2. WindowsAPI调用和OCR图片识别
  3. ecshop 导出exl表格
  4. WPF DataGrid常用属性记录
  5. [css3]圆盘旋转动画
  6. eclipse中新建javaweb项目,查看某些类的源码
  7. C# for AUTOCAD ActiveX获取图形对象坐标程序
  8. C# 操作配置文件
  9. 【git】git常用命令简介
  10. JavaScript权威指南学习笔记6
  11. 截取字符串一之substr
  12. ValidationMessageFor验证
  13. 常用CSS样式 持续更新
  14. URAL 1297 最长回文子串(后缀数组)
  15. 机器学习web服务化实战:一次吐血的服务化之路
  16. Mac 怎么通过自带终端连接linux服务器
  17. robot framework笔记(一):环境配置(基于python3)+在pycharm中编写及运行robot脚本
  18. oracle 解决锁表问题
  19. vscode keys
  20. 当超强台风“山竹”即将冲进南海,Power BI 你怎么看?

热门文章

  1. Dinic 与 SAP(ISAP?) 模板
  2. P4149 [IOI2011]Race 点分治
  3. 【题解】[NOIP模拟题]我要的幸福-C++
  4. 数据分析相关学习 -1 numpy
  5. robotframework出现错误:Keyword 'AppiumLibrary.Open Application' expected 1 to 2 non-keyword arguments,got 5.
  6. jquery 页面input上传图后显示
  7. keepalived+mysql双主热备
  8. POJ 3616 Milking Time ——(记忆化搜索)
  9. Sketch教程
  10. Java并发指南7:JUC的核心类AQS详解