在Debian上,Filebeat的性能瓶颈可能出现在多个方面。以下是一些常见的性能瓶颈及其优化方法:
/etc/security/limits.conf
文件来增加这个限制。* soft nofile 65536
* hard nofile 65536
harvester
数量,合理配置 max_file_size
和 scan_frequency
以确保对大文件的处理不会造成延迟。filebeat.inputs:
- type: log
paths:
- /var/log/*.log
harvester:
max_bytes: 1048576 # 每个 harvester 最多处理的字节数
bulk_max_size
来提高发送效率。output.elasticsearch:
hosts:
- "localhost:9200"
bulk_max_size: 2048 # 每次批量发送的最大文档数
queue.type
设置为 persisted
,并调整 queue.max_bytes
和 flush.min_events
等参数以优化内存使用。queue.type: persisted
queue.max_bytes: 1024mb
flush.min_events: 2048
flush.timeout: 1s
/etc/sysctl.conf
文件来调整内核参数,比如增加文件描述符限制、调整TCP窗口大小等,以提高系统性能。vm.swappiness = 1
net.core.somaxconn = 65536
filebeat.registry:
path: /var/lib/filebeat/registry
clean_inactive: 72h # 清理不活跃的注册表条目
通过上述优化措施,可以显著提升Filebeat在Debian系统上的性能。