长沙网站制作公司推荐,上海公司牌照申请流程,wordpress去除文章rss,企业网站的设计原则文章目录 elasticsearch一、概念二、ELK集群部署三、图形化界面 elasticsearch
一、概念 1、ELKStack简介#xff08;都是java架构#xff0c;需要jdk底层#xff09; 什么是ELK#xff1f;通俗来讲#xff0c;ELK是由Elasticsearch、Logstash、Kibana 三个开源软件组成的… 文章目录 elasticsearch一、概念二、ELK集群部署三、图形化界面 elasticsearch
一、概念 1、ELKStack简介都是java架构需要jdk底层 什么是ELK通俗来讲ELK是由Elasticsearch、Logstash、Kibana 三个开源软件组成的一个组合体这三个软件当中每个软件用于完成不同的功能ELK又称ELKstack官网 https://www.elastic.co/ 2、Elasticsearch elasticsearch是一个高度可扩展全文搜索和分析引擎基于Apache Lucene 构建能对大容量的数据进行接近实时的存储、搜索和分析操作可以处理大规模日志数据比如Nginx、Tomcat、系统日志等功能。 3、Logstash 数据收集引擎。它支持动态的从各种数据源搜集数据并对数据进行过滤、分析、丰富、统一格式等操作然后 存储到用户指定的位置支持普通log、自定义json格式的日志解析。 4、Kibana 数据分析和可视化平台。通常与 Elasticsearch 配合使用对其中数据进行搜索、分析和以统计图表的方式展示。开源 不等于免费 -- ELK -- 开源 | logstash 插件 -- 收集 免费 - 监控 收费的 5、beats多种数据采集器的集合用于实现从边缘机器向logstash 和Elasticsearch发送数据其中应用最多的是filebeat是一个轻量级日志采集器。 二、ELK集群部署
1 Elasticsearch 介绍
Elasticsearch简称ES是一个分布式、RESTful风格的搜索和数据分析引擎用于集中存储日志数据
1.关闭防火墙和selinuxhost绑定
192.168.8.138 h2 3G内存这里设置一下虚拟机的内存
192.168.8.139 h3 3G内存
2、部署jre环境jdk-8u301-linux-x64.rpm
# rpm -ivh jdk-8u301-linux-x64.rpm
在/etc/profile下写入
export JAVA_HOME/usr/java/jdk1.8.0_301-amd64 #这里安装路径自动定位在这里
export CLASSPATH$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/fre/lib
export PATH$JAVA_HOME/bin:$JAVA_HMOE/jre/bin:$PATH
[roothd2 ~]# source /etc/profile
#查看java版本
[roothd2 ~]# java -version
3、安装elasticsearch
[roothd1 ~]# mkdir /opt/elk
[roothd1 ~]# mv elasticsearch-7.9.3-linux-x86_64.tar.gz /opt/elk
[roothd1 ~]# cd /opt/elk
[roothd1 elk]# tar zxvf elasticsearch-7.9.3-linux-x86_64.tar.gz
[roothd1 elk]# mv elasticsearch-7.9.3 elasticsearch
[roothd1 elk]# cd elasticsearch
[roothd1 elasticsearch]# ls
bin config jdk lib LICENSE.txt logs modules
这里启动不可以使用root用户需要新创建一个用户es
4、配置最大进程
[roothd1 ~]# useradd es
[roothd1 ~]# chown -R es.es /opt/elk
[roothd1 ~]# ulimit -n
1024
调整进程最大值
[roothd1 ~]# ulimit -n 65535
永久修改修改 nofile number open file
[roothd1 ~]# tail -3 /etc/security/limits.conf
* hard nofile 65535
* soft nofile 65535
* soft nproc 4096
* hard nproc 4096
# End of file
调整进程最大虚拟内存区域数量临时设置
[roothd1 ~]# sysctl -w vm.max_map_count262144 vm.max_map_count 262144
永久设置
[roothd1 ~]# echo vm.max_map_count262144 /etc/sysctl.conf [roothd1 ~]# sysctl -p
vm.max_map_count 262144
配置完成后需要重启用户这里需要重启虚拟机 reboot
5、修改配置文件
[roothd1 ~]# vi /opt/elk/elasticsearch/config/elasticsearch.yml
cluster.name: elk-cluster #集群的名称两个节点保持一致
node.name: node-1 #集群节点的名字
path.data: /opt/elk/data #数据的路径
path.logs: /opt/elk/logs #日志的路径
network.host: 0.0.0.0 #监听的ip地址
http.port: 9200
discovery.seed_hosts: [192.168.8.138, 192.168.8.139] #发现集群中的其他节点cluster.initial_master_nodes: [node-1] #设置主节点
6、设置es的权限
[roothd1 ~]# mkdir /opt/elk/data
[roothd1 ~]# mkdir /opt/elk/logs
[roothd1 ~]# chown -R es.es /opt/elk
7、生成启动脚本
[roothd1 ~]# cat /usr/lib/systemd/system/elasticsearch.service
[Unit]
Descriptionelasticsearch
[Service]
Useres
LimitNOFILE65535
ExecStart/opt/elk/elasticsearch/bin/elasticsearch
ExecReload/bin/kill -HUP $MAINPID
KillModeprocess
#Restarton-failure[Install]
WantedBymulti-user.target
8、启动测试
[roothd1 ~]# systemctl daemon-reload
[roothd1 ~]# systemctl start elasticsearch
查看启动报错一般是看日志
# journalctl -u elasticsearch
查看监听的端口9300用于内部集群之间的通信
[roothd1 config]# ss -ant |grep 9300 LISTEN 0 128 :::9300 :::*
[roothd1 config]# ss -ant |grep 9200 LISTEN 0 128 :::9200 :::*
**********************************************************************
配置192.168.8.139
[roothd2 ~]# mkdir -p /opt/elk
[roothd2 ~]# useradd es
[roothd1 ~]# scp -r /opt/elk/* root192.168.1.12:/opt/elk/ #将8.138的文件scp过来
[roothd2 ~]# cd /opt/elk
[roothd2 elk]# ls
data elasticsearch logs
[roothd2 elk]# rm -rf logs/*
[roothd2 elk]# rm -rf data/*
将配置文件指定master的属性注释掉将node的名字改成node-2
[roothd2 elk]#cd /opt/elk/elasticsearch/config/
[roothd2 config]# grep master_nodes: elasticsearch.yml
node.name: node-2
#cluster.initial_master_nodes: [node-1]
将启动脚本文件拷贝过去
[roothd1 ~]# scp -r /usr/lib/systemd/system/elasticsearch.service root192.168.8.139:/usr/lib/systemd/system/
启动服务
[roothd2 ~]# useradd es
[roothd2 ~]# chown -R es.es /opt/elk/
[roothd2 ~]# ulimit -n 65535
[roothd2 ~]# vi /etc/security/limits.conf
* hard nofile 65535
* soft nofile 65535
* soft nproc 4096
* hard nproc 4096
[roothd2 ~]# sysctl -w vm.max_map_count262144
vm.max_map_count 262144
[roothd2 ~]# echo vm.max_map_count262144 /etc/sysctl.conf
[roothd2 ~]# sysctl -p
这里需要重启用户 reboot
[roothd2 ~]# systemctl daemon-reload
[roothd2 ~]# systemctl start elasticsearch
[roothd2 ~]# ps -ef |grep elastic查看报错--日志
# cat /opt/elk/logs/elk-cluster.log
# journalctl -u elasticsearch查看集群各个节点状态
# curl -XGET http://127.0.0.1:9200/
{
name : node-2,
cluster_name : elk-cluster,
cluster_uuid : 6Bq-5r02QD2fvGQqGOv4Kg,
version : {
number : 7.9.3,
build_flavor : default,
build_type : tar,
build_hash : c4138e51121ef06a6404866cddc601906fe5c868,
build_date : 2020-10-16T10:36:16.141335Z,
build_snapshot : false,
lucene_version : 8.6.2,
minimum_wire_compatibility_version : 6.8.0,
minimum_index_compatibility_version : 6.0.0-beta1
},
tagline : You Know, for Search
}
这里的uuid必须是一样的如果不一样就是没有同步查看集群情况带*号的表示是master
[roothd1 ~]# curl -XGET http://127.0.0.1:9200/_cat/nodes?pretty
192.168.8.138 10 74 6 0.16 0.29 0.20 dilmrt * node-1
192.168.8.139 16 75 5 0.04 0.20 0.18 dilmrt - node-2Master和Slave的区别
Master的职责
统计各node节点状态信息、集群状态信息统计、索引的创建和删除、索引分配的管理、关闭node节点等
Savle的职责
同步数据、等待机会成为Master三、图形化界面
图形管理ES
[roothd1 ~]# cd /opt/elk/
[roothd1 elk]# rz -y
elasticHD_linux_amd64.zip
[roothd1 elk]# unzip elasticHD_linux_amd64.zip
Archive: elasticHD_linux_amd64.zip
inflating: ElasticHD
[roothd1 elk]# nohup ./ElasticHD
[roothd1 elk]# tail nohup.out -f
To view elasticHD console open http://0.0.0.0:9800 in browser
exec: xdg-open: executable file not found in $PATH
访问页面
192.168.8.138:9800
四、部署安装logstash 待续…