ElasticSearch:集群安装及Head安装

一、因为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、启动

grunt server            启动
nohup grunt server &    后台启动

5、报错

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

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

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值