ELK第一步--环境搭建

         第一步是参考网上各种网站搭建的。参考网站如下:

  1.     https://blog.csdn.net/liubenlong007/article/details/53782955
  2.     https://www.cnblogs.com/yuhuLin/p/7018858.html
  3.     https://www.cnblogs.com/harvey2017/p/8922164.html

     ELK下载:https://www.elastic.co/downloads/

     

配置ElasticSearch

unzip elasticsearch-6.2.4.zip

cd elasticsearch-6.2.4

vi config/elasticsearch.yml

修改以下配置项

cluster.name=es_cluster

node.name=node0

path.data=/tmp/elasticsearch/data

path.logs=/tmp/elasticsearch/logs

#当前hostname或IP,我这里是node1

network.host=node1

network.port=9200

启动ES

 nohup sh elasticsearch > nohup.log &

注意:

1.需要添加用户elk,ES不能以root用户进行启动

2.可能出现的错误:

  • max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]

1

2

3

vi /etc/security/limits.conf

elk soft nofile 819200 

elk hard nofile 819200

  • max number of threads [1024] for user [work] likely too low, increase to at least [2048]

1

2

3

4

vi /etc/security/limits.d/90-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]

1

2

3

4

5

vi /etc/sysctl.conf

#增加改行配置:

vm.max_map_count=655360 

#保存退出后,执行: 

sysctl -p

  • 另外再配置ES的时候,threadpool.bulk.queue_size 已经变成了thread_pool.bulk.queue_size ,ES_HEAP_SIZE,ES_MAX_MEM等配置都变为ES_JAVA_OPTS这一配置项,如限制内存最大最小为1G:

1

export ES_JAVA_OPTS="-Xms1g -Xmx1g"

访问检测elasticsearch是否安装成功

http://node1:9200/

安装logstash

tar -zxvf logstash-6.2.4.tar.gz

cd logstash-6.2.4

vi config/log-es.config

配置内容如下:

input {
    tcp {
        host => "192.168.1.6"
        port => 4560
    }
}

output {
    stdout {
      codec => rubydebug
    }
    elasticsearch{
        hosts => ["localhost:9200"]
        index => "log4j-%{+YYYY.MM.dd}"
        document_type => "log4j_type"
    }
}

启动logstash:

# -f为指定配置文件

nohup sh ./bin/logstash -f ../config/log-es.config > nohup.log &

配置安装Kibana

tar -zxvf kibana-6.2.4-linux-x86_64.tar.gz

cd kibana-6.2.4-linux-x86_64

vim kibana-6.2.4-linux-x86_64/config/kibana.yml

修改以下几项

1

2

3

4

server.port: 5601

server.host: “node1”

elasticsearch.url: http://node1:9200

kibana.index: “.kibana”

 

启动kibana:

1

nohup sh ./bin/kibana nohup.log &

     

猜你喜欢

转载自blog.csdn.net/zpc15200790194/article/details/81097532