Elasticsearch7.2配置远程访问

一.解决环境问题

1.max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

修改/etc/security/limits.conf,增加配置,用户退出后重新登录生效

*               soft    nofile            655350
*               hard    nofile            655350

2、max number of threads [3818] for user [es] is too low, increase to at least [4096]

修改/etc/security/limits.conf,增加配置,用户退出后重新登录生效

*               hard    nproc           4096
*               soft    nproc           4096

3、max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]

修改/etc/sysctl.conf,增加如下配置

fs.file-max=655350

保存后执行sysctl -p 生效

4、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

保存后执行sysctl -p 生效

二.允许远程访问

vi conf/elasticsearch.yml
修改 network.host 为 0.0.0.0

network.host: 0.0.0.0

配置cluster.initial_master_nodes为当前node,默认为注释,放开注释就行了

cluster.initial_master_nodes: ["node-1", "node-2"]

三.测试远程访问

在浏览器中访问IP:9200,例如:http://192.168.20.181:9200/
当有如下信息则表示配置成功了

{
  "name" : "bridge",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "cevlLBOdTqa79CmXNvITAA",
  "version" : {
    "number" : "7.2.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "508c38a",
    "build_date" : "2019-06-20T15:54:18.811730Z",
    "build_snapshot" : false,
    "lucene_version" : "8.0.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

你可能感兴趣的:(服务器)