1、更新daocker版本

2、pull官方的镜像

https://www.elastic.co/guide/en/elasticsearch/reference/6.1/docker.html

https://www.elastic.co/guide/en/kibana/6.1/_pulling_the_image.html

https://www.elastic.co/guide/en/logstash/6.1/docker.html

选择正常版本:

# docker pull docker.elastic.co/elasticsearch/elasticsearch:6.1.3

# docker pull docker.elastic.co/kibana/kibana:6.1.3

# docker pull docker.elastic.co/logstash/logstash:6.1.3

3、创建容器,使用docker-compose

1)创建三个目录,分别存放配置文件

#mkdir  /data/{elasticsearch,logstash,kibana}

#mkdir /data/tt  #用来存放插件,有的时候在容器内无法安装

# cat elasticsearch.yml

action.auto_create_index: true
#script.groovy.sandbox.enabled: true
#script.engine.groovy.inline.aggs: true
#Set a custom allowed content length:
http.max_content_length: 500mb
cluster.routing.allocation.disk.watermark.low: 90%
cluster.routing.allocation.disk.watermark.high: 95%
indices.fielddata.cache.size:  20%
indices.breaker.fielddata.limit: 60%
network.host: 0.0.0.0
xpack.security.enabled: false

# cat kibana.yml

---
# Default Kibana configuration from kibana-docker.server.name: kibana
server.host: "0.0.0.0"
elasticsearch.url: http://elasticsearch:9200
xpack.monitoring.ui.container.elasticsearch.enabled: false
server.port: 5601
xpack.security.enabled: false

#cat  jvm.options

## JVM configuration################################################################
## IMPORTANT: JVM heap size
################################################################
##
## You should always set the min and max JVM heap
## size to the same value. For example, to set
## the heap to 4 GB, set:
##
## -Xms4g
## -Xmx4g
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html
## for more information
##
################################################################# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space-Xms2g
-Xmx2g################################################################
## Expert settings
################################################################
##
## All settings below this section are considered
## expert settings. Don't tamper with them unless
## you understand what you are doing
##
################################################################## GC configuration
-XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=75
-XX:+UseCMSInitiatingOccupancyOnly## G1GC Configuration
# NOTE: G1GC is only supported on JDK version 10 or later.
# To use G1GC uncomment the lines below.
# 10-:-XX:-UseConcMarkSweepGC
# 10-:-XX:-UseCMSInitiatingOccupancyOnly
# 10-:-XX:+UseG1GC
# 10-:-XX:InitiatingHeapOccupancyPercent=75## optimizations# pre-touch memory pages used by the JVM during initialization
-XX:+AlwaysPreTouch## basic# explicitly set the stack size
-Xss1m# set to headless, just in case
-Djava.awt.headless=true# ensure UTF-8 encoding by default (e.g. filenames)
-Dfile.encoding=UTF-8# use our provided JNA always versus the system one
-Djna.nosys=true# turn off a JDK optimization that throws away stack traces for common
# exceptions because stack traces are important for debugging
-XX:-OmitStackTraceInFastThrow# flags to configure Netty
-Dio.netty.noUnsafe=true
-Dio.netty.noKeySetOptimization=true
-Dio.netty.recycler.maxCapacityPerThread=0# log4j 2
-Dlog4j.shutdownHookEnabled=false
-Dlog4j2.disable.jmx=true-Djava.io.tmpdir=${ES_TMPDIR}## heap dumps# generate a heap dump when an allocation from the Java heap fails
# heap dumps are created in the working directory of the JVM
-XX:+HeapDumpOnOutOfMemoryError# specify an alternative path for heap dumps; ensure the directory exists and
# has sufficient space
-XX:HeapDumpPath=data# specify an alternative path for JVM fatal error logs
-XX:ErrorFile=logs/hs_err_pid%p.log## JDK 8 GC logging8:-XX:+PrintGCDetails
8:-XX:+PrintGCDateStamps
8:-XX:+PrintTenuringDistribution
8:-XX:+PrintGCApplicationStoppedTime
8:-Xloggc:logs/gc.log
8:-XX:+UseGCLogFileRotation
8:-XX:NumberOfGCLogFiles=32
8:-XX:GCLogFileSize=64m# JDK 9+ GC logging
9-:-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m
# due to internationalization enhancements in JDK 9 Elasticsearch need to set the provider to COMPAT otherwise
# time/date parsing will break in an incompatible way for some date patterns and locals
9-:-Djava.locale.providers=COMPAT# temporary workaround for C2 bug with JDK 10 on hardware with AVX-512
10-:-XX:UseAVX=2

#cat docker-compose.yml

version: '2'services:elasticsearch:image: docker.elastic.co/elasticsearch/elasticsearch:6.1.3ports:- "9200:9200"- "9300:9300"environment:- ES_JAVA_OPTS: "-Xms30g -Xmx30g"

      - cluster.name=docker-cluster

        - bootstrap.memory_lock=true

 

ulimits:
        memlock:
          soft: -1
          hard: -1

networks:- docker_elkvolumes:- ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml- /data/elasticsearch1:/usr/share/elasticsearch/data- /data/tt:/usr/share/elasticsearch/plugins/- /data/backups:/usr/share/elasticsearch/backups- /data/longterm_backups:/usr/share/elasticsearch/longterm_backups- ./elasticsearch/config/jvm.options:/usr/share/elasticsearch/config/jvm.optionslogstash:image: docker.elastic.co/logstash/logstash:6.1.3command: -f /etc/logstash/conf.d/ --config.reload.automatic volumes:- ./logstash/config:/etc/logstash/conf.dports:- "5001:5001"- "5044:5044"networks:- docker_elkdepends_on:- elasticsearchkibana:image: docker.elastic.co/kibana/kibana:6.1.3volumes:- /tmp/:/etc/archives/- ./kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml# - /data/tt:/usr/share/kibana/plugins/ports:- "5601:5601"networks:- docker_elkdepends_on:- elasticsearch
networks:docker_elk:driver: bridge

提前将插件下载到/data/tt目录下面。x-pack一定要安装到elasticsearch,下载x-pack:

# wget https://artifacts.elastic.co/downloads/packs/x-pack/x-pack-6.1.3.zip

仅保留elasticsearch目录,其他的都删掉,并将elasticsearch重命名为x-pack

#mv elasticsearch  x-pack

重启elasticsearch。

修改系统参数:

vim /etc/sysctl.conf
vm.max_map_count=262144使参数生效
sysctl -p

chown -R  1000:1000  /data/elasticsearch1

4、启动容器

在docker-compose文件的目录下:

#docker-compose  up  -d

5、配置nginx反向代理

server {listen *:80;client_max_body_size 2048m;client_body_timeout 300000000s;send_timeout 3000000000s;auth_basic "Protected Elasticsearch";auth_basic_user_file /etc/nginx/.htpasswd;access_log  /var/log/nginx/elk_access.log;error_log   /var/log/nginx/elk_error.log;server_name elk.xget.com;location / {proxy_pass http://10.10.1.2:5601;
                 proxy_read_timeout  200000s;proxy_send_timeout  200000s;}}server {listen *:9200;location / {proxy_pass http://10.10.1.2:9200;
        }
}server {client_max_body_size 2048m;client_body_timeout 300000000s;send_timeout 300000000s;listen *:9300;location / {proxy_pass http://10.10.1.2:9300;
                 proxy_read_timeout  20000s;proxy_send_timeout  20000s;}
}

FAQ:

1、启动过程elasticsearch报错,配置文件里面的x-pack相关配置,加载不了。此时可以先把配置文件里面x-pack相关想注释掉,启动后再添加上。然后重启elasticsearch。

2、kibana启动后访问界面,需要认证,可以在elasticsearch和kibana的配置文件里面添加如下内容,禁用认证:

xpack.security.enabled: false

转载于:https://www.cnblogs.com/cuishuai/p/8423806.html

docker-部署elk-6.1.3相关推荐

  1. Docker 部署ELK 日志分析

    Docker 部署ELK 日志分析 elk集成镜像包 名字是 sebp/elk 安装 docke.启动 yum install docke service docker start Docker至少得 ...

  2. docker部署ELK

    docker部署ELK 文件目录结构 docker-compose.yml 文件 elasticsearch.yml kibana.yml logstash.yml logstash.conf fil ...

  3. 被一位读者赶超,手摸手 Docker 部署 ELK Stack

    被一位读者赶超,容器化部署 ELK Stack 你好,我是悟空. 被奇幻"催更" 最近有个读者,他叫"老王",外号"茴香豆泡酒",找我崔更 ...

  4. Docker部署ELK(ElasticSearch logstash Kibana)

    Docker部署ELK 一 . ElasticSearch安装 新建elasticsearch目录,并再其下新建文件config/elasticsearch.yml,文件内容如下: cluster.n ...

  5. Docker部署ELK(配置密码登录)及Elastalert企业微信告警配置

    ELK部署记录 部署Elasticsearch.Kibana.Cerebro 通过docker进行部署,可以避免很多缺少依赖的问题,推荐使用centos7环境进行部署,请提前安装好docker服务. ...

  6. Docker部署ELK 日志归集

    ELK ELK是Elasticsearch.Logstash.Kibana的缩写,使用ELK的原因是因为公司使用Spring cloud部署了多个微服务,不同的微服务有不同的日志文件,当生产上出现问题 ...

  7. docker部署ELK、grafana、zabbix

    零.参考链接 elk安装 https://www.elastic.co/guide/en/elasticsearch/reference/6.4/docker.html#docker-cli-run- ...

  8. 生产环境Docker部署ELK跨区访问kafka不通问题的解决

    由于分布式系统的日志集中采集的需求非常强烈,我们组通过调研和实践搭建了一套基于Docker的日志收集系统Amethyst. 我们首先在测试环境搭建了一套基于Docker swarm集群的ELK分布式环 ...

  9. 使用docker部署elk

    网上的那些零零碎碎的,基本你都不好用.自己将网上的以及自己的整理成一个版本. 1.拉取elk镜像 docker pull wallbase/elasticsearch-head:6-alpine do ...

  10. Docker部署SpringCloud ELK+RabbitMQ日志

    Docker部署SpringCloud ELK+RabbitMQ日志 Im_Coder 原文:https://www.jianshu.com/p/f773f23096a9 一.效果图 image.pn ...

最新文章

  1. 常量(const)与只读(readonly)字段
  2. python编程案例教程书籍-Python程序设计案例教程
  3. 【作业四】软件案例分析之必应词典
  4. 剑指offer-有序二维数组中的查找
  5. c语言入门教程文库,C语言入门教程(全集)课件
  6. NetBeans Java EE技巧3:数据库中的RESTful Web服务
  7. centos7 docker删除端口映射_容器Docker详解
  8. c语言综合知识,软件设计师教程综合知识集锦之C语言编程风格
  9. matlab 不允许函数定义,matlab中函数定义在脚本中不允许是什么意思
  10. 网站泛解析 和 主记录解析
  11. ubuntu联网_Ubuntu物联网操作系统新版发布,支持10年安全更新,镜像仅280M
  12. java构造函数中启动线程_通过构造器启动线程的实现方式及其缺点记录。
  13. 在Windows下的virtualenv中搭建Flask+MySQLDb开发环境
  14. html单页模板wap,单页模板html
  15. 输入框添加Emoje表情demo
  16. 微信小程序对餐饮行业有哪些影响
  17. C++ 上溢和下溢(overflow underflow)
  18. 提取文件夹中图片名字
  19. 思科认证入门级课程介绍(一)
  20. Linux发行版:CentOS、Ubuntu、RedHat、Android、Tizen、MeeGo

热门文章

  1. Python2.7基础知识点思维导图
  2. 如何从代码层面优化系统性能
  3. 配置IIS的负载均衡
  4. 【百度地图API】如何制作多途经点的线路导航——驾车篇
  5. 2021年河北高考成绩位次怎么查询,2021年河北高考一分一段表查询排名方法 成绩排名位次什么时候公布...
  6. libboost_filesystem.so: undefined reference to
  7. 《软件加密与解密》第三版学习日志二
  8. 数据结构源码笔记(C语言):链接栈
  9. ubuntu10.04下安装windows7
  10. Sharding Sphere 读写分离的配置