ELK安装

来源:互联网 发布:爱编程 微信小程序 编辑:程序博客网 时间:2024/05/16 14:13

1.环境准备

  • 安装java环境,推荐1.8
  • 下载elk相关软件

2.安装elasticsearch

  • tar -zxvf elasticsearch-5.5.0.tar.gz
  • 不需要编译,直接进入目录修改配置

    path.logs: /opt/ytd_soft/logs/elasticsearch_logs
    bootstrap.memory_lock: false
    bootstrap.system_call_filter: false
    network.host: 10.20.9.85
    http.port: 9200
    #allow origin,允许跨域
    http.cors.enabled: true
    http.cors.allow-origin: “*”

  • 我只简单的修改了一下配置,详细配置请自行百度

  • 运行

    ./elasticsearch -d # -d表示后台启动

  • 用浏览器访问http://ip:9200可查看如下信息

    {
    name: “G58RiQ2”,
    cluster_name: “elasticsearch”,
    cluster_uuid: “vfUfhNbwRKKcVBE9_gmn_g”,
    version: {
    number: “5.5.0”,
    build_hash: “260387d”,
    build_date: “2017-06-30T23:16:05.735Z”,
    build_snapshot: false,
    lucene_version: “6.6.0”
    },
    tagline: “You Know, for Search”
    }

3.安装logstash

  • tar -zxvf logstash-5.5.0.tar.gz
  • 无需编译,修改配置文件,用默认配置即可,在配置文件最后加入

    xpack.monitoring.enabled: false #否则会认证错误,如果有需要可自行开启

  • 添加配置,在config文件夹下面新建一个conf.d文件夹,所有的输入输出配置存放在这个下面

  • 新建一个配置

input {
file {
path => “/opt/logs/marketing/logs/*”
start_position => “beginning” #从文件开始处读写
}
}
filter {
#Only matched data are send to output.
}
output {
elasticsearch {
action => “index” #The operation on ES
hosts => “10.20.9.85:9200” #ElasticSearch host, can be array.
index => “marketing_log” #The index to write data to.
}
}

  • 运行命令

    nohup ./bin/logstash -f ./config/conf.d &

  • nohup请自己百度,作用是实现后台运行,-f表示指定配置目录,也可是单独配置文件

4.安装kibana

  • tar -zxvf kibana-5.5.0.tar.gz #解压项目文件
  • 修改配置文件

    server.port: 5601
    server.host: “10.20.9.85”
    server.basePath: “”
    #前面安装的elasticsearch地址
    elasticsearch.url: “http://10.20.9.85:9200”

  • 运行命令

    nohup ./bin/kibana & #后台启动

  • 在浏览器中访问http://ip:5601
    如果出现kibana界面,表示启动成功

原创粉丝点击