linux elasticsearch6.4.3安装

2019-08-09 00:00:00 linux 安装 elasticsearch6

一.安装过程

去官方下载安装包

https://www.elastic.co/cn/downloads/elasticsearch
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.3.tar.gz
tar xf elasticsearch-6.4.3.tar.gz
cd elasticsearch-6.4.3
cd ..
chown -R elsearch:elsearch elasticsearch-6.4.3

如果产生此错误
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
es设置了保护机制,禁止使用root账号进行操作,切换用户

groupadd elsearch
useradd elsearch -g elsearch

su elsearch

 

如果是此错误,这个错误是因为centos6的内核不支持SecComp,所以我们需要禁止这个功能
java.lang.UnsupportedOperationException: seccomp unavailable: requires kernel 3.5+ with CONFIG_SECCOMP and CONFIG_SECCOMP_FILTER compiled in

vim elasticsearch.yml
bootstrap.system_call_filter: false

 《linux elasticsearch6.4.3安装》

 

./elasticsearch -d  后台启动

查看服务是否启动
netstat –ntlp 查看9200是否启动

 

二.安装过程中有可能出现的错误

问题1:ERROR: bootstrap checks failed

max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
max number of threads [1024] for user [lishang] likely too low, increase to at least [2048]
解决:切换到root用户,编辑limits.conf 添加类似如下内容
vi /etc/security/limits.conf 
添加如下内容:
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096

 问题2:max number of threads [1024] for user [lish] 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
 此处注意log日志中的错误,来决定数量 配置多少
问题3:max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
解决:切换到root用户修改配置sysctl.conf
vi /etc/sysctl.conf 
添加下面配置:
vm.max_map_count=655360
并执行命令:
sysctl -p
 
问题4:max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
解决:修改切换到root用户修改配置limits.conf 添加下面两行
命令:vi /etc/security/limits.conf
*        hard    nofile           65536
*        soft    nofile           65536
切换到es的用户。

java.lang.IllegalStateException: failed to obtain node locks, tried [[/usr/local/elasticsearch-6.4.3/data/elasticsearch]] with lock id [0]; maybe these locations are not writable or multiple nodes were started without increasing [node.max_local_storage_nodes] (was [1])?

使用ps –ef | grep elasticsearch 杀掉未关掉的进程

./elasticsearch -d 

 

三.安装head 插件
Head 地址:
https://github.com/mobz/elasticsearch-head
复制
wget https://github.com/mobz/elasticsearch-head/archive/master.zip
解压
或git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install -g
提示 -bash:  node: command not found。

1.sudo yum install epel-release
2.sudo yum install nodejs

npm run start(后台启动命令:nohup npm run start &)
open http://localhost:9100/

如果 报错

elasticsearch/config/elasticsearch.yml
http.cors.enabled: true
http.cors.allow-origin: “*”

 

四.安装IK分词法。
    
./elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.4.3/elasticsearch-analysis-ik-6.4.3.zip

相关文章