ElasticSearch是一个分布式,高性能、高可用、可伸缩的搜索和分析系统

         Elastic Stack,前身缩写是ELK,就是ElasticSearch + LogStash + Kibana

         执行结果如下:

         这个错误,是因为使用root用户启动elasticsearch,elasticsearch是不允许使用root用户启动的
         解决方案如下:

  1. groupadd liulong
  2. useradd liulong -g liulong
  3. cd /opt [elasticsearch-7.3.2所在路径]
  4. chown -R liulong:liulong elasticsearch-7.3.2

vim config/jvm.options

  1. -Xms512m
  2. -Xmx512m

vim config/elasticsearch.yml

  1. cluster.name=liulong
  2. node.name=node-1
  3. network.host: 192.168.204.209
  4. http.port: 9200
  5. cluster.initial_master_nodes: ["node-1"]
此时,进入bin目录下执行./elasticsearch还会报错

max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
vm最大虚拟内存,max_map_count[65530]太低,至少增加到[262144]

vim /etc/sysctl.conf

  1. vm.max_map_count=655360
  2. sysctl -p 使配置生效
descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
最大文件描述符[4096]对于elasticsearch进程可能太低,至少增加到[65536]

vim /etc/security/limits.conf

  1. * soft nofile 65536
  2. * hard nofile 131072
  3. * soft nproc 2048
  4. * hard nproc 4096
  5. * 所有用户
  6. nofile - 打开文件的最大数目
  7. noproc - 进程的最大数目
  8. soft 指的是当前系统生效的设置值
  9. hard 表明系统中所能设定的最大值
max number of threads [2048] for user [tongtech] is too low, increase to at least [4096]
用户的最大线程数[2048]过低,增加到至少[4096]

vim /etc/security/limits.d/90-nproc.conf

  1. * soft nproc 4096
  1. su liulong
  2. cd /opt/elasticsearch-7.3.2/bin
  3. ./elasticsearch ./elasticsearch -d (以后台方式运行)
注意:注意开放端口或者关闭防火墙(centos7)

         1. 查询防火墙状态:firewall-cmd –state
         2. 关闭防火墙:systemctl stop firewalld.service
         3. 开启防火墙: systemctl start firewalld.service
         4. 禁止firewall开机启动:systemctl disable firewalld.service

启动成功:

版权声明:本文为liulong99原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/liulong99/p/liulong99.html