Elasticsearch 5.0.0版本部署手册
Elasticsearch 5.0.0版本部署手册
1.Elasticsearch5.0.0版本不支持root用户启动,之前版本设置-Des.insecure.allow.root=true失效,必须修改es源码并且重新编译才能设置root启动【http://www.peecy.org/run-elasticsearch-5-as-root/】。
解决方案:
groupadd esearch
useradd esearch -g esearch -p elasticsearch
2.在非root用户下启动Elasticsearch5.0.0报错java.io.FileNotFoundException,日志文件Permission Denied
解决方案:
chown ${user} -R ${path} 使用chown命令将path路径下的es目录的用户组更改为user
3.[Warn] max file descriptors for elasticsearch 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
切换到非root用户
4.[Warn] max number of threads [1024] for user [esearch] 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
切换为非root用户
5.[Warn] max virtual memory areas vm.max_map_count [65530] likely to low,increase to at least [262144]
切换到root用户下,修改sysctl.conf
vi /etc/sysctl.conf
添加配置:vm.max_map_count=655360
执行命令:sysctl -p
重新启动elasticsearch
6.使用./elasticsearch命令或者./elasticsearch -d命令成功启动elasticsearch后,web浏览器访问http://IP:9200端口失败
修改./config/elasticsearch.yml配置文件
network.host: 192.168.76.89
重启elasticsearch即可
7.elasticsearch无法使用elasticsearch-plugin命令安装head插件,我们需要以standalone server的方式启动head插件
1.安装git命令:
yum -y install git
2.从github上下载elasticsearch-head的源码:
git clone git://github.com/mobz/elasticsearch-head.git
3.修改head目录权限
chmod -R 777 *
4.node的安装:head的本质是nodejs工程,因此需要安装node,使用npm来安装依赖的包(npm相当于maven)
yum -y install xz 安装xz命令
xz -d node*.tar.xz 解压nodejs安装包
tar -xvf node*.tar
vim /etc/profile
增加Node的环境变量
set node environment
export NODE_HOME=/usr/elk/node-v6.9.1-linux-x64
export PATH=$PATH:$NODE_HOME/bin
source /etc/profile
echo $NODE_HOME
node -v
npm -v
5.安装grunt:grunt是一个很方便的构建工具,可以进行打包压缩、测试、执行等工作,5.0的head插件就是通过grunt启动
到elasticsearch-head的目录下
npm install -g grunt-cli
检测grunt是否安装成功
grunt -version
6.修改head插件源码
vim /elasticsearch-head/Gruntfile.js
connect: { server: { options: { port: 9100, hostname: '*', base: '.', keepalive: true } } }
增加hostname属性,设置为*
vim /elasticsearch-head/_site/app.js
修改head的链接地址
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";
为
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://192.168.76.89:9200";
7.运行head
在head的根目录下,安装head依赖
npm install
启动nodejs
grunt server
8.安装head插件后,访问9100无法正常链接elasticsearch
在elasticsearch.yml中增加跨域支持,重启es和head插件
http.cors.enabled: true
http.cors.allow-origin: "*"
9.启动elasticsearch报错java.lang.IllegalStateException: failed to obtain node locks
删除elasticsearch/data目录下的nodes目录
10.logstash启动报错:Could not find or load main class org.jruby.Main
检查logstash的目录下是否存在Gemfile和Gemfile.jruby-1.9.lock文件
若无,重新下载logstash.zip文件
11.logstash配置文件
elasticsearch5.x版本不支持_ttl的设置,因此要去除logstash模板文件中的ttl属性
logstash中不支持worker的设定【TODO:其他代替设置】