1 先安装docker-compose

apt install docker-compose

2 为避免Elastic容器退出

日志内报错

ERROR: [1] bootstrap checks failed [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

则在宿主机中执行

vi /etc/sysctl.conf

追加如下代码

vm.max_map_count=262144

刷新系统配置

sysctl -p

3 编写配置文件

vim docker-compose.yaml

  1. version: '2.2'
  2. services:
  3. cerebro:
  4. image: lmenezes/cerebro:0.8.3
  5. container_name: cerebro
  6. ports:
  7. - "9000:9000"
  8. command:
  9. - -Dhosts.0.host=http://elasticsearch:9200
  10. networks:
  11. - elastic
  12. kibana:
  13. image: docker.elastic.co/kibana/kibana:7.1.0
  14. container_name: kibana7
  15. environment:
  16. - I18N_LOCALE=zh-CN
  17. - XPACK_GRAPH_ENABLED=true
  18. - TIMELION_ENABLED=true
  19. - XPACK_MONITORING_COLLECTION_ENABLED="true"
  20. ports:
  21. - "5601:5601"
  22. networks:
  23. - elastic
  24. elasticsearch:
  25. image: docker.elastic.co/elasticsearch/elasticsearch:7.1.0
  26. container_name: es7_01
  27. environment:
  28. - node.name=es7_01
  29. - cluster.name=es_cluster
  30. - discovery.seed_hosts=es7_02
  31. - cluster.initial_master_nodes=es7_01,es7_02
  32. - bootstrap.memory_lock=true
  33. - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
  34. ulimits:
  35. memlock:
  36. soft: -1
  37. hard: -1
  38. volumes:
  39. - es7data1:/usr/share/elasticsearch/data
  40. ports:
  41. - "9200:9200"
  42. networks:
  43. - elastic
  44. elasticsearch2:
  45. image: docker.elastic.co/elasticsearch/elasticsearch:7.1.0
  46. container_name: es7_02
  47. environment:
  48. - node.name=es7_02
  49. - cluster.name=es_cluster
  50. - discovery.seed_hosts=es7_01
  51. - cluster.initial_master_nodes=es7_01,es7_02
  52. - bootstrap.memory_lock=true
  53. - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
  54. ulimits:
  55. memlock:
  56. soft: -1
  57. hard: -1
  58. volumes:
  59. - es7data2:/usr/share/elasticsearch/data
  60. networks:
  61. - elastic
  62. volumes:
  63. es7data1:
  64. driver: local
  65. es7data2:
  66. driver: local
  67. networks:
  68. elastic:
  69. driver: bridge

执行docker-compose.yaml生成并启动服务, -d的意思是后台启动

sudo docker-compose up -d

(1) Elastic

image.png

(2) cerebro

image.png

(3) kibana

image.png