本文共 4633 字,大约阅读时间需要 15 分钟。
ElasticSearch是一个基于Lucene的搜索服务器。它提供了一个分布式多用户能力的全文搜索引擎 基于RESTful web接口。Elasticsearch是用Java开发的,并作为Apache许可条款下的开放源码发布 是当前流行的企业级搜索引擎。设计用于云计算中,能够达到实时搜索,稳定,可靠,快速,安装使用方便。
1、两台elk server 172.20.7.50 [node1] 172.20.7.52 [node2]2、两台logstash 172.20.7.56 [node6] 172.20.7.57 [node7]3、web server服务器 172.20.7.55 [node5]4、redis 服务器 172.20.7.56 [node5]
Elasticsearch是用java 开发的,新版的Elasticsearch需要jdk1.8以上
[root@node1 /data]#wget http://192.168.137.53/yum/Elasticsearch/elasticsearch-6.4.3.rpm[root@node1 /data]#wget http://192.168.137.53/yum/Elasticsearch/jdk-8u191-linux-x64.rpm
[root@node1 /data]#yum -y install elasticsearch-6.4.3.rpm jdk-8u191-linux-x64.rpm
# 在/etc/elasticsearch目录下jvm.options、elasticsearch.yml# 修改主配置文件elasticsearch.yml,做集群的话 第二台集群的集群名称要跟第一台的要一致,这里第二台的配置跟这里都一样的[root@node1 /data]#vim /etc/elasticsearch/elasticsearch.yml cluster.name: dklwj-elk 集群名称node.name: node1 集群身份IDpath.data: /elk/data 存放日志收集的存放路径path.logs: /elk/logs elk自身日志存放路径network.host: 172.20.7.52 监听地址http.port: 9200 监听端口、还有一个9300端口、用来同步数据的discovery.zen.ping.unicast.hosts: ["172.20.7.50", "172.20.7.52"]
[root@node1 /data]#mkdir /elk/{data,logs} -p[root@node1 /data]#chown -R elasticsearch.elasticsearch /elk/
[root@node1 /data]#systemctl start elasticsearch.service
[root@node1 ~]#systemctl enable elasticsearch.service
[root@node1 /data]#ss -tnl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 ::ffff:172.20.7.50:9200 :::* LISTEN 0 128 ::ffff:172.20.7.50:9300 :::* LISTEN 0 128 :::22 :::* LISTEN 0 128 ::1:631 :::* LISTEN 0 100 ::1:25 :::*
[root@node1 ~]#ll /elk/logs/total 16-rw-r--r-- 1 elasticsearch elasticsearch 0 Nov 29 10:21 dklwj-elk_access.log-rw-r--r-- 1 elasticsearch elasticsearch 263 Nov 29 10:21 dklwj-elk_deprecation.log-rw-r--r-- 1 elasticsearch elasticsearch 0 Nov 29 10:21 dklwj-elk_index_indexing_slowlog.log-rw-r--r-- 1 elasticsearch elasticsearch 0 Nov 29 10:21 dklwj-elk_index_search_slowlog.log-rw-r--r-- 1 elasticsearch elasticsearch 9215 Nov 29 10:23 dklwj-elk.log
这里就用docker来跑elasticsearch-head
先下载docker的rpm安装包,这里我本地一台专用存放安装包的机器上下的
[root@node1 ~]#wget http://172.20.7.53/yum/Elasticsearch/docker-ce-18.06.1.ce-3.el7.x86_64.rpm
[root@node1 ~]#yum -y install docker-ce-18.06.1.ce-3.el7.x86_64.rpm
[root@node1 ~]# systemctl start docker
[root@node1 ~]#wget http://172.20.7.53/yum/Elasticsearch/elasticsearch-head-5.tar.gz
[root@node1 ~]#docker load -i elasticsearch-head-5.tar.gz# 查看导入进来的docker镜像[root@node1 ~]#docker imagesREPOSITORY TAG IMAGE ID CREATED SIZEmobz/elasticsearch-head 5 b19a5c98e43b 23 months ago 824MB
[root@node1 ~]#docker run --name elk-head -d -p 9100:9100 b19a5c98e43b
[root@node1 ~]#vim /etc/elasticsearch/elasticsearch.yml http.cors.enabled: true http.cors.allow-origin: "*"
[root@node1 ~]#systemctl restart elasticsearch.service
[root@node1 ~]#ss -tnl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 :::22 :::* LISTEN 0 128 :::9100 :::* LISTEN 0 128 ::ffff:172.20.7.50:9200 :::* LISTEN 0 128 ::ffff:172.20.7.50:9300 :::*
转载于:https://blog.51cto.com/dklwj/2324667