Elasticsearch + Elasticsearch-head搭建
Posted byfboke
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Elasticsearch + Elasticsearch-head搭建相关的知识,希望对你有一定的参考价值。
Elasticsearch搭建:
[[email protected] elk]# tar -xvf elasticsearch-6.2.4.tar
[[email protected] elk]# cd elasticsearch-6.2.4
[[email protected] elasticsearch-6.2.4]# mkdir es-data
[[email protected] elk]# useradd elasticsearch
[[email protected] elk]# passwd elasticsearch
[[email protected] elk]# chown -R elasticsearch:elasticsearch elasticsearch-6.2.4
[[email protected] config]# cd /home/software/elk/elasticsearch-6.2.4/config
[[email protected] config]# cp elasticsearch.yml elasticsearch.yml_install
[[email protected] config]# vim elasticsearch.yml
cluster.name: the-test #集群名称
node.attr.rack: elk-1 #节点名称
path.data: /home/elk/elasticsearch-6.2.4/es-data #data存放的路径
path.logs: /home/elk/elasticsearch-6.2.4/logs #logs存放的路径
network.host: 0.0.0.0 #监听的网络地址
http.port: 9200 #开启监听的端口
http.cors.enabled: true #增加新的参数,这样head插件可以访问es
http.cors.allow-origin: "*" #增加新的参数,这样head插件可以访问es
bootstrap.memory_lock: false #配置内存使用用交换分区
bootstrap.system_call_filter: false
[[email protected] config]# vim jvm.options
-Xms4g #更改jvm启动使用内存
-Xmx4g
[[email protected] elk]# vim /etc/security/limits.conf
* soft nofile 65536
* hard nofile 65536
[[email protected] home]# vim /etc/sysctl.conf
vm.max_map_count=655360
[[email protected] elasticsearch-6.2.4]# sysctl –p
此时要重新登录一下终端,要不然有的配置不会生效
[[email protected] elasticsearch-6.2.4]# rm -rf /home/software/elk/elasticsearch-6.2.4/logs/*
#删除一下日志,然后切换用户启动,避免日志写入权限报错
[[email protected] ~]# su – elasticsearch
[[email protected] ~]$ cd /home/software/elk/elasticsearch-6.2.4/
[[email protected] elasticsearch-6.2.4]$ bin/elasticsearch -d
Elasticsearch-head安装:
[[email protected] elk]# wget https://nodejs.org/dist/v10.13.0/node-v10.13.0-linux-x64.tar.xz
[[email protected] elk]# tar -xvf node-v10.13.0-linux-x64.tar.xz
[[email protected] node-v10.13.0-linux-x64]# vim /etc/profile
#node
export PATH=$PATH:/home/software/elk/node-v10.13.0-linux-x64/bin
[[email protected] node-v10.13.0-linux-x64]# source /etc/profile
[[email protected] node-v10.13.0-linux-x64]# node -v
v10.13.0
[[email protected] node-v10.13.0-linux-x64]# npm -v
6.4.1
Elasticsearch-head搭建:
[[email protected] elasticsearch-6.2.4]# cd /home/software/elk/elasticsearch-6.2.4
[[email protected] elasticsearch-6.2.4]# git clone git://github.com/mobz/elasticsearch-head.git
[[email protected] elasticsearch-head]# npm install
出现类似报错:
npm ERR! [email protected] install: `node install.js`
[[email protected] elasticsearch-head]# npm cache clean --force
[[email protected] elasticsearch-head]# npm -g install [email protected] --ignore-script
[[email protected] elasticsearch-head]# npm start &
以上是关于Elasticsearch + Elasticsearch-head搭建的主要内容,如果未能解决你的问题,请参考以下文章