为什么具有Elasticsearch状态的Docker映像始终重新启动? [英] why docker image with elasticsearch status restarting always?

查看:754
本文介绍了为什么具有Elasticsearch状态的Docker映像始终重新启动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

unbuntu 16.04,ram 1gb,在aws实例上

unbuntu 16.04, ram 1gb, on aws instance

我必须运行旧的elasticsearch实例,所以我想使用elasticsearch 5.3.3版本的docker镜像。通过查看具有相同标题的stackoverflow多个链接,我修改了基于docker image的弹性搜索的安装,如下所示

I had to run old instance of elasticsearch so I wanted use a docker image of elasticsearch 5.3.3 version. by seeing the stackoverflow multiple links with same title, i have modified my installation of docker image based elasticsearch as below

sudo docker run -p 9200:9200 -p 9300:9300 -d -e "http.host=0.0.0.0" -e "transport.host=127.0.0.1" -e "xpack.security.enabled=false" --restart=unless-stopped --name careerassistant-elastic  docker.elastic.co/elasticsearch/elasticsearch:5.3.3

the安装完成,并且访问弹性搜索时遇到问题,尽管我进行了上述命令的多项修改,但无法解决问题。

the installation is finished and have problem with accessing the elasticsearch, though I had mutliple modifications as above command, I couldnt resolve the issue. when on

sudo docker ps

状态仍然为-> 48秒前重新启动(1)

the status is still --> restarting(1) 48 seconds ago

当我检查docker的日志时我什么都不知道因为我是docker及其使用的新手

when i was checking the log of the docker i couldnt understand anything as i am new to docker and its utilization

> docker logs --tail 50 --follow --timestamps careerassistant-elastic

我得到以下输出

2020-05-04T09:36:00.552415247Z CmaTotal:              0 kB
2020-05-04T09:36:00.552418314Z CmaFree:               0 kB
2020-05-04T09:36:00.552421364Z HugePages_Total:       0
2020-05-04T09:36:00.552424343Z HugePages_Free:        0
2020-05-04T09:36:00.552427401Z HugePages_Rsvd:        0
2020-05-04T09:36:00.552430358Z HugePages_Surp:        0
2020-05-04T09:36:00.552433336Z Hugepagesize:       2048 kB
2020-05-04T09:36:00.552436334Z DirectMap4k:       67584 kB
2020-05-04T09:36:00.552439415Z DirectMap2M:      980992 kB
2020-05-04T09:36:00.552442390Z 
2020-05-04T09:36:00.552445460Z 
2020-05-04T09:36:00.552448777Z CPU:total 1 (initial active 1) (1 cores per cpu, 1 threads per core) family 6 model 63 stepping 2, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, lzcnt, tsc, bmi1, bmi2
2020-05-04T09:36:00.552452312Z 
2020-05-04T09:36:00.552455227Z /proc/cpuinfo:
2020-05-04T09:36:00.552458471Z processor    : 0
2020-05-04T09:36:00.552461695Z vendor_id    : GenuineIntel
2020-05-04T09:36:00.552464872Z cpu family   : 6
2020-05-04T09:36:00.552467992Z model        : 63
2020-05-04T09:36:00.552471311Z model name   : Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz
2020-05-04T09:36:00.552474616Z stepping : 2
2020-05-04T09:36:00.552477715Z microcode    : 0x43
2020-05-04T09:36:00.552480781Z cpu MHz      : 2400.040
2020-05-04T09:36:00.552483934Z cache size   : 30720 KB
2020-05-04T09:36:00.552486978Z physical id  : 0
2020-05-04T09:36:00.552490023Z siblings : 1
2020-05-04T09:36:00.552493103Z core id      : 0
2020-05-04T09:36:00.552496146Z cpu cores    : 1
2020-05-04T09:36:00.552511390Z apicid       : 0
2020-05-04T09:36:00.552515457Z initial apicid   : 0
2020-05-04T09:36:00.552518523Z fpu      : yes
2020-05-04T09:36:00.552521677Z fpu_exception    : yes
2020-05-04T09:36:00.552524702Z cpuid level  : 13
2020-05-04T09:36:00.552527802Z wp       : yes
2020-05-04T09:36:00.552531691Z flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm invpcid_single kaiser fsgsbase bmi1 avx2 smep bmi2 erms invpcid xsaveopt
2020-05-04T09:36:00.552535638Z bugs     : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
2020-05-04T09:36:00.552538954Z bogomips : 4800.08
2020-05-04T09:36:00.552545171Z clflush size : 64
2020-05-04T09:36:00.552548419Z cache_alignment  : 64
2020-05-04T09:36:00.552551514Z address sizes    : 46 bits physical, 48 bits virtual
2020-05-04T09:36:00.552554916Z power management:
2020-05-04T09:36:00.552558030Z 
2020-05-04T09:36:00.552561090Z 
2020-05-04T09:36:00.552564141Z 
2020-05-04T09:36:00.552567135Z Memory: 4k page, physical 1014424k(76792k free), swap 0k(0k free)
2020-05-04T09:36:00.552570458Z 
2020-05-04T09:36:00.552573441Z vm_info: OpenJDK 64-Bit Server VM (25.131-b11) for linux-amd64 JRE (1.8.0_131-b11), built on Jun 16 2017 13:51:29 by "buildozer" with gcc 6.3.0
2020-05-04T09:36:00.552576947Z 
2020-05-04T09:36:00.552579894Z time: Mon May  4 09:36:00 2020
2020-05-04T09:36:00.552582956Z elapsed time: 0 seconds (0d 0h 0m 0s)
2020-05-04T09:36:00.552586052Z

有人可以帮我弄清楚重启docker状态可能是什么问题吗?

can someone help me out to figure what could be the problem for docker status to be restarting ?

推荐答案

我在AWS ec2 t2.small 上运行我的docker容器,该容器具有2 GB RAM作为 t2.micro 内存(1GB )还不足以运行Elasticsearch容器,因此,在您配置了更多内容之前,也应该对您没问题。 查看了您的日志,但是我没有看到任何错误,因此如果没有您的docker-file,很难调试。

I run my docker container on AWS ec2 t2.small which has 2 GB RAM as t2.micro memory(1GB) isn't enough for running the Elasticsearch container, so it should be fine for you as well until you have configured a lot more things. Looked into your logs but I don't see any error, hence difficult to debug without your docker-file.

下面是我的docker-在AWS t2.small实例的docker容器中编写用于运行Elasticsearch 7.6的文件,让我知道它是否对您不起作用,并乐意为您提供进一步的帮助。

Below is my docker-compose file for running Elasticsearch 7.6 in a docker container in AWS t2.small instance, let me know if it doesn't work for you and happy to help further.

version: '2.2'
services:
  #Elasticsearch Docker Images: https://www.docker.elastic.co/
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.6.0
    container_name: elasticsearch
    environment:
      - xpack.security.enabled=false
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    cap_add:
      - IPC_LOCK
    volumes:
      - elasticsearch-data:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
      - 9300:9300

volumes:
  elasticsearch-data:
    driver: local

您可以使用 docker-compose up -d -e discovery.type = single-node 命令运行它。并参考我的如果您遇到任何与内存相关的问题,例如 vm.max_map_count = 262144要求
$ c>

You can run it using docker-compose up -d -e "discovery.type=single-node" command. and refer my this Elasticsearch docker container in non-prod mode to eliminate vm.max_map_count=262144 requirement answer if you face any memory-related issue like vm.max_map_count=262144 requirement

这篇关于为什么具有Elasticsearch状态的Docker映像始终重新启动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆