--------------【ElasticSearch安装】------------------------
1. elasticsearch 安装
0.修改系统参数
vim /etc/sysctl.conf
vm.max_map_count = 2621440
sysctl -p
1.国内下载地址:
https://mirrors.huaweicloud.com/elasticsearch/ //下载全部,es,filebeat,kabana,logstash
2.配置:
vi config/elasticsearch.yml
server.host: "192.168.0.120"
elasticsearch.url: "http://192.168.0.120:9200"
path.data: /var/lib/elasticsearch //33L
path.logs: /var/log/elasticsearch //37L
network.host: 192.168.0.120 //55L
http.port: 9200 //59L
3.安装步骤:
cd elasticsearch-6.2.3 / bin
./elasticsearch
4.测试
http://192.168.xxx.xxx:9200
------------------【logstash安装】----------------------
2. logstash安装
1.下载包
2.解压
3.配置:
pipeline.workers: 1 //41L
pipeline.batch.size: 125 //45L
pipeline.batch.delay: 5 //50L
path.config: /xxx/logstash-6.2.3/config //64L logstash.conf的放置位置
http.host: "192.168.0.120" //190L
http.port: 9600 //195L
4.启动
/bin/logstash -f logstash.conf //absolute path
5.logstash.conf文件内容
input {
file {
path => "/var/log/nginx/access.log"
type => "system"
start_position => "beginning"
}
}
output {
elasticsearch {
hosts => ["192.168.91.128:9200"]
index => "system-%{+YYYY.MM.dd}"
}
stdout { codec => rubydebug }
}
6.测试
netstat -anpt|grep 9600
http://192.168.x.x:9600/
http://192.168.0.120:9200/_search?pretty //查看es中是否有index数据
http://192.168.0.120:9200/_cat/indices?v //查看索引
--------------------------【kabana安装】-------------------------
3.kabana安装
1.下载地址:
https://mirrors.huaweicloud.com/kibana/ // es和kibana两个版本要一致!
2.安装步骤:
tar -xzf kibana-6.2.3-linux-x86.tar.gz
3.kibana配置:
vim kibana-6.2.3-linux-x86_64/config/kibana.yml
server.port: 5601 //2L
server.host: "192.168.0.120" //7L
elasticsearch.url: "http://192.168.0.120:9200" //21L
kibana.index: ".kibana"
4.启动
cd kibana
../bin/kibana -c kibana.yml
5.测试
netstat -anpt |grep 5601
http://192.168.0.120:5601
------------------------【filebeat安装】--------------------------
filebeat安装
1.下载包
2.解压
3.修改配置文件
vi filebeat.yml
enabled: true //24L
paths:
- /www/server/nginx/logs/*.log //28L
hosts: ["192.168.0.120:9200"] //146L
4.启动
./filebeat -e -c filebeat.yml -d "publish"
5.测试
http://192.168.0.120:9200/_search?pretty //查看有没有"_index":"filebeats-xxx"
错误提示:
sudo bin/elasticsearch-plugin install ingest-geoip