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

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值