码迷,mamicode.com
首页 > 其他好文 > 详细

elk+kafka+zookeeper+filebeat安装

时间:2018-08-22 00:22:13      阅读:220      评论:0      收藏:0      [点我收藏+]

标签:crontab   源码   memory   linux   副本   proc   home   centos6   trap   

ElasticSearch6.0

ElasticSearch6.0安装

#依赖jdk8
rpm -ivh elasticsearch-6.0.0.rpm
vim /etc/elasticsearch/elasticsearch.yml #配置如下
    node.name: es1
    node.master: true
    node.data: true
    path.data: /home/es/data
    path.logs: /home/es/logs
    network.host: 192.168.55.215
    http.port: 9200
    bootstrap.memory_lock: false   #centos6需要
    bootstrap.system_call_filter: false  #centos6需要
    ##以下两项是head插件访问es需要配置
    http.cors.enabled: true  
    http.cors.allow-origin: "*"
    # 设置索引的分片数,默认为5 
    #index.number_of_shards: 5
    # 设置索引的副本数,默认为1: 
    #index.number_of_replicas: 1
mkdir -p /home/es/{data,logs}
chown -R elasticsearch.elasticsearch /home/es
vim /etc/security/limits.conf #添加或修改以下内容
    *        hard    nproc        4096
    *        soft    nproc        4096
    *        hard    nofile        131072
    *        soft    nofile        65536
/etc/elasticsearch/jvm.options  #更改启动内存,测试环境512M就可以了
    -Xms1g
    -Xmx1g
/etc/sysconfig/elasticsearch    #启动脚本的一些环境变量例如 JAVA_HOME=/opt/java

/etc/init.d/elasticsearch  start  #启动es

ElasticSearch配置文件详解

https://blog.csdn.net/zxf_668899/article/details/54582849

ElasticSearch6.0-head插件安装(界面查看es索引)

#网址:http://www.cnblogs.com/Onlywjy/p/Elasticsearch.html
#包D:\share\src\elk\elk6.0\elasticsearch-head插件
1.安装node
    tar -C /opt/ -zxvf node-v4.4.7-linux-x64.tar.gz

    vim /etc/profile.d/node.sh   #配置node环境变量
        export NODE_HOME=/opt/node-v4.4.7-linux-x64
        export PATH=$PATH:$NODE_HOME/bin
        export NODE_PATH=$NODE_HOME/lib/node_modules
    source /etc/profile.d/node.sh

2.安装grunt
    unzip elasticsearch-head-master.zip
    cd elasticsearch-head-master
    npm install -g grunt-cli  //执行后会生成node_modules文件夹

    grunt -version #检查是否安装成功

    修改head插件源码
        修改服务器监听地址:Gruntfile.js  #93行,默认端口号库9100
    修改连接地址:_site/app.js   #4354行,修改es连接地址

3.运行head
    在elasticsearch-head-master目录下
    npm install   #(安装下载下来的包,如果出错再执行一遍)
    grunt server &  #后台启动、netstat -lnp | grep 9100
4.访问http://xxx:9100

5.head使用
https://www.cnblogs.com/yanan7890/p/6640289.html

 

 ElasticSearch6.0索引清理

curl -XGET http://192.168.55.219:9200/_cat/indices/?v  #查询索引
curl -XDELETE http://127.0.0.1:9200/logstash-2016-07-*  #api删除索引

脚本加api删除(推荐)
    vim /opt/sh/es-index-clear.sh

    #/bin/bash

    #指定日期(7天前)
    DATA=`date -d "1 week ago" +%Y.%m.%d`

    #当前日期
    time=`date`

    #删除7天前的日志
    curl -XDELETE http://127.0.0.1:9200/*-${DATA}

    if [ $? -eq 0 ];then
      echo $time"-->del $DATA log success.." >> /tmp/es-index-clear.log
    else
      echo $time"-->del $DATA log fail.." >> /tmp/es-index-clear.log
    fi
添加到任务计划
    crontab -e
    10 1 * * * sh /tmp/es-index-clear.sh > /dev/null 2>&1

 

 elasticSearch常用命令

原网址:https://zhaoyanblog.com/archives/732.html
curl localhost:9200/_cluster/health?pretty 健康检查
curl localhost:9200/_cluster/state?pretty    集群详细信息

 

elk+kafka+zookeeper+filebeat安装

标签:crontab   源码   memory   linux   副本   proc   home   centos6   trap   

原文地址:https://www.cnblogs.com/hanxiaohui/p/9515118.html

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