1. version: '3.1'
    2. services:
    3. elasticsearch:
    4. image: elasticsearch:7.13.3
    5. container_name: elasticsearch
    6. privileged: true
    7. environment:
    8. - "cluster.name=elasticsearch" #设置集群名称为elasticsearch
    9. - "discovery.type=single-node" #以单一节点模式启动
    10. - "ES_JAVA_OPTS=-Xms512m -Xmx1096m" #设置使用jvm内存大小
    11. - bootstrap.memory_lock=true
    12. volumes:
    13. - ./es/plugins:/usr/local/dockercompose/elasticsearch/plugins #插件文件挂载
    14. - ./es/data:/usr/local/dockercompose/elasticsearch/data:rw #数据文件挂载
    15. - ./es/logs:/usr/local/dockercompose/elasticsearch/logs:rw
    16. ports:
    17. - 9200:9200
    18. - 9300:9300
    19. deploy:
    20. resources:
    21. limits:
    22. cpus: "2"
    23. memory: 1000M
    24. reservations:
    25. memory: 200M
    26. kibana:
    27. image: kibana:7.13.3
    28. container_name: kibana
    29. depends_on:
    30. - elasticsearch #kibana在elasticsearch启动之后再启动
    31. environment:
    32. ELASTICSEARCH_HOSTS: http://elasticsearch:9200 #设置访问elasticsearch的地址
    33. I18N_LOCALE: zh-CN
    34. ports:
    35. - 5601:5601

    1.将docker-compose.yml上传至文件夹/usr/local/dockercompose/elasticsearch中
    2.创建文件夹
    mkdir /usr/local/dockercompose/elasticsearch/plugins
    mkdir /usr/local/dockercompose/elasticsearch/data
    mkdir /usr/local/dockercompose/elasticsearch/logs

    kibana
    http://192.168.199.130:5601/