docker-elk,elk安装问题内存

时间:2016-12-20 18:47:25

标签: amazon-ec2

我使用以下命令检索了elk:

docker pull docker.elastic.co/elasticsearch/elasticsearch:5.1.1

然后 我也在ec2上运行它 sysctl -w vm.max_map_count = 262144

这是docker-compose文件的内容 搬运工-compose.yml:

版本:' 2' 服务:   elasticsearch1:     image:docker.elastic.co/elasticsearch/elasticsearch:5.1.1     container_name:elasticsearch1     环境:        - cluster.name = docker-cluster        - bootstrap.memory_lock = true        - " ES_JAVA_OPTS = -Xms512m -Xmx512m"     ulimits:       MEMLOCK:         软:-1         硬:-1       没有文件:         软:65536         难:65536     mem_limit:1g     cap_add:        - IPC_LOCK     卷:        - esdata1:/ usr / share / elasticsearch / data     端口:        - 9200:9200     网络:        - esnet   elasticsearch2:     image:docker.elastic.co/elasticsearch/elasticsearch:5.1.1     环境:        - cluster.name = docker-cluster        - bootstrap.memory_lock = true        - " ES_JAVA_OPTS = -Xms512m -Xmx512m"        - " discovery.zen.ping.unicast.hosts = elasticsearch1"     ulimits:       MEMLOCK:         软:-1         硬:-1       没有文件:         软:65536         难:65536     mem_limit:1g     cap_add:        - IPC_LOCK     卷:        - esdata2:/ usr / share / elasticsearch / data     网络:        - esnet

卷:   esdata1:     司机:当地人   esdata2:     司机:本地

网络:   esnet:     司机:桥梁

但我继续使用撰写命令

发生此错误

docker-compose up

 OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000e5330000, 449642496, 0) failed; error='Out of memory' (errno=12)

elasticsearch2_1 | # elasticsearch2_1 | #Java Runtime Environment没有足够的内存来继续。 elasticsearch2_1 | #本机内存分配(mmap)无法映射449642496字节以提交保留内存。 elasticsearch2_1 | #包含更多信息的错误报告文件保存为: elasticsearch2_1 | #/usr/share/elasticsearch/hs_err_pid1.log 退出代码为1的ec2user_elasticsearch2_1

2 个答案:

答案 0 :(得分:0)

您是否正在使用AWS EC2容器服务(ECS)?

这很奇怪,因为你的ECS组合文件不起作用:mem_limit是,以字节为单位http://docs.aws.amazon.com/AmazonECS/latest/developerguide/cmd-ecs-cli-compose.html

version: '2'
services:
    elasticsearch1:
        image: docker.elastic.co/elasticsearch/elasticsearch:5.1.1
        container_name: elasticsearch1
        environment:
            - ES_JAVA_OPTS=-Xms500m -Xmx500m
        mem_limit: 524288000
        ulimits:
            memlock:
                soft: -1
                hard: -1
            nofile:
                soft: 65536
                hard: 65536
        ports:
            - 9200:9200
            - 9300:9300

你是否“sudo”这个命令?

sysctl -w vm.max_map_count=262144

为什么您的设置会谈论“elasticsearch1”和您的日志“elasticsearch2_1”?

答案 1 :(得分:0)

使用以下GitHub存储库构建docker并将其上传到AWS ECR,

https://github.com/nxtcloud-io/elk

ECS的示例任务定义在     https://github.com/nxtcloud-io/elk/blob/master/ecs/task-defination.json

我建议为容器使用至少2 GB RAM