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 elasticsearch-head@0.0.0 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.<init>(FileOutputStream.java:213)
at java.io.FileOutputStream.<init>(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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容