Elasticsearch + Elasticsearch-head搭建

Elasticsearch搭建:

[root@hdoop3 elk]# tar -xvf elasticsearch-6.2.4.tar

[root@hdoop3 elk]# cd elasticsearch-6.2.4

[root@hdoop3 elasticsearch-6.2.4]# mkdir es-data

[root@hdoop3 elk]# useradd elasticsearch

[root@hdoop3 elk]# passwd elasticsearch

[root@hdoop3 elk]# chown -R elasticsearch:elasticsearch elasticsearch-6.2.4

[root@hdoop3 config]# cd /home/software/elk/elasticsearch-6.2.4/config

[root@hdoop3 config]# cp elasticsearch.yml  elasticsearch.yml_install

[root@hdoop3 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

[root@hdoop3 config]# vim jvm.options 

-Xms4g       #更改jvm启动使用内存

-Xmx4g

[root@hdoop3 elk]# vim /etc/security/limits.conf

* soft nofile 65536

* hard nofile 65536

[root@localhost home]# vim /etc/sysctl.conf

vm.max_map_count=655360

[root@hdoop3 elasticsearch-6.2.4]# sysctl –p

此时要重新登录一下终端,要不然有的配置不会生效

[root@hdoop3 elasticsearch-6.2.4]# rm -rf /home/software/elk/elasticsearch-6.2.4/logs/*

#删除一下日志,然后切换用户启动,避免日志写入权限报错

[root@hdoop3 ~]# su – elasticsearch

[elasticsearch@hdoop3 ~]$ cd /home/software/elk/elasticsearch-6.2.4/

[elasticsearch@hdoop3 elasticsearch-6.2.4]$ bin/elasticsearch -d

Elasticsearch-head安装:

[root@hdoop3 elk]# wget https://nodejs.org/dist/v10.13.0/node-v10.13.0-linux-x64.tar.xz

[root@hdoop3 elk]# tar -xvf node-v10.13.0-linux-x64.tar.xz

[root@hdoop3 node-v10.13.0-linux-x64]# vim /etc/profile

#node

export PATH=$PATH:/home/software/elk/node-v10.13.0-linux-x64/bin

[root@hdoop3 node-v10.13.0-linux-x64]# source /etc/profile

[root@hdoop3 node-v10.13.0-linux-x64]# node -v

v10.13.0

[root@hdoop3 node-v10.13.0-linux-x64]# npm -v

6.4.1

Elasticsearch-head搭建:

[root@hdoop3 elasticsearch-6.2.4]# cd /home/software/elk/elasticsearch-6.2.4

[root@hdoop3 elasticsearch-6.2.4]# git clone git://github.com/mobz/elasticsearch-head.git

[root@hdoop3 elasticsearch-head]# npm install  

出现类似报错:

npm ERR! [email protected] install: `node install.js`

[root@hdoop3 elasticsearch-head]# npm cache clean --force

[root@hdoop3 elasticsearch-head]# npm -g install  [email protected] --ignore-script

[root@hdoop3 elasticsearch-head]# npm start &

猜你喜欢

转载自www.cnblogs.com/byfboke/p/9888876.html