Centos6.5下Elasticsearch5.2.1及head插件的安装(实践成功)

来源:互联网 发布:xp系统网络连接受限制 编辑:程序博客网 时间:2024/05/29 12:00
1、注意
(1)JDK版本必须为1.8以上

1、以非root用户下载解压elasticsearch
(0)不能为root用户,否则启动会报错
(1)下载(也可通过scp)
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.2.1.zip
(2)解压
unzip 

2、修改Jvm最小内存大小
修改config/jvm.options


3、修改监听地址(解除只有本机访问限制)
修改config/elasticsearch.yml


4、可能无法启动报错
(1)错误:ERROR: bootstrap checks failed system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
原因:是在因为Centos6不支持SecComp,而ES5.2.0默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。
解决:在config/elasticsearch.yml  最后配置bootstrap.system_call_filter为false,
bootstrap.system_call_filter: false
(2)错误:max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
原因:
解决:
切换到root用户,编辑limits.conf 添加类似如下内容
vi /etc/security/limits.conf
添加如下内容:
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
(3)错误:max number of threads [1024] for user [lish] likely too low, increase to at least [2048]
原因:
解决:
切换到root用户,进入limits.d目录下修改配置文件。
vi /etc/security/limits.d/90-nproc.conf
修改如下内容:
* soft nproc 1024
#修改为
* soft nproc 2048
(4)错误:max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
原因:
解决:
切换到root用户修改配置sysctl.conf
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
并执行命令:
sysctl -p
然后,重新启动elasticsearch,即可启动成功。

5、启动
进入目录:cd /opt/elasticsearch/elasticsearch-5.2.1/bin
前台启动:./elasticsearch
后台启动:nohup ./elasticsearch &
                 ./elasticsearch -d


6、head 插件安装
(1)安装git插件
yum -y install git

(2)安装node.js 及 npm
(一)下载及解压
cd /usr/local/node                --如有没有就自行创建
wget http://cdn.npm.taobao.org/dist/node/latest-v4.x/node-v4.4.3-linux-x86.tar.gz     --使用的淘宝的npm镜像
tar zxvf node-v4.4.3-linux-x86.tar.gz
(二)设置环境变量
vim /etc/profile
在文件最后添加
export NODE_HOME=/usr/local/node/node-v4.4.3-linux-x86
export PATH=$NODE_HOME/bin:$PATH

编译使配置立即生效
source /etc/profile
(三)验证是否安装成功
node -v
npm -v
--如果只想node -v报错如下:

解决办法:在 http://rpmfind.net/linux/rpm2html/search.php?query=libgcc_s.so.1&submit=Search+...&system=centos&arch=
找到库 libstdc++.so.6
libstdc++-4.4.7-17.el6.i686.rpm
libgcc-4.4.7-17.el6.i686.rpm
安装  rpm -ivh libstdc++-4.4.7-17.el6.i686.rpm 然后再安装  rpm -ivh libgcc-4.4.7-17.el6.i686.rpm
输出版本号则表示安装成功


(2)安装head 插件
(一)
git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install

在elasticsearch-head目录下node_modules/grunt下如果没有grunt二进制程序,需要执行
cd elasticsearch-head
npm install grunt --save     

(二)修改head配置
vim /opt/elasticsearch/elasticsearch-head/Gruntfile.js
添加hostname字段,如下


(四)启动
进入目录 cd /opt/elasticsearch/elasticsearch-head/node_modules/grunt/bin
前台启动:./grunt server
后台启动:nohup ./grunt server &
(五)访问
http://192.168.10.120:9100/





0 0
原创粉丝点击