• 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

  • 相关阅读:
    基于STM32设计的便携式温度自动记录仪
    第二十八章 管理许可(一)
    【Python零基础入门篇 · 34】:进程间的通信-Queue、进程池的构建
    tomcat 部署web项目
    项目管理:制定项目计划应该注意哪些问题?
    Win11透明任务栏失效怎么办
    MP157-2-TF-A移植:
    web3再牛 也没能逃出这几个老巨头的手掌心
    电动汽车高压电池包跌落试验验证
    .net core添加SQL日志输出
  • 原文地址:https://blog.csdn.net/Joseph25/article/details/127668523