elasticsearch集群搭建

    elasticsearch集群搭建

    10.1.1.10 node.master: true node.data: true

    10.1.1.11 node.master: false node.data: true

    10.1.1.12 node.master: false node.data: true

    安装elasticsearch

    1. wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/8u202-b08/1961070e4c9b4e26a04e7f5a083f551e/jdk-8u202-linux-x64.rpm
    2. rpm -ivh jdk-8u202-linux-x64.rpm #安装jdk
    3. useradd es #新增es用户

    下载elasticsearch https://www.elastic.co/cn/downloads/past-releases/elasticsearch-5-6-4 并解压,如:/usr/local/elasticsearch-5.6.4

    修改配置文件

    10.1.1.10 elasticsearch.yml

    1. cluster.name: search_cluster
    2. node.name: node-1-10
    3. node.master: true
    4. node.data: true
    5. network.host: 0.0.0.0
    6. discovery.zen.ping.unicast.hosts: ["10.1.1.10","10.1.1.11","10.1.1.12"]
    7. http.port: 9200
    8. http.cors.enabled: true
    9. http.cors.allow-origin: "*"

    10.1.1.11 elasticsearch.yml

    1. cluster.name: search_cluster
    2. node.name: node-1-11
    3. node.master: false
    4. node.data: true
    5. network.host: 0.0.0.0
    6. discovery.zen.ping.unicast.hosts: ["10.1.1.10","10.1.1.11","10.1.1.12"]
    7. http.port: 9200

    10.1.1.12 elasticsearch.yml

    1. cluster.name: search_cluster
    2. node.name: node-1-12
    3. node.master: false
    4. node.data: true
    5. network.host: 0.0.0.0
    6. discovery.zen.ping.unicast.hosts: ["10.1.1.10","10.1.1.11","10.1.1.12"]
    7. http.port: 9200

    启动关闭elasticsearch

    3个节点依次启动

    1. su - es
    2. /usr/local/elasticsearch-5.6.4/bin/elasticsearch -d

    关闭elasticsearch:

    1. kill -SIGTERM PID

    安装elasticsearch-head

    安装nodejs,参考:https://linuxeye.com/435.html

    安装elasticsearch-head,如下:

    1. cd /usr/local
    2. git clone https://github.com/mobz/elasticsearch-head.git
    3. chown -R es.es elasticsearch-head
    4. cd elasticsearch-head
    5. su - es
    6. npm install

    vim _site/app.js

    localhost:9200改成10.1.1.10:9200

    vim Gruntfile.js

    9100更改为9102

    1. connect: {
    2.         server: {
    3.                 options: {
    4.                         port: 9102,
    5.                         base: '.',
    6.                         keepalive: true
    7.                 }
    8.         }
    9. }

    启动elasticsearch-head

    1. nohup npm start &

    Mon Feb 25 17:01:21 CST 2019

    • 本文由 发表于 2019-02-25
    • 转载请务必保留本文链接:https://linuxeye.com/469.html
    Consul集群配置 Linux

    Consul集群配置

    consul原理 上图是官网提供的一个事例系统图,图中的Server是consul服务端高可用集群,Client是consul客户端。consul客户端不保存数据,客户端将接收到的请求转发给响应的Se...
    匿名

    发表评论

    匿名网友