人的知识就好比一个圆圈,圆圈里面是已知的,圆圈外面是未知的。你知道得越多,圆圈也就越大,你不知道的也就越多。

0%

基于 Docker 搭建 Elasticsearch 集群

  1. 创建 network

    1
    docker network create --driver bridge --subnet 172.22.0.0/16 --gateway 172.22.0.1  op_net
  2. 创建 elasticsearch.yml

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    version: '3.6'

    services:
    cerebro:
    image: lmenezes/cerebro
    restart: always
    container_name: cerebro
    ports:
    - 9000:9000
    command:
    - -Dhosts.0.host=http://elasticsearch:9200
    networks:
    default:
    ipv4_address: 172.22.0.24
    kibana:
    image: kibana
    restart: always
    container_name: kibana
    environment:
    - I18N_LOCALE=zh-CN
    - TIMELION_ENABLED=true
    - XPACK_GRAPH_ENABLED=true
    - XPACK_MONITORING_COLLECTION_ENABLED="true"
    ports:
    - 5601:5601
    networks:
    default:
    ipv4_address: 172.22.0.25
    elasticsearch:
    image: elasticsearch
    restart: always
    container_name: es_hot
    environment:
    - cluster.name=es_cluster
    - node.name=es_hot
    - node.attr.box_type=hot
    - bootstrap.memory_lock=true
    - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    - discovery.seed_hosts=es_hot,es_warm,es_cold
    - cluster.initial_master_nodes=es_hot,es_warm,es_cold
    ulimits:
    memlock:
    soft: -1
    hard: -1
    volumes:
    - es_data_hot:/usr/share/elasticsearch/data
    ports:
    - 9200:9200
    networks:
    default:
    ipv4_address: 172.22.0.21
    elasticsearch2:
    image: elasticsearch
    restart: always
    container_name: es_warm
    environment:
    - cluster.name=es_cluster
    - node.name=es_warm
    - node.attr.box_type=warm
    - bootstrap.memory_lock=true
    - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    - discovery.seed_hosts=es_hot,es_warm,es_cold
    - cluster.initial_master_nodes=es_hot,es_warm,es_cold
    ulimits:
    memlock:
    soft: -1
    hard: -1
    volumes:
    - es_data_warm:/usr/share/elasticsearch/data
    networks:
    default:
    ipv4_address: 172.22.0.22
    elasticsearch3:
    image: elasticsearch
    restart: always
    container_name: es_cold
    environment:
    - cluster.name=es_cluster
    - node.name=es_cold
    - node.attr.box_type=cold
    - bootstrap.memory_lock=true
    - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    - discovery.seed_hosts=es_hot,es_warm,es_cold
    - cluster.initial_master_nodes=es_hot,es_warm,es_cold
    ulimits:
    memlock:
    soft: -1
    hard: -1
    volumes:
    - es_data_cold:/usr/share/elasticsearch/data
    networks:
    default:
    ipv4_address: 172.22.0.23


    volumes:
    es_data_hot:
    driver: local
    es_data_warm:
    driver: local
    es_data_cold:
    driver: local

    networks:
    default:
    external:
    name: op_net
  3. 启动 Elasticsearch 集群

    1
    docker-compose -f elasticsearch.yml up -d
小礼物走一走,来 Github 关注我