docker-compose 运行es 集群 && Kibana 数据可视化
blank
blank
发布于 2019-03-18 / 632 阅读 / 0 评论 / 0 点赞

docker-compose 运行es 集群 && Kibana 数据可视化

创建docker-compose.yml 文件

version: '2.2'
services:
 # es 1
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:6.6.2
    container_name: elasticsearch
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata1:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
      - 9300:9300
    networks:
      - esnet
  # es 2
  elasticsearch2:
    image: docker.elastic.co/elasticsearch/elasticsearch:6.6.2
    container_name: elasticsearch2
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - "discovery.zen.ping.unicast.hosts=elasticsearch"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata2:/usr/share/elasticsearch/data
    networks:
      - esnet
  #es可视化
  kibana:
   image: kibana:6.6.2
   environment:
     SERVER_NAME: kibana
     ELASTICSEARCH_URL: http://192.168.10.51:9200 (修改为你启动es的服务器ip端口不要动,如要修改保持跟上面9200修改后的一致)
   ports:
     - "5601:5601"
   depends_on:
     - elasticsearch
volumes:
  esdata1:
    driver: local
  esdata2:
    driver: local

networks:
  esnet:

启动

docker-compose up -d

访问 http://192.168.10.51:9200 检查ES是否成功启动

{
  "name" : "m6STB_O",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "pjJ68EUyQTGvastpWH1r8A",
  "version" : {
    "number" : "6.6.2",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "3bd3e59",
    "build_date" : "2019-03-06T15:16:26.864148Z",
    "build_snapshot" : false,
    "lucene_version" : "7.6.0",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

成功

访问 服务器ip:5601 检查kibana是否成功启动

PS

如果启动出错报 max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

需要修改 vm.max_map_count

查看当前 max_map_count

cat /etc/sysctl.conf |grep max_map_count

修改系统 max_map_count

echo "vm.max_map_count=262144" >>  /etc/sysctl.conf
sysctl -p

修改/etc/security/limits.conf

echo "* soft nofile 655350" >> /etc/security/limits.conf
echo "* hard nofile 655350" >> /etc/security/limits.conf
sysctl -p
PS2

如果有更新的版本的 ES
修改ES版本号请注意Kibana版本号应该跟es的版本号保持一致
否则Kibana 将无法正常运行

Thanks for:
es官网 Kibana配置


评论