Linux系统 ELK(8.3.1)单机环境搭建
Linux系统安装最新ELK单机环境
Linux系统下 ELK单机环境搭建,当前ELK版本8.3.1
安装前置,ELK环境需要使用非root用户运行
useadd -u 501 esuser
passwd esuser 设置用户密码
创建一个目录,将所有ELK包放进去,且给当前目录esuser 权限
mkdir /opt/elk
chown -R esuser:esuser /opt/elk
ps: 后期解压下载后,用上面命令重新给目录赋权限,否则esuser无法运行
su esuer 使用这个命令切换用户
1.下载ELK包
官网地址,有能力的同学可以去官网使用最新版下载安装
https://www.elastic.co/cn/
下面是ELK 8.3.1的直接下载地址
1.elasticsearch https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.3.1-linux-x86_64.tar.gz
2.logstash https://artifacts.elastic.co/downloads/logstash/logstash-8.3.1-linux-x86_64.tar.gz
3.kibana https://artifacts.elastic.co/downloads/kibana/kibana-8.3.1-linux-x86_64.tar.gz
linux 上可使用wget下载文件
wget url
2.解压安装
使用tar命令解压
tar -zvxf elasticsearch-8.3.1-linux-x86_64.tar.gz
依次解压三个文件
3.配置
1、配置启动Elasticsearch
cd elasticsearch-8.3.1
vi config/elasticsearch.yml
cluster.name: clusterName 自定义集群名称
node.name: nodeName 自定义节点名称
path.data: /opt/elk/data 可自定义路径
path.logs: /opt/elk/logs 可自定义路径
bootstrap.memory_lock: true
network.host: 0.0.0.0
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"
xpack.security.enabled: false
xpack.security.enrollment.enabled: false
启动命令(后台模式)
./bin/elasticsearch -d -p pid &
2、配置启动logstash
进入logstash目录
cd logstash-8.3.1
touch config/logstash.conf
vi config/logstash.conf
input {
tcp {
port => 5044
codec => json_lines
}
}
output {
elasticsearch {
hosts => ["http://127.0.0.1:9200"]
index => "project-log-%{+YYYY.MM.dd}"
#user => "elastic"
#password => "elastic"
}
}
启动命令
./bin/logstash -f ./config/logstash.conf &
3、配置启动kibana
cd kibana-8.3.1
vi config/kibana.yml
server.port: 5601
server.host: 0.0.0.0
elasticsearch.hosts: ['http://127.0.0.1:9200']
启动命令
./bin/kibana &
至此ELK环境已全部启动,访问kibana页面
在浏览器打开以下链接
http://127.0.0.1:5601
如果是在远程服务器上,需要开启防火墙端口,或者云安全组,允许外网访问当前kibana端口服务
http://host_uo:5601
安装遇到相关问题处理方案
elasticsearch 问题
You must address the points described in the following [2] lines before star
vi /etc/sysctl.conf 在最后面追加下面内容
vm.max_map_count=655360
执行sysctl -p
elasticsearch 问题
memory locking requested for elasticsearch process but memory is not locked
vi /etc/security/limits.conf 在最后面追加一下内容
* hard memlock unlimited
* soft memlock unlimited
更多推荐
所有评论(0)