一尘不染

为什么具有Elasticsearch状态的Docker映像始终重启?

docker

unbuntu 16.04,RAM 1GB,在AWS实例上

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

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

安装完成,并且访问elasticsearch时遇到问题,尽管我对上述命令进行了多次修改,但无法解决问题。当上

sudo docker ps

状态仍然为-> 48秒前正在重启(1)

当我检查Docker的日志时,我无法理解任何内容,因为我是Docker及其使用的新手

> 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 status重新启动可能是什么问题吗?


阅读 1245

收藏
2020-06-17

共1个答案

一尘不染

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

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

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"命令运行它。如果遇到任何与内存相关的问题,请以非生产模式引用我的这个Elasticsearch docker容器以消除vm.max_map_count =262144要求的答案vm.max_map_count=262144 requirement

2020-06-17