elasticSearch7.x linux安装手册
记录下linux安装最新elSearch7.5 遇到的坑
一 安装、解压、配置
安装、解压略。
配置:
elasticsearch.yml 文件:
看了很多博客,没有放开这个,但是我却遇到了因为这个而启动报错的错误:
ERROR: [1] bootstrap checks failed
[1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
修改配置文件中这行:
二 启动
不能使用root账户启动。linux设置新账户:
groupadd elsearch
useradd elsearch -g elsearch -p 123456
chown -R elsearch:elsearch elasticsearch7.5
su elsearch cd elasticsearch/bin
启动会遇到错误:
ERROR: [5] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2]: max number of threads [1024] for user [es] is too low, increase to at least [4096]
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[4]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
[1] 切换root用户
vim /etc/security/limits.conf
#添加如下内容
* soft nofile 65536
* hard nofile 131072
* soft nproc 4096
* hard nproc 4096
[2] 线程数不够
vim /etc/security/limits.d/90-nproc.conf
#修改一下内容
* soft nproc 1024
#改为
* soft nproc 4096
[3] 进程虚拟内存
vim /etc/sysctl.conf
#添加如下内容
vm.max_map_count=655360
wq!
#输入命令
sysctl -p
[4] 配置中解决
三 重启客户端
成功
验证:ip:9200
{
"name" : "jp-server0024",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "_na_",
"version" : {
"number" : "7.5.0",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "e9ccaed468e2fac2275a3761849cbee64b39519f",
"build_date" : "2019-11-26T01:06:52.518245Z",
"build_snapshot" : false,
"lucene_version" : "8.3.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
注意:
如果第一次不小心用root用户启动了elasticsearch,会失败,并且logs和data中生成的文件有些权限是root的,这时切换为dev用户启动还是会失败。
解决方法:直接删除data和logs文件夹,用dev用户再新建这两个文件夹,再用dev用户启动执行./elasticsearch命令
如果启动时遇到其他关于权限的错误,则检查相关文件(夹)的所有者,必须全部为dev,不能为root