Elasticsearch6.5.1之head插件安装(初版)

安装NodeJS

yum -y install nodejs
执行node -v确认nodejs是否安装成功

修改ES配置

修改要监控的es配置文件$ES_INSTALL_PATH/config/elasticsearch.yml,新增跨域配置
http.cors.enabled: true #允许跨域
http.cors.allow-origin: "*"

安装grunt,修改head配置

下载head包,解压

cd ~/elasticsearch-head/
npm install -g grunt
npm install -g grunt-cli
vim ~/elasticsearch-head/Gruntfile.js,新增hostname:'',
connect: {
server: {
options: {
hostname:'
',
port: 9100,
base:'.',
keepalive:true
}
}
cd ~/elasticsearch-head/
npm install

启动head插件

cd ~/elasticsearch-head/node_modules/grunt/bin/ && nohup grunt server &
访问:http://ip:9100/

坑1:

npm WARN [email protected] license should be a valid SPDX license expression

解决:

spdx license,vim ~/elasticsearch-head/package.json,找到license位置,值修改为Apache-2.0

坑2:

java.io.FileNotFoundException: /root/elasticsearch-6.5.1/logs/elasticsearch_index_search_slowlog.log (权限不够)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.(FileOutputStream.java:213)
at java.io.FileOutputStream.(FileOutputStream.java:133)
at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
原因: 文件所有者不是当前用户

解决:

退回解压目录, 更改整个文件夹的所有者为当前用户
chown -R es:es elasticsearch-6.5.1

坑3:

ERROR: [2] bootstrap checks failed
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

解决:

su root, vim /etc/security/limits.conf

  •    hard    nofile           65536
    
  •    soft    nofile           65536
    

坑4:

ERROR: bootstrap checks failed
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
原因: 堆内存太低, 继续调大

解决:

vi /etc/sysctl.conf
vm.max_map_count=655360
sysctl -p

你可能感兴趣的:(Elasticsearch6.5.1之head插件安装(初版))