ElasticSearch의 docker 클러스터 구축

2731 단어 ElasticSearch

1. 세우다

  • 파일 마운트 디렉터리를 만들고 777 권한 열기
  • mkdir -p /data/es/data1
    mkdir -p /data/es/data2
    mkdir -p /data/es/data3
    chmod -R 777 /data/es/data1
    chmod -R 777 /data/es/data2
    chmod -R 777 /data/es/data3
    
  • es 프로필 만들기
  • mkdir -p /data/es/config
    
    #vim /data/es/config/es1.yml
    
    cluster.name: elasticsearch-cluster
    node.name: es-node1
    network.bind_host: 0.0.0.0
    network.publish_host: *.*.*.*
    http.port: 9200
    transport.tcp.port: 9300
    http.cors.enabled: true
    http.cors.allow-origin: "*"
    node.master: true 
    node.data: true  
    discovery.zen.ping.unicast.hosts: ["*.*.*.*:9300","*.*.*.*:9301","*.*.*.*:9302"]
    discovery.zen.minimum_master_nodes: 2

    PS:network.publish_host: *.*.*.*호스트 IP로 교체
    #vim /data/es/config/es2.yml
    
    cluster.name: elasticsearch-cluster
    node.name: es-node2
    network.bind_host: 0.0.0.0
    network.publish_host: *.*.*.*
    http.port: 9201
    transport.tcp.port: 9301
    http.cors.enabled: true
    http.cors.allow-origin: "*"
    node.master: true 
    node.data: true  
    discovery.zen.ping.unicast.hosts: ["*.*.*.*:9300","*.*.*.*:9301","*.*.*.*:9302"]
    discovery.zen.minimum_master_nodes: 2

     
    #vim /data/es/config/es3.yml
    
    cluster.name: elasticsearch-cluster
    node.name: es-node3
    network.bind_host: 0.0.0.0
    network.publish_host: *.*.*.*
    http.port: 9202
    transport.tcp.port: 9302
    http.cors.enabled: true
    http.cors.allow-origin: "*"
    node.master: true 
    node.data: true  
    discovery.zen.ping.unicast.hosts: ["*.*.*.*:9300","*.*.*.*:9301","*.*.*.*:9302"]
    discovery.zen.minimum_master_nodes: 2

     
  • es클러스터 시작
  •  docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9200:9200 -p 9300:9300 -v /data/es/config/es1.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /data/es/data1:/usr/share/elasticsearch/data --name ES01 elasticsearch:6.8.5
     
     docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9201:9201 -p 9301:9301 -v /data/es/config/es2.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /data/es/data2:/usr/share/elasticsearch/data --name ES02 elasticsearch:6.8.5
    
     docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9202:9202 -p 9302:9302 -v /data/es/config/es3.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /data/es/data3:/usr/share/elasticsearch/data --name ES03 elasticsearch:6.8.5
    

    2. 문제 기록

  • bootstrap checks failed max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
  • vim /etc/sysctl.conf
    
    vm.max_map_count=262144 
    
    sysctl -p
    

    좋은 웹페이지 즐겨찾기