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: %
cluster.routing.allocation.disk.watermark.high: %
indices.fielddata.cache.size: %
indices.breaker.fielddata.limit: %
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:
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 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=
-XX:+UseCMSInitiatingOccupancyOnly ## G1GC Configuration
# NOTE: G1GC is only supported on JDK version or later.
# To use G1GC uncomment the lines below.
# -:-XX:-UseConcMarkSweepGC
# -:-XX:-UseCMSInitiatingOccupancyOnly
# -:-XX:+UseG1GC
# -:-XX:InitiatingHeapOccupancyPercent= ## 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- encoding by default (e.g. filenames)
-Dfile.encoding=UTF- # 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= # log4j
-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 GC logging :-XX:+PrintGCDetails
:-XX:+PrintGCDateStamps
:-XX:+PrintTenuringDistribution
:-XX:+PrintGCApplicationStoppedTime
:-Xloggc:logs/gc.log
:-XX:+UseGCLogFileRotation
:-XX:NumberOfGCLogFiles=
:-XX:GCLogFileSize=64m # JDK + GC logging
-:-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=,filesize=64m
# due to internationalization enhancements in JDK Elasticsearch need to set the provider to COMPAT otherwise
# time/date parsing will break in an incompatible way for some date patterns and locals
-:-Djava.locale.providers=COMPAT # temporary workaround for C2 bug with JDK on hardware with AVX-
-:-XX:UseAVX=

#cat docker-compose.yml

version: ''

services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.1.
ports:
- "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_elk
volumes:
- ./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.options logstash:
image: docker.elastic.co/logstash/logstash:6.1.
command: -f /etc/logstash/conf.d/ --config.reload.automatic
volumes:
- ./logstash/config:/etc/logstash/conf.d
ports:
- "5001:5001"
- "5044:5044"
networks:
- docker_elk
depends_on:
- elasticsearch
kibana:
image: docker.elastic.co/kibana/kibana:6.1.
volumes:
- /tmp/:/etc/archives/
- ./kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml
# - /data/tt:/usr/share/kibana/plugins/
ports:
- "5601:5601"
networks:
- docker_elk
depends_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= 使参数生效
sysctl -p

chown -R  1000:1000  /data/elasticsearch1

4、启动容器

在docker-compose文件的目录下:

#docker-compose  up  -d

5、配置nginx反向代理

server {
listen *:;
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 *:;
location / {
proxy_pass http://10.10.1.2:9200;
}
} server {
client_max_body_size 2048m;
client_body_timeout 300000000s;
send_timeout 300000000s;
listen *:;
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

docker-部署elk-6.1.3的更多相关文章

  1. Docker 部署 elk + filebeat

    Docker 部署 elk + filebeat kibana 开源的分析与可视化平台logstash 日志收集工具 logstash-forwarder(原名lubmberjack)elastics ...

  2. Docker 部署ELK之Sentinl日志报警

    前篇文章简单介绍了Docker 部署ELK,以及使用filebeat收集java日志.这篇我们介绍下日志报警配置,这里我们使用Sentinl插件. 1.修改kibana参数 进入elk容器,修改对应参 ...

  3. 利用docker部署elk交换机日志分析

    今天我们来聊一下利用docker部署elk日志分析系统,这里解析一下elk是啥东西.elk分别是Elasticsearch,Logstash和Kibana的首字母缩写. Elasticsearch是一 ...

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

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

  5. Docker 部署ELK

    1.安装docker前安装pip sudo yum -y install epel-release sudo yum install python-pip 2.安装docker #安装依赖包 yum ...

  6. Linux实战(20):非docker部署ELK

    部署环境: Elasticsearch:7.5.2 Kibana:7.5.2 Logstash:7.5.2 filebeat:7.5.2 redis:最新版 部署方式:rpm+二进制包 使用架构 软件 ...

  7. Docker部署ELK之部署filebeat7.6.0(3)

    1. filebeat介绍 Filebeat是用于转发和集中日志数据的轻量级传送工具.Filebeat监视您指定的日志文件或位置,收集日志事件,并将它们转发到Elasticsearch或 Logsta ...

  8. docker部署ELK日志处理

    docker环境下部署的ELK系统,日志处理,保留最近五个小时的日志 dockerlog.sh #!/bin/bash logs=`find /var/lib/docker/containers/ - ...

  9. Docker部署ELK 日志归集

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

  10. Docker部署ELK 7.0.1集群之Logstash安装介绍

    1.下载镜像 [root@vanje-dev01 ~]# docker pull logstash: 2.安装部署 2.1  创建宿主映射目录 [root@vanje-dev01 ~]# mkdir ...

随机推荐

  1. POJ2270&&Hdu1808 Halloween treats 2017-06-29 14:29 40人阅读 评论(0) 收藏

    Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 8565   Accepted: 3111 ...

  2. python操作Hbase

    本地操作 启动thrift服务:./bin/hbase-daemon.sh start thrift hbase模块产生: 下载thrfit源码包:thrift-0.8.0.tar.gz 解压安装 . ...

  3. AngularJS 指令生命周期 complie link

    AnguarJS指令从解析到生效一共会经历Inject.Compile.Controller加载.Pre-link.Post-link这几个主要阶段. 一.AngularJS指令执行过程 1.加载An ...

  4. 自定义延时关闭弹窗,替代MesssageBox

    1,新建一个窗体MessageForm,在里面加一个label控件和timer 2,代码如下: public partial class MessageForm : Form { int t; str ...

  5. MVC使用TempData将返回的string传到另一个控制器页面中显示!

    我需要把数据库中查询出的数据,传递到另一个控制器的页面去显示. https://blog.csdn.net/ma_jiang/article/details/8164212 看了上面这篇文章,反应过来 ...

  6. 尝试asp.net mvc 基于controller action 方式权限控制方案可行性(转载)

    微软在推出mvc框架不久,短短几年里,版本更新之快,真是大快人心,微软在这种优秀的框架上做了大量的精力投入,是值得赞同的,毕竟程序员驾驭在这种框架上,能够强力的精化代码,代码层次也更加优雅,扩展较为方 ...

  7. 【转】C#模拟http 发送post或get请求

    原文地址:http://www.cnblogs.com/xssxss/archive/2012/07/03/2574554.html 模拟POST Json public static string ...

  8. Mysql 经典案例总结(学习之前需要有Mysql基础)01

    Sql 经典案例 gb 4.2 ** 1 检索记录 (1) 主要介绍 Sql的基本SELECT查询语句 使用 SELECT * from 表 查询数据 查询该表的每一列数据 * 代表所有的意思 也可以 ...

  9. Linux玩转redis从入门到放肆--1.缓存击穿

    1. 缓存穿透在大多数互联网应用中,缓存的使用方式如下图所示: 1.当业务系统发起某一个查询请求时,首先判断缓存中是否有该数据:2.如果缓存中存在,则直接返回数据:3.如果缓存中不存在,则再查询数据库 ...

  10. CentOS7.x编译安装nginx,实现HTTP2

    网站使用HTTP2有助于网站加速及更安全,要配置HTTP2必须满足两个条件:①openssl的版本必须在1.0.2e及以上.②nginx的版本必须在1.9.5以上 一.准备工作  配置HTTP2之前需 ...