• ElasticSearch:集群安装


    一、因为elasticsearch不能用root启动,因此需要新建子用户

            useradd elasticsearch

    二、集群介绍

            node01:192.168.8.111

            node02:192.168.8.112

            node03:192.168.8.113

    三、安装

            1、官网下载软件Past Releases of Elastic Stack Software | Elastic

            2、tar -zxvf elasticsearch-6.0.1.tar.gz

            3、mv elasticsearch-6.0.1 elasticsearch

            4、vim elasticsearch/config/elasticsearch.yml

                    network.host: node01

                    cluster.name: cluster

                    node.name: node01

                    node.master: true

                    path.data: /opt/elasticsearch/data/elasticsearch

                    path.logs: /opt/elasticsearch/logs/elasticsearch

                    discovery.zen.ping.unicast.hosts: ["node01","node02","node03"]  #不同机器组成集群

                    

                    network.host: node02

                    cluster.name: cluster

                    node.name: node02

                    node.master: true

                    path.data: /opt/elasticsearch/data/elasticsearch

                    path.logs: /opt/elasticsearch/logs/elasticsearch

                    discovery.zen.ping.unicast.hosts: ["node01","node02","node03"]  #不同机器组成集群

                    network.host: node03

                    cluster.name: cluster

                    node.name: node03

                    node.master: true

                    path.data: /opt/elasticsearch/data/elasticsearch

                    path.logs: /opt/elasticsearch/logs/elasticsearch

                    discovery.zen.ping.unicast.hosts: ["node01","node02","node03"]  #不同机器组成集群

            5、将用户全部及用户组转换到elasticsearch下

                    chown -R elasticsearch:elasticsearch /opt/elasticsearch

            6、启动

                    elasticsearch]$ bin/elasticsearch ---->前台启动

                    elasticsearch]$ bin/elasticsearch -d ---->后台启动

    四、问题合集

            ①max number of threads [3818] for user [es] is too low, increase to at least [4096]

                    意思是elasticsearch最大线程数目太低

                    修改 /etc/security/limits.conf
                    在文件末尾增加以下两行:

                    *  soft nproc  4096
                    *  hard nproc  4096

            ②max file descriptors [4096] for es process is too low, increase to at least   [65536]     

                    修改 /etc/security/limits.conf

                    *                soft    nofile          65536
                    *                hard    nofile          65536

            ③如果包jvm线程太低,有关max_map_count需调至262144

                    sudo vim /etc/sysctl.conf
     
                     ## 更新或者插入文件内容(有就更新,无则新增)
                     vm.max_map_count = 262144
     
                     ## 刷新生效
                     sudo sysctl -p

    五、Head安装

    head在elasticsearch6.x版本后成独立的web系统,所以之前老版本的plagin安装方式不适合

    1、安装nodejs

            wget --no-check-certificate  https://nodejs.org/dist/v9.9.0/node-v9.9.0-linux-x64.tar.gz
            tar -zxvf node-v9.9.0-linux-x64.tar.gz
            mv node-v9.9.0-linux-x64 /opt/node

            vim /etc/profile.d/bigdata-etc.sh
            export NODE_HOME=/opt/node
            export PATH=$PATH:$NODE_HOME/bin
            source /etc/profile.d/bigdata-etc.sh

    2、elasticsearch.yml(支持跨域访问)

            vim elasticsearch.yml添加
            http.cors.enabled: true
            http.cors.allow-origin: "*"

    3、安装head

            https://gitcode.net/mirrors/mobz/elasticsearch-head?utm_source=csdn_github_accelerator

            # 如无unzip 自行安装(yum install -y unzip)
            unzip elasticsearch-head-master.zip

            cd elasticsearch-head-master
            npm install -g grunt-cli
            npm install grunt --save-dev
            grunt -version

            vim Gruntfile.js
            connect => server => options 添加 hostname: '本机ip/node01'

    4、启动

    1. grunt server 启动
    2. nohup grunt server & 后台启动

    5、报错

    1. [root@node01 elasticsearch-head-master]# grunt server
    2. >> Local Npm module "grunt-contrib-clean" not found. Is it installed?
    3. >> Local Npm module "grunt-contrib-concat" not found. Is it installed?
    4. >> Local Npm module "grunt-contrib-watch" not found. Is it installed?
    5. >> Local Npm module "grunt-contrib-connect" not found. Is it installed?
    6. >> Local Npm module "grunt-contrib-copy" not found. Is it installed?
    7. >> Local Npm module "grunt-contrib-jasmine" not found. Is it installed?
    8. Warning: Task "connect:server" not found. Use --force to continue.

    依次npm install grunt-contrib-clean .......

    6、安装后重新启动,连接http://node01:9100

  • 相关阅读:
    Spring面试题15:Spring支持几种bean的作用域?singleton、prototype、request的区别是什么?
    【Paddle】稀疏计算的使用指南 & 稀疏ResNet的学习心得 (2) + Paddle3D应用实例稀疏 ResNet代码解读 (1.6w字超详细)
    【java8】Stream底层原理解析
    聚合支付的特点与应用建议
    VT-VSPA1-508-1X/V0替代型模拟放大器
    lwip_网卡
    【待解决】Not a Prefab scene
    javaEE -10(11000字详解5层重要协议)
    牛客网专项练习30天Pytnon篇第16天
    java计算机毕业设计VUE技术小区车辆档案车位管理系统设计与实现源码+mysql数据库+系统+lw文档+部署
  • 原文地址:https://blog.csdn.net/Joseph25/article/details/127668523