码迷,mamicode.com
首页 > 系统相关 > 详细

ELK - MAC环境搭建

时间:2018-06-21 19:47:39      阅读:1859      评论:0      收藏:0      [点我收藏+]

标签:bre   war   main   过滤器   官方   web页面   怎么   管理工具   uri   

ELK - MAC环境搭建

本文旨在记录elasticsearch、logstash、kibana在mac下的安装与启动。

先决条件

  • java8
  • mac软件管理工具brew

brew相关命令

# 安装软件
brew install your-software
# 查看软件安装信息
brew info your-software
# 管理服务,没怎么用它,ELK都有自己的启动脚本在安装目录的bin/下面,且基本上都会携带参数启动
brew services start/stop your-service

elasticsearch

mac安装elasticsearch

# mac安装elasticsearch
brew install elasticsearch

elasticsearch的相关安装位置

安装目录:/usr/local/Cellar/elasticsearch/{elasticsearch-version}/

日志目录:/usr/local/var/log/elasticsearch/

插件目录:/usr/local/var/elasticsearch/plugins/

配置目录:/usr/local/etc/elasticsearch/

安装完成elasticsearch之后,可以通过brew services start elasticsearch启动它,然后通过curl请求REST API对它进行调用

首次启动,默认的端口号是9200,用户名是elastic,密码我也不知道(资料上查到的都是6.0以前的版本,密码是changeme,6.0以后不清楚),通过调用_xpack接口修改默认密码:

# 如果不是第一次修改,则需要输入当前密码才能进行密码修改
curl -XPUT -u elastic ‘localhost:9200/_xpack/security/user/elastic/_password‘ -H "Content-Type: application/json" -d ‘{"password":"123456"}‘

kibana

# mac安装kibana
brew install kibana

kibana的相关安装位置

安装目录:/usr/local/Cellar/kibana/{kibana-version}/

配置目录:/usr/local/etc/kibana/

启动kibana之前,需要先修改一下配置文件/usr/local/etc/kibana/kibana.yml,取消elasticsearch.name和elasticsearch.password的注释,并将值改为上面修改过的用户名密码username: elastic, password: 123456,请参考下面的kibana.yml片段

# kibana.yml

# If your Elasticsearch is protected with basic authentication, these settings provide
# the username and password that the Kibana server uses to perform maintenance on the Kibana
# index at startup. Your Kibana users still need to authenticate with Elasticsearch, which
# is proxied through the Kibana server.
elasticsearch.username: "elastic"
elasticsearch.password: "changeme"

通过brew services start kibana启动它

首次启动,默认端口号是5601,打开浏览器访问http://localhost:5601访问kibana管理页面,会弹框要求输入用户名密码,输入elastic和123456即可。

注:这里的kibana.yml中配置的用户名密码是kibana访问elasticsearch需要用到的,而web页面手动输入的用户名密码是我们登录kibana管理页面的密码,它们为什么能共用一个密码,不太清楚

坑:如果没有配置kibana.yml,虽然可以登录成功kibana,但是在kibana页面中什么都访问不了,它会提示你elasticsearch的认证失败!

logstash

# mac安装logstash
brew install logstash

logstash的相关安装位置

安装目录:/usr/local/Cellar/logstash/{logstash-version}/

启动相关:参考备注

filebeat

# mac安装filebeat
brew install filebeat

filebeat的相关安装位置

安装目录:/usr/local/Cellar/filebeat/{filebeat-version}/

配置目录:/usr/local/etc/filebeat/

缓存目录:/usr/local/var/lib/filebeat/

启动相关:参考备注

备注

因为logstash的启动关乎很多概念如管道、输入、输出、过滤器等,我这里是参考的官方文档,写的非常清晰:getting-started-with-logstash,讲了logstash结合filebeat将Apache日志文件解析成结构化数据存储到elasticsearch

ELK - MAC环境搭建

标签:bre   war   main   过滤器   官方   web页面   怎么   管理工具   uri   

原文地址:https://www.cnblogs.com/shiyu404/p/9210542.html

(0)
(1)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!