单节点安装
  1. 去官网“https://www.elastic.co/cn/downloads/”下载,例:elasticsearch-7.4.2-linux-x86_64.tar.gz
  2. 上传到centos服务器
  3. tar -zxvf elasticsearch-7.4.2-linux-x86_64.tar.gz解压文件,然后移动到本地的es文件夹, mv elasticsearch-7.4.2 /usr/local es-单节点环境搭建
  4. 进入es文件目录cd /usr/local/elasticsearch-7.4.2/,修改es配置文件vim /usr/local/elasticsearch-7.4.2/config/elasticsearch.yml
    1. 修改集群名称和节点名称,可选 es-单节点环境搭建
    2. 修改es数据文件和日志文件存放路径,data目录没有则需新建
      es-单节点环境搭建
    3. 修改IP设置 es-单节点环境搭建
    4. 修改es集群初始启动节点
      es-单节点环境搭建
  5. 创建es服务的用户,不能直接用root用户启动,否则会报错“ java.lang.RuntimeException: can not run elasticsearch as root”,useradd es && chown -R es:es /usr/local/elasticsearch-7.4.2 && su es && cd /usr/local/elasticsearch-7.4.2/bin && ./elasticsearch
  6. 启动时,可能报“max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]”、“ max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]”和“max number of threads [3756] for user [es] is too low”等三个错误,处理方案如下:
    1. vim /etc/security/limits.conf,添加“* soft nofile 65536 * hard nofile 131072 * soft nproc 2048 * hard nproc 4096”,如下图
      es-单节点环境搭建
    2. vim /etc/sysctl.conf,添加“vm.max_map_count=262145”,如下图,保存关闭后,刷新一下sysctl -p es-单节点环境搭建
  7. 再次重启es,可设置后台启动./elasticsearch -d,注意一定要切换到es用户,不能用root用户,启动成功,访问“http://192.168.126.118:9200/”,如下
    es-单节点环境搭建

相关文章:

  • 2022-12-23
  • 2022-01-07
  • 2021-06-26
  • 2021-08-23
  • 2021-08-18
  • 2022-12-23
  • 2021-05-14
  • 2022-01-01
猜你喜欢
  • 2021-07-01
  • 2021-04-29
  • 2021-10-30
  • 2022-01-11
  • 2022-12-23
  • 2021-12-22
  • 2021-05-16
相关资源
相似解决方案