解决Docker启动Elasticsearch7.x报错的问题

使用Docker run 命令

docker run -d -p 9200:9200 -p 9300:9300 --name 用户自定义名字 容器ID

会看到一串字符串,一般情况下我们会误以为它启动成功

我们执行docker ps -a是发现它自动退出了

使用docker logs -f 容器ID 查看日志发现:

ERROR: [1] bootstrap checks failed

[1]: max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]

[2]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

错误提示

告诉我们是ES需要jvm内存太大了,所有我们需要改一下配置,执行下面代码

sysctl -w vm.max_map_count=262144

然后输入下列命令运行一下:

docker run -d -e ES_JAVA_POTS="-Xms256m -Xmx256m" -p 9200:9200 -p 9300:9300 --name ES3 8f46db60ddd6

查看日志发现还是报错:

ERROR: [1] bootstrap checks failed

[1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

解决方法如下:

docker run -d -e ES_JAVA_POTS="-Xms256m -Xmx256m" -e "discovery.type=single-node" -p 9200:9200 -p

:9300 --name ES3 8f46db60ddd6

最终就启动成功了!

补充知识:docker安装elasticsearch 6.4.3 停止

先打印日志

docker logs 9dcea100677b

OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
[2019-11-15T07:22:07,906][INFO ][o.e.n.Node ] [] initializing ...
[2019-11-15T07:22:08,101][INFO ][o.e.e.NodeEnvironment ] [d37UOiC] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [33.4gb], net total_space [39.2gb], types [rootfs]
[2019-11-15T07:22:08,102][INFO ][o.e.e.NodeEnvironment ] [d37UOiC] heap size [503.6mb], compressed ordinary object pointers [true]
[2019-11-15T07:22:08,111][INFO ][o.e.n.Node ] [d37UOiC] node name derived from node ID [d37UOiCyRQyKTBz5CfI0HQ]; set [node.name] to override
[2019-11-15T07:22:08,111][INFO ][o.e.n.Node ] [d37UOiC] version[6.4.3], pid[1], build[default/tar/fe40335/2018-10-30T23:17:19.084789Z], OS[Linux/3.10.0-1062.1.2.el7.x86_64/amd64], JVM["Oracle Corporation"/OpenJDK 64-Bit Server VM/10.0.2/10.0.2+13]
[2019-11-15T07:22:08,111][INFO ][o.e.n.Node ] [d37UOiC] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch.e3MyuoEc, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m, -Djava.locale.providers=COMPAT, -XX:UseAVX=2, -Des.cgroups.hierarchy.override=/, -Xms512m, -Xmx512m, -Des.path.home=/usr/share/elasticsearch, -Des.path.conf=/usr/share/elasticsearch/config, -Des.distribution.flavor=default, -Des.distribution.type=tar]
[2019-11-15T07:22:11,943][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [aggs-matrix-stats]
[2019-11-15T07:22:11,944][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [analysis-common]
[2019-11-15T07:22:11,944][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [ingest-common]
[2019-11-15T07:22:11,944][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [lang-expression]
[2019-11-15T07:22:11,944][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [lang-mustache]
[2019-11-15T07:22:11,945][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [lang-painless]
[2019-11-15T07:22:11,945][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [mapper-extras]
[2019-11-15T07:22:11,945][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [parent-join]
[2019-11-15T07:22:11,945][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [percolator]
[2019-11-15T07:22:11,945][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [rank-eval]
[2019-11-15T07:22:11,945][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [reindex]
[2019-11-15T07:22:11,945][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [repository-url]
[2019-11-15T07:22:11,945][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [transport-netty4]
[2019-11-15T07:22:11,945][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [tribe]
[2019-11-15T07:22:11,945][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [x-pack-core]
[2019-11-15T07:22:11,945][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [x-pack-deprecation]
[2019-11-15T07:22:11,945][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [x-pack-graph]
[2019-11-15T07:22:11,945][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [x-pack-logstash]
[2019-11-15T07:22:11,945][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [x-pack-ml]
[2019-11-15T07:22:11,945][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [x-pack-monitoring]
[2019-11-15T07:22:11,945][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [x-pack-rollup]
[2019-11-15T07:22:11,945][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [x-pack-security]
[2019-11-15T07:22:11,946][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [x-pack-sql]
[2019-11-15T07:22:11,946][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [x-pack-upgrade]
[2019-11-15T07:22:11,946][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded module [x-pack-watcher]
[2019-11-15T07:22:11,946][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded plugin [ingest-geoip]
[2019-11-15T07:22:11,946][INFO ][o.e.p.PluginsService ] [d37UOiC] loaded plugin [ingest-user-agent]
[2019-11-15T07:22:17,086][WARN ][o.e.d.s.ScriptModule ] Script: returning default values for missing document values is deprecated. Set system property '-Des.scripting.exception_for_missing_value=true' to make behaviour compatible with future major versions.
[2019-11-15T07:22:23,590][INFO ][o.e.x.s.a.s.FileRolesStore] [d37UOiC] parsed [0] roles from file [/usr/share/elasticsearch/config/roles.yml]
[2019-11-15T07:22:24,507][INFO ][o.e.x.m.j.p.l.CppLogMessageHandler] [controller/62] [Main.cc@109] controller (64 bit): Version 6.4.3 (Build 7a0781676dd492) Copyright (c) 2018 Elasticsearch BV
[2019-11-15T07:22:26,142][INFO ][o.e.d.DiscoveryModule ] [d37UOiC] using discovery type [zen]
[2019-11-15T07:22:28,041][INFO ][o.e.n.Node ] [d37UOiC] initialized
[2019-11-15T07:22:28,041][INFO ][o.e.n.Node ] [d37UOiC] starting ...
[2019-11-15T07:22:28,297][INFO ][o.e.t.TransportService ] [d37UOiC] publish_address {172.18.0.2:9300}, bound_addresses {[::]:9300}
[2019-11-15T07:22:28,350][INFO ][o.e.b.BootstrapChecks ] [d37UOiC] bound or publishing to a non-loopback address, enforcing bootstrap checks
ERROR: [1] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[2019-11-15T07:22:28,406][INFO ][o.e.n.Node ] [d37UOiC] stopping ...
[2019-11-15T07:22:28,423][INFO ][o.e.n.Node ] [d37UOiC] stopped
[2019-11-15T07:22:28,423][INFO ][o.e.n.Node ] [d37UOiC] closing ...
[2019-11-15T07:22:28,457][INFO ][o.e.n.Node ] [d37UOiC] closed
[2019-11-15T07:22:28,460][INFO ][o.e.x.m.j.p.NativeController] Native controller process has stopped - no new native processes can be started

感觉应该是jvm参数配置有问题

[root@iZ2ze9gna8ev4h0rme8ph0Z ~]# sudo sysctl -w vm.max_map_count=262144

docker run -d -p 9200:9200 -p 9300:9300 -e ES_JAVA_OPTS="-Xms512m -Xmx512m" -e -Des.scripting.exception_for_missing_value=true --name elasticsearch docker.io/elasticsearch:6.4.3

即可解决!

以上这篇解决Docker启动Elasticsearch7.x报错的问题就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持我们。

(0)

相关推荐

  • docker run之后状态总是Exited

    add -it docker run -it -name test -d nginx:latest /bin/bash -d: 后台运行容器,并返回容器ID: -i: 以交互模式运行容器,通常与 -t 同时使用: -t: 为容器重新分配一个伪输入终端,通常与 -i 同时使用: 补充知识:docker-compose 通过sh命令启动nginx 容器自动退出exited with code 0 docker-compose使用的模板文件中有通过entrypoint或者command参数设置容器启动

  • 在Docker中安装Elasticsearch7.6.2的教程

    安装docker 你要安装完成docker,不再说明了. 安装Elasticsearch 注意:使用版本为 7.6.2,你可以选择其他版本 拉取镜像 docker pull elasticsearch:7.6.2 启动容器 docker run --restart=always -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" \ -e ES_JAVA_OPTS="-Xms512m -Xmx512m"

  • docker 报错 Exited (1) 4 minutes ago的原因分析

    docker 报错 1. 查看原因 docker logs nexus 2. 报错原因 OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000e7000000, 419430400, 0) failed; error='Cannot allocate memory' (errno=12) # # There is insufficient memory for the Java Runtime Environmen

  • Docker 清理环境操作

    开始清理,需要慎重! 列出无用的卷 docker volume ls -qf dangling=true 清理无用的卷 docker volume rm $(docker volume ls -qf dangling=true) 清理无用的镜像 docker rmi $(docker images | grep '^<none>' | awk '{print $3}') 继续清理 docker system prune docker volume prune 以上足够使用,其他命令不要知道了!

  • docker容器状态的转换实现

    一 docker容器状态转换图 二 实战 [root@localhost ~]# docker info Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 3 Server Version: 17.09.0-ce Storage Driver: overlay Backing Filesystem: xfs Supports d_type: false Logging Driver: json-file Cgroup Driver: cg

  • docker run 运行容器自动结束的解决

    今天遇到了用Dockerfile创建镜像,镜像运行后容器自动结束问题. 启动命令: docker run -d -p 8080:8080 -v /usr/local/tomcat7.0/logs:/usr/local/tomcat7.0/logs --name tomcatweb tomcat:7.0 运行以后用docker ps 发现docker 容器已经结束了 查找资料后发现 这个问题并不复杂 原因是应为:Docker容器后台运行,就必须有一个前台进程. 解决办法: 1.将运行进程发放入前台

  • 解决Docker启动Elasticsearch7.x报错的问题

    使用Docker run 命令 docker run -d -p 9200:9200 -p 9300:9300 --name 用户自定义名字 容器ID 会看到一串字符串,一般情况下我们会误以为它启动成功 我们执行docker ps -a是发现它自动退出了 使用docker logs -f 容器ID 查看日志发现: ERROR: [1] bootstrap checks failed [1]: max virtual memory areas vm.max_map_count [65530] li

  • 解决maven启动Spring项目报错的问题

    第一个问题 java.lang.ClassCastException: org.springframework.web.SpringServletContainerInitializer cannot be cast to javax.servlet.ServletContainerInitializer 出现原因主要是 javax.servlet-api 在运行时将spring容器当成了servlet容器出现类型转换错误. 解决方法: 在pom.xml文件中修改 javax.servlet-a

  • docker容器调用yum报错的解决办法

    dockerfile里或者在容器里执行yum,报错,找不到源(invalid baseurl xxx),但是宿主机上执行yum是没问题的啊,为什么? 因为不论是dockerfile使用RUN关键字执行yum还是直接进入到容器里面执行yum,它们都是使用的docker镜像里面的源(CentOS是在路径/etc/yum.repo.d/CentOS-Base.repo),所以你要把宿主机上的同路径下的源拷贝到容器里面,然后docker commit一个新的"基础镜像",这个时候使用docke

  • springboot启动feign项目报错:Service id not legal hostnam的解决

    目录 springboot启动feign项目报错:Service id not legal hostnam 在feign项目中,定义接口调用服务 启动时报出异常信息 度娘后发现问题所在 配置文件服务名做同样修改 Service id not legal hostname (pin_user) 错误信息 出现原因 解决方案 springboot启动feign项目报错:Service id not legal hostnam 在feign项目中,定义接口调用服务 @FeignClient(name=

  • MySQL在Windows中net start mysql 启动MySQL服务报错 发生系统错误解决方案

    目录 1-错误详情 2-单次解决方法 2.1-目录 C:\Windows\System32 -> 找到 cmd.exe 2.2-右击属性 -> 以管理员身份运行 2.3-运行成功 3-永久解决方法 3.1-在 2.2 中:右击属性 -> 发送到(N) -> 桌面快捷方式 3.2-右击属性 -> 快捷方式 -> 高级 -> 以管理员身份运行 -> 确定 3.3-运行成功: 4-备注 4.1-Windows 服务名不区分大小写 4.2-两条语句含义 1-错误详情

  • 解决Vmware虚拟机安装centos8报错“Section %Packages Does Not End With %End. Pane Is Dead”

    Vmware虚拟机安装centos8 ,报错“Section %Packages Does Not End With %End. Pane Is Dead” 错误原因:创建虚拟机,自动加载两个CD 问题解决:把CD/DVD(IDE)禁用autoinst.iso,只启用CD/DVD2(IDE),重启,顺利完成安装 解决方法有两个: 1. 启动时连接不勾选 2.选中第一个CD,点击移除 问题解决!撒花! 到此这篇关于解决Vmware虚拟机安装centos8报错“Section %Packages D

  • 三个思路解决laravel上传文件报错:413 Request Entity Too Large问题

    最近一个项目当中,要求上传图片,并且限制图片大小,虽然在laravel当中已经添加了相关的表单验证来阻止文件过大的上传,然而当提交表单时,还没轮到laravel处理,nginx就先报错了.当你仔细看报错页面时,你会发现有nginx版本信息,经过分析,这报错是因为nginx的默认上传文件大小配置client_max_body_size只有2MB, 基于nginx验证比laravel验证要早,想要友好报错而不是直接显示413 Request Entity Too Large,那么就有三个思路去解决.

  • 解决iview打包时UglifyJs报错的问题

    使用npm run dev时运行是ok的,但是npm run build打包时iview报错, 如下: 原因是iview中使用了es6语法,然而uglifyJs是不支持的,打开我们的build/webpack.prod.conf.js文件,可以看到 // UglifyJs do not support ES6+, you can also use babel-minify for better treeshaking: https://github.com/babel/minify new we

  • 解决java junit单元测试@Test报错的问题

    在我们在myeclips里使用junit测试工具时有时会遇到错误,这是什么原因呢? 导致问题的原因通常有下面几个: (1)没有导入jar包 (2)导入jar包版本太低 (3)注意@Test要写在方法上面 如果不是几种问题,那便试试下面的解决方案: 1.在项目上点击右键,出现下图内容,选择properties 2.出现如下对话框,点击java build path,再选择add Library 3.之后如下图操作 4.选择junit4,点击finish,配置完毕. 以上这篇解决java junit

  • 解决安装python3.7.4报错Can''t connect to HTTPS URL because the SSL module is not available

    简述 从官网下载了Python3.7.4,直接编译安装后,使用pip3出现了报错信息: Can't connect to HTTPS URL because the SSL module is not available 错误原因 在Python3.7之后的版本,依赖的openssl,必须要是1.1或者1.0.2之后的版本,或者安装了2.6.4之后的libressl. image.png 而本地的openssl依然是1.0.1e的. [root@localhost ~]# openssl ver

随机推荐