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访问

  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值