elk安装

cd usr/local/  用rz传入elasticsearch.zip的文件并解压到当前文件中

因为elasticsearch不能以root用户的来启动  所以必须单独的建立一个用户来运行elasticsearch   执行一下命令\

groupadd elasticsearch

useradd  elasticsearch(用户名) -g elasticsearch(组名) -p elasticsearch(密码)

更改elasticsearch文件夹以及内部文件的所属用户以及组为elasticsearch

chown -R elasticsearch:elasticsearch elasticsearch

添加用户并赋予权限后

可能会出现这样的错误

第一个错误: max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]

切换到root用户 exit ,进入vi /etc/security/limits.conf  ,增加配置(保存后注意切回elasticsearch用户的时候才能生效,sudo 修改的不能立即生效)

vim /etc/security/limits.conf 

elasticsearch soft nofile 65536

elasticsearch hard nofile 65536

第二个错误: max number of threads [1024] for user [work] likely too low, increase to at least [2048]

vi /etc/security/limits.d/20-nproc.conf 

修改为: soft nproc 1024 

             soft nproc 2048

第三个错误:max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]

vim /etc/sysctl.conf

增加改行配置:vm.max_map_count=655360

保存退出后,执行: sysctl -p

以上错误解决方案都是建立在root用户下的

解决完后切换回elasticsearch用户

进入 elasticsearch/bin目录

这个时候通过其他局域网机器同过ip地址http://192.168.1.122:9200/ 始终不能成功

这个时候首先看一下自己linux下的ip地址 然后cd elasticsearch/config/

vim elasticsearch.yml

修改 

network.host: 0.0.0.0

 (java客户端可以正常访问)

192.168.1.122(本机ip地址,java客户端访问报这个错误NoNodeAvailableException[None of the configured nodes are available)

并添加如下代码

http.cors.enabled: true
http.cors.allow-origin: "*"

重启elasticsearch即可,然后通过http://192.168.1.122:9200/即可访问,如果还是访问不成功,可能是防火墙的原因了

安装head插件

老版的可以直接在  ./bin/plugin -install mobz/elasticsearch-head(*)按装插件

但是新版的这样是不行的

必须clone到本地 npm才能后才能启动

首先找一个目录

git clone https://github.com/mobz/elasticsearch-head.git

npm install -g grunt-cli

npm install

grunt server

http://localhost:9100/

就可以访问了

安装logstash

首先下载 https://www.elastic.co/downloads/logstash 

在conf目录下新建logstash.conf文件 其内容如下

input {
     file {
        type => "log"
        path => "/logs/*.log"
        start_position => "beginning"
    }
}

output {
  stdout {
   codec => rubydebug { }
  }

  elasticsearch {
    hosts => "192.168.1.122:9200"
    index => "log-%{+YYYY.MM.dd}"
  }
}

 其中hosts改为elasticsearch的ip地址
bin/logstash -f logstash.conf  即可已启动

安装kibana

首先下载 https://www.elastic.co/downloads/kibana

tar -zxvf kibana

修改conf目录下kibana.yml节点下的 server.host:"0.0.0.0"   外部服务器即可访问

bin/kibana 即可启动服务

 

参考:https://blog.csdn.net/HaixWang/article/details/79493768

https://www.cnblogs.com/hanyinglong/p/5409003.html

https://segmentfault.com/q/1010000007827533

https://blog.csdn.net/u013384984/article/details/80309024

      windows版本:https://blog.csdn.net/lh2420124680/article/details/74277380

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值