centos7 安装elasticsearch及elasticsearch-head

1.新增es用户并创建对应文件(/home/es data,logs等),修改/home/es的所有文件权限为es
2.visudo 新增 es ALL=(ALL) ALL

elasticearch下载地址https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.1

-linux-x86_64.tar.gz

问题一:ERROR: bootstrap checks failed

vi /etc/security/limits.conf

添加如下内容:

  • soft nproc 65536
  • hard nproc 65536
  • soft nofile 65536
  • hard nofile 65536

问题二: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

问题三:max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
最后并执行命令:
sysctl -p

3.上传elasticsearch安装包并修改配置文件
并在配置文件config/elasticsearch.yml末尾加上 (供elasticsearch-head访问使用)
http.cors.enabled: true
http.cors.allow-origin: “*”

后台启动elasticsearch /home/es/elasticsearch/bin/elasticsearch -d

4.打开网址查看es是否安装成功
http://localhost:9200/

5.安装elasticsearch-analysis-ik分词插件
/home/es/elasticsearch/bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.6.1/elasticsearch-analysis-ik-7.6.1.zip

6.安装elasticsearch-head https://www.jianshu.com/p/fdf90354e308

修改/home/es/elasticsearch-head/_site/app.js 内容中的localhost为当前服务器的ip地址,否则开启集群后显示未连接

后台启动elasticsearch-head nohup npm run start &

1.启动head:grunt server

2.查看head 进程:lsof -i :9100

3.停止head:kill -9 进程id

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注