elk搭建

elk搭建

参考资料:

https://www.cnblogs.com/adawoo/p/11665532.html   jdk安装
https://www.cnblogs.com/cheesebar/p/9126171.html   elk安装

1. 关闭防火墙和selinux

systemctl stop firewalld.service 
setenforce 0

2. elasticsearch, logstash 和kibana下载 (版本要一致)

https://www.elastic.co/cn/downloads/elasticsearch
https://www.elastic.co/cn/downloads/kibana
https://www.elastic.co/cn/downloads/logstash

3. elasticsearch安装和配置

rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch        导入秘钥
rpm -ivh elasticsearch-6.2.4.rpm          指定上一步下载回来的安装包
vim /etc/elasticsearch/elasticsearch.yml
取消43、59行的注释,行号不一定准确,但一定是下面这几项

bootstrap.memory_lock: true
http.port: 9200
启动
systemctl daemon-reload
systemctl enable elasticsearch
systemctl start elasticsearch
netstat -plntu
可能存在的问题
chmod g+w /etc/elasticsearch        启动不了,没有写的权限 

4. kibana安装和配置

rpm -ivh kibana-6.2.4-x86_64.rpm        指定上一步下载回来的安装包

vim /etc/kibana/kibana.yml
取消2、7、21行的注释,行号不一定准确,但一定是下面这几项

server.port: 5601
server.host: "localhost"
elasticsearch.url: "http://localhost:9200"
systemctl enable kibana
systemctl start kibana
netstat -plntu

5. logstash 安装使用

rpm -ivh logstash-6.2.4.rpm
#禁用虚拟内存,提高性能
bootstrap.memory_lock: true
#节点名称自定义:
cluster.name: elasticsearch
#数据通信端口:
http.port: 9200
#监听网卡ip
network.host: 192.168.1.1
#是否是数据节点:
node.data: true
#关闭即可:
node.ingest: true
#是否是主节点,不定义的话先启动的是主节点:
node.master: true
#最大存储节点:
node.max_local_storage_nodes: 1
#节点名字自定义:
node.name: Win-Master-1
#数据文件路径
path.data: D:\elk\elasticsearch\data
path.logs: D:\elk\elasticsearch\logs
#节点间通信端口:
transport.tcp.port: 9300
#节点ip,节点之间要允许ping和9300端口通信
discovery.zen.ping.unicast.hosts: ["192.168.1.1", "192.168.1.2"]
#head插件相关:
http.cors.enabled: true
http.cors.allow-origin: "*"
#0.0.0.0 则开启外网访问
network.host=0.0.0.0

posted @ 2022-11-20 20:34  是谁走漏了消息  阅读(27)  评论(0编辑  收藏  举报