Elasticsearch安装
Posted l_learning
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Elasticsearch安装相关的知识,希望对你有一定的参考价值。
下载Elasticsearch
官网下载地址 https://www.elastic.co/cn/downloads/elasticsearch
这里以CentOS7系统elasticsearch-7.14.0为例
点击版本号下载Linux-elasticsearch-7.14.0
安装Elasticsearch需java环境
使用非root用户,elasticsearch-7.14.0不能用root用户运行
安装
将elasticsearch-7.14.0-linux-x86_64.tar.gz压缩包上传至安装目录 /usr/local/elastic并解压
tar -zxvf elasticsearch-7.14.0-linux-x86_64.tar.gz
启动Elasticsearch
进入解压目录
cd /usr/local/elastic/elasticsearch-7.14.0
执行启动命令
./elasticsearch
检查 Elasticsearch 是否正在运行
http://127.0.0.1:9200/
出现如下内容则启动成功
{
"name" : "localhost.localdomain",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "v4nx6tQYQiOXvX3YygJ7Zg",
"version" : {
"number" : "7.14.0",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "dd5a0a2acaa2045ff9624f3729fc8a6f40835aa1",
"build_date" : "2021-07-29T20:49:32.864135063Z",
"build_snapshot" : false,
"lucene_version" : "8.9.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
ES配置网络节点
修改elasticsearch.yml
配置指定ip访问
network.host: 192.168.200.200
所有ip访问
network.host: 0.0.0.0
启动异常
修改network.host会有一个异常导致启动失败
[2021-08-20T01:54:43,959][INFO ][o.e.n.Node ] [localhost.localdomain] initialized
[2021-08-20T01:54:43,965][INFO ][o.e.n.Node ] [localhost.localdomain] starting ...
[2021-08-20T01:54:43,999][INFO ][o.e.x.s.c.f.PersistentCache] [localhost.localdomain] persistent cache index loaded
[2021-08-20T01:54:44,222][INFO ][o.e.t.TransportService ] [localhost.localdomain] publish_address {172.17.0.1:9300}, bound_addresses {[::]:9300}
[2021-08-20T01:54:45,012][INFO ][o.e.b.BootstrapChecks ] [localhost.localdomain] bound or publishing to a non-loopback address, enforcing bootstrap checks
[2021-08-20T01:54:45,046][ERROR][o.e.b.Bootstrap ] [localhost.localdomain] node validation exception
[4] bootstrap checks failed. You must address the points described in the following [4] lines before starting Elasticsearch.
bootstrap check failure [1] of [4]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
bootstrap check failure [2] of [4]: max number of threads [3795] for user [elastic] is too low, increase to at least [4096]
bootstrap check failure [3] of [4]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
bootstrap check failure [4] of [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
[2021-08-20T01:54:45,070][INFO ][o.e.n.Node ] [localhost.localdomain] stopping ...
[2021-08-20T01:54:45,113][INFO ][o.e.n.Node ] [localhost.localdomain] stopped
[2021-08-20T01:54:45,113][INFO ][o.e.n.Node ] [localhost.localdomain] closing ...
[2021-08-20T01:54:45,144][INFO ][o.e.n.Node ] [localhost.localdomain] closed
[2021-08-20T01:54:45,151][INFO ][o.e.x.m.p.NativeController] [localhost.localdomain] Native controller process has stopped - no new native processes can be started
异常一
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
在 /etc/security/limits.conf 文件末尾添加
* soft nofile 65535
* hard nofile 65535
异常二
max number of threads [3795] for user [elastic] is too low, increase to at least [4096]
在 /etc/security/limits.conf 文件末尾添加
* soft nproc 4096
* hard nproc 4096
异常三
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
在 /etc/sysctl.conf文件末尾添加
vm.max_map_count=262144
异常四
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
添加elasticsearch.yml配置
cluster.initial_master_nodes: ["node-1"]
改完这些重启Linux,启动Elasticsearch即可其他ip访问
以上是关于Elasticsearch安装的主要内容,如果未能解决你的问题,请参考以下文章
使用标准库Ruby将数据标记到Elasticsearch批量中
Elasticsearch:如何在 Elasticsearch 中正确使用同义词功能
Elasticsearch:如何在 Elasticsearch 中正确使用同义词功能
在Tomcat的安装目录下conf目录下的server.xml文件中增加一个xml代码片段,该代码片段中每个属性的含义与用途