当前位置: 首页>编程语言>正文

docker-compose 搭建 elascticsearch

首先服务器配置更改

/etc/sysctl.conf文件最后添加一行

vm.max_map_count=262144

临时修改 

sysctl -w vm.max_map_count=262144

/etc/security/limits.conf

* - nofile 65535 

* soft memlock unlimited 

* hard memlock unlimited

docker-compose.yaml    具体 内容

version: '3'

services:

  es30:

    image: elasticsearch:7.9.1

    container_name: es30

    environment:

      - node.name=es30

      - cluster.name=es-docker-cluster

      - discovery.seed_hosts=192.168.59.6,192.168.59.8

      - cluster.initial_master_nodes=es30

      - bootstrap.memory_lock=true

      - network.publish_host=192.168.59.30

      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"

    ulimits:

      memlock:

        soft: -1

        hard: -1

    volumes:

      - $PWD/elasticsearch/es01/data:/usr/share/elasticsearch/data

      - $PWD/elasticsearch/es01/logs:/usr/share/elasticsearch/logs

      - $PWD/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml

    ports:

      - 9211:9200

      - 9300:9300

    networks:

      - elastic

  es08:

    image: elasticsearch:7.9.1

    container_name: es08

    environment:

      - TAKE_FILE_OWNERSHIP=true

      - node.name=es08

      - cluster.name=es-docker-cluster

      - discovery.seed_hosts=192.168.59.30

      - cluster.initial_master_nodes=es30

      - bootstrap.memory_lock=true

      - network.publish_host=192.168.59.8

      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"

    ulimits:

      memlock:

        soft: -1

        hard: -1

    volumes:

      - $PWD/elasticsearch/es01/data:/usr/share/elasticsearch/data

      - $PWD/elasticsearch/es01/logs:/usr/share/elasticsearch/logs

      - $PWD/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml

    ports:

      - 9200:9200

      - 9300:9300

    networks:

      - elastic

  es06:

    image: elasticsearch:7.9.1

    container_name: es06

    environment:

      - TAKE_FILE_OWNERSHIP=true

      - node.name=es06

      - cluster.name=es-docker-cluster

      - discovery.seed_hosts=192.168.59.30

      - cluster.initial_master_nodes=es30

      - network.publish_host=192.168.59.6

      - bootstrap.memory_lock=true

      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"

    ulimits:

      memlock:

        soft: -1

        hard: -1

    volumes:

      - $PWD/elasticsearch/es01/data:/usr/share/elasticsearch/data

      - $PWD/elasticsearch/es01/logs:/usr/share/elasticsearch/logs

      - $PWD/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml

    ports:

      - 9200:9200

      - 9300:9300

    networks:

      - elastic

networks:

  elastic:

    driver: bridge

kibana 部署

docker run -d -p 5601:5601 -v $PWD/kibana/config/kibana.yml:/usr/share/kibana/config/kibana.yml --name kibana kibana:7.9.1

kibana.yml 内容

server.port: 5601

#网关地址

server.host: "0.0.0.0"

#

##Kibana实例对外展示的名称

server.name: "kibana"

#

##Elasticsearch的集群地址,也就是说所有的集群IP

elasticsearch.hosts: ["http://192.168.59.30:9211","http://192.168.59.8:9200","http://192.168.59.6:9200"]

#

##设置页面语言,中文使用zh-CN,英文使用en

i18n.locale: "zh-CN"

#

##这个配置还没理解清楚………………

xpack.monitoring.ui.container.elasticsearch.enabled: true


https://www.xamrdz.com/lan/5rz2016392.html

相关文章: