• docker 部署elasticsearch集群


    [root@centos7 ~]# docker images
    REPOSITORY                                      TAG                 IMAGE ID            CREATED             SIZE
    docker.elastic.co/elasticsearch/elasticsearch   5.6.3               865b21b970de        14 months ago       657MB
    elasticsearch                                   5.6.3               865b21b970de        14 months ago       657MB
    docker.elastic.co/elasticsearch/elasticsearch   5.6.2               59b11c02b218        14 months ago       657MB

    [root@centos7 es_docker]# cat es1.yml 
    cluster.name: "dali"
    node.name: node1
    node.master: true
    node.data: true
    xpack.security.enabled: false
    network.host: 0.0.0.0
    discovery.zen.minimum_master_nodes: 1
    discovery.zen.ping.unicast.hosts: ["172.17.0.2", "172.17.0.3"]
    [root@centos7 es_docker]# ls
    es1.yml  es2.yml
    [root@centos7 es_docker]# cat es2.yml 
    cluster.name: "dali"
    node.name: node2
    node.master: false
    node.data: true
    xpack.security.enabled: false
    network.host: 0.0.0.0
    discovery.zen.minimum_master_nodes: 1
    #discovery.zen.ping.unicast.hosts: es1
    discovery.zen.ping.unicast.hosts: ["172.17.0.2", "172.17.0.3"]

    docker run -d --name es1 -p 9200:9200 -p 9300:9300 -v /root/es_docker/es1.yml:/usr/share/elasticsearch/config/elasticsearch.yml elasticsearch:5.6.3
    docker run -d --name es2 -p 9201:9200 -p 9301:9300 -v /root/es_docker/es2.yml:/usr/share/elasticsearch/config/elasticsearch.yml elasticsearch:5.6.3

    [root@centos7 es_docker]# curl -XGET 'http://192.168.204.130:9200/_cluster/state/nodes?pretty'
    {
      "cluster_name" : "dali",
      "nodes" : {
        "JzKMNUXiRnS4RBJrwhn7fQ" : {
          "name" : "node1",
          "ephemeral_id" : "tbAY947pQVeNIJK1vSns1Q",
          "transport_address" : "172.17.0.2:9300",
          "attributes" : {
            "ml.max_open_jobs" : "10",
            "ml.enabled" : "true"
          }
        },
        "q3su9zqhR6q7CBAAeJYErA" : {
          "name" : "node2",
          "ephemeral_id" : "O90SzWzdQgegLgD2ghsZxQ",
          "transport_address" : "172.17.0.3:9300",
          "attributes" : {
            "ml.max_open_jobs" : "10",
            "ml.enabled" : "true"
          }
        }
      }
    }

    更改配置模拟容器不在一个server上

    [root@centos7 es_docker]# cat es1.yml 
    cluster.name: "dali"
    node.name: node1
    node.master: true
    node.data: true
    xpack.security.enabled: false
    network.host: 0.0.0.0
    discovery.zen.minimum_master_nodes: 1
    discovery.zen.ping.unicast.hosts: ["192.168.204.130:9300", "192.168.204.130:9301"]
    #discovery.zen.ping.unicast.hosts: ["172.17.0.2", "172.17.0.3"]
    #discovery.zen.ping.unicast.hosts: es1
    [root@centos7 es_docker]# cat es2.yml 
    cluster.name: "dali"
    node.name: node2
    node.master: false
    node.data: true
    xpack.security.enabled: false
    network.host: 0.0.0.0
    discovery.zen.minimum_master_nodes: 1
    #discovery.zen.ping.unicast.hosts: es1
    discovery.zen.ping.unicast.hosts: ["192.168.204.130:9300", "192.168.204.130:9301"]

    查看集群status

    [root@centos7 es_docker]# curl -XGET 'http://192.168.204.130:9200/_cluster/state/nodes?pretty'
    {
      "cluster_name" : "dali",
      "nodes" : {
        "JzKMNUXiRnS4RBJrwhn7fQ" : {
          "name" : "node1",
          "ephemeral_id" : "ChICyr0LQ36Vmpo5G4IB8w",
          "transport_address" : "172.17.0.2:9300",
          "attributes" : {
            "ml.max_open_jobs" : "10",
            "ml.enabled" : "true"
          }
        },
        "q3su9zqhR6q7CBAAeJYErA" : {
          "name" : "node2",
          "ephemeral_id" : "cEmXAm9cQ8SIPQZlJBKuug",
          "transport_address" : "172.17.0.3:9300",
          "attributes" : {
            "ml.max_open_jobs" : "10",
            "ml.enabled" : "true"
          }
        }
      }
    }

     https://github.com/togetu/kubernetes-elasticsearch-cluster 参考

  • 相关阅读:
    vue里面的v-for列表循环
    浅谈Vue.use
    js 限制输入框只能输入数字的问题
    vue computed的执行问题
    前端 html 篇
    函数声明 及 名称问题
    文件读写操作
    异常以及异常处理框架探析
    使用JDBC插入数据到ORACLE,使用标识列自增列
    session超时跃出iframe并跳到登陆页面(转载)
  • 原文地址:https://www.cnblogs.com/Honeycomb/p/10080431.html
Copyright © 2020-2023  润新知