当前位置:首页 » JAVA技术教程

elasticsearch单机版集群配置

2018-08-09 17:01 本站整理 浏览(1)

1、首先确认自己的机器上配置jdk version:1.7 及以上
2、下载elasticsearch
    见附件中: version:5.5.0
    wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.0.zip
3、解压该zip包: unzip elasticsearch-5-5.0.zip
4、将解压后的文件复制三份,命名规则为:node-1,node-2,node-3
5、进入到node-1目录下的config文件:修改如下配置
   

     cluster.name: my-application
     node.name: node-1
     node.master: true
     node.attr.rack: r1

     path.data: /path/to/data
     path.logs: /path/to/logs
     
     network.host: 127.0.0.1
     transport.tcp.port: 9300
     discovery.zen.minimum_master_nodes: 1
     http.cors.enabled: true
     http.cors.allow-origin: "*"
    

    node-2
   
     cluster.name: my-application
     node.name: node-2
     node.master: false
     node.attr.rack: r1

     path.data: /path/to/data
     path.logs: /path/to/logs
     
     network.host: 127.0.0.1
     transport.tcp.port: 9301
     discovery.zen.minimum_master_nodes: 1
     discovery.zen.ping.unicast.hosts: ["127.0.0.1:9300"]
     http.cors.enabled: true
     http.cors.allow-origin: "*"
    

  
    node-3
   
     cluster.name: my-application
     node.name: node-3
     node.master: false
     node.attr.rack: r1

     path.data: /path/to/data
     path.logs: /path/to/logs
     
     network.host: 127.0.0.1
     transport.tcp.port: 9302
     discovery.zen.minimum_master_nodes: 1
     discovery.zen.ping.unicast.hosts: ["127.0.0.1:9300"]
     http.cors.enabled: true
     http.cors.allow-origin: "*"
    

  6、下载elasticsearch-head
     git clone git://github.com/mobz/elasticsearch-head.git
     cd elasticsearch-head
     npm install
 
     npm run start
     访问:http://localhost:9100
  7、启动三个elasticsearch实例:
     ./bin/elasticsearch
  8、刷新http://localhost:9100 配置完毕