linux centos7 elasticsearch固定ip访问
Posted 自行车在路上
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux centos7 elasticsearch固定ip访问相关的知识,希望对你有一定的参考价值。
接上一篇,linux centos7 安装好elasticsearch后,只能curl localhost:9200访问,如果用ip是访问不了,因此这篇解决这个问题
[root@localhost ~]# curl 192.168.100.130:9200
curl: (7) Failed connect to 192.168.100.130:9200; Connection refused
文章目录
改es的config的配置文件elasticsearch.yml
vim elasticsearch.yml
network.host: 192.168.100.130
http.port: 9200
启动
./elasticsearch
报错
ERROR: [3] bootstrap checks failed. You must address the points described in the following [3] lines before starting Elasticsearch.
bootstrap check failure [1] of [3]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
bootstrap check failure [2] of [3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
bootstrap check failure [3] of [3]: 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身份
vim /etc/security/limits.conf
最后添加内容,es为上一篇创建的用户名
es soft nofile 65536
es hard nofile 131072
es soft nproc 4096
es hard nproc 4096
继续配置
sysctl -w vm.max_map_count=262144
vim /etc/sysctl.conf
在文末添加
vm.max_map_count=262144
继续配置 在config文件夹里加
vim config/elasticsearch.yml
编辑文本
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
重启
继续报错
ERROR: [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
bootstrap check failure [1] of [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
继续更改config/elasticsearch.yml配置
#配置以下三者,最少其一
#[discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes]
cluster.initial_master_nodes: ["node-1"] #这里的node-1为node-name配置的值
重新启动,启动成功了
现在可以访问了
[root@localhost ~]# curl 192.168.100.130:9200
"name" : "localhost.localdomain",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "vndxxZbCSIO58HZw8K3P1Q",
"version" :
"number" : "7.16.3",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "4e6e4eab2297e949ec994e688dad46290d018022",
"build_date" : "2022-01-06T23:43:02.825887787Z",
"build_snapshot" : false,
"lucene_version" : "8.10.1",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
,
"tagline" : "You Know, for Search"
参考资料
Linux系统下安装 Elasticsearch 6.XX 外网无法访问的问题
[[1]: the default discovery settings are unsuitable for production use; at least one of discovery.se
以上是关于linux centos7 elasticsearch固定ip访问的主要内容,如果未能解决你的问题,请参考以下文章
elasticsear+kibana+logstash 优化
Spring Cloud 分布式链路跟踪 Sleuth + Zipkin + Elasticsear