elasticsearch_集群搭建
首先下载安装
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.8.0-linux-x86_64.tar.gz
tar -xzvf elasticsearch-7.8.0-linux-x86_64.tar.gz
cd elasticsearch-7.8.0
./bin/elasticsearch
上面的启动命令必须使用非ROOT 用户才可以运行,启动后只能本机使用 127.0.0.1 访问
修改ip地址访问
vim config/elasticsearch/yml
修改或添加这几个参数
network.host: 192.168.0.99
http.port: 9200
node.name: elasticsearch_001
cluster.initial_master_nodes: ["elasticsearch_001"]
保存后启动,可能会报错,分三种
1、max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
elasticsearch的最大文件描述符[4096]过低,至少增加到[65536]
2、max number of threads [3818] for user [es] is too low, increase to at least [4096]
用户的最大线程数[3818]太低,至少增加到[4096]
3、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/security/limits.conf 添加一下四个参数
# elasticsearch config start
#每个进程可以打开的文件数的限制 soft 为警告 查看为 ulimit -Su -Hu
* soft nofile 32768
* hard nofile 65536
#操作系统级别对每个用户创建的进程数的限制 查看为 ulimit -Sn -Hn
* soft nproc 2048
* hard nproc 4096
# elasticsearch config end
vi /etc/sysctl.conf 添加
# elasticsearch config start
vm.max_map_count=262144
# elasticsearch config end
添加以上配置后 重新登录用户 即可生效
待补充