安装环境基于CentOS 7.x

1、安装java 环境

安装java 8 参考:https://www.cnblogs.com/myibm/p/9232744.html

查看是否安装成功

[root@localhost ~]# java -version
openjdk version “1.8.0_312”

2、ElasticSearch 和 logstash 安装

获取密钥

[root@localhost ~]# rpm --import https:<span>//</span><span>artifacts.elastic.co/GPG-KEY-elasticsearch</span>

下载

ELK三个套件版本要一致,这里获取的是2021-12-16日最新版本的,如需更新的版本可以到官网下载 https://www.elastic.co/cn/downloads/

[root@localhost ~]# <span>wget</span> https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.16.1-x86_64.rpm
[root@localhost ~]# <span>wget</span> https:<span>//</span><span>artifacts.elastic.co/downloads/logstash/logstash-7.16.1-x86_64.rpm</span>

安装

[root@localhost ~]# rpm -ivh elasticsearch-7.16.1-x86_64.rpm
[root@localhost ~]# rpm -ivh logstash-7.16.1-x86_64.rpm

配置

[root@localhost ~]# vim /etc/elasticsearch/elasticsearch.yml

去掉,以下两行的注释

bootstrap.memory_lock: true

http.port: 9200

启动

复制代码

[root@localhost ~]# systemctl daemon-<span>reload
[root@localhost </span>~<span>]# systemctl enable elasticsearch
[root@localhost </span>~<span>]# systemctl start elasticsearch<br></span>
[root@localhost ~]# systemctl enable logstash
[root@localhost ~]# systemctl start logstash<br><br><span>[root@localhost </span>~]# netstat -plntu | grep 9200

复制代码

最后一行是看elasticsearch 是否正常启动,如果没有还是没有启动,可以重启一下系统

至此 elasticsearch 和logstash 安装完成

下一篇:通过简单配置实现把mysql数据同步到es elasticsearch上的索引

参考:https://www.cnblogs.com/cheesebar/p/9126171.html#4973512