ElasticSearch http-basic增加访问限制插件全过程(实操可用)

本过程针对集群环境中的 ElasticSearch 5.4.1版本,初始安装后是没有任何访问限制的,公司网络安全要求增加安全防护,所以增加安全插件,过程如下:
1.下载 elasticsearch6-http-basic-plugin.jar
[可参考下载地址:https://download.csdn.net/download/windtears/87764337 ]
在plugins 下建立 http-basic 目录,把文件放入目录。
在plugins目录下新建文件:plugin-descriptor.properties 内容如下:

classname=com.cleafy.elasticsearch6.plugins.http.HttpBasicServerPlugin
name=elasticsearch6-http-basic
description=Plugin to enable HTTP basic authentication and/or Ip based authentication
version=1.0.0
java.version=1.8
elasticsearch.version=5.4.1

(其中 elasticsearch.version 必须对应其使用的版本)
2.针对服务器修改环境要求
使用root用户登录,修改配置文件,命令:

vi /etc/security/limits.conf

添加下面内容

* soft nofile 65536
* hard nofile 131072
* soft nproc 4096
* hard nproc 4096

也可临时手动 ulimit -n 65536

vi /etc/security/limits.d/90-nproc.conf

将以下内容修改:

* soft nproc 4096

vi /etc/sysctl.conf

进入后修改一下内容:

vm.max_map_count=655360

修改后执行命令:

sysctl -p

3.在配制elasticsearch.yml文件中新增

http.basic.enabled: true
http.basic.log: false
http.basic.username: "elasticsearch"
http.basic.password: "!1q2w3e@"
http.basic.ipwhitelist: 132.xxx.43.192,xxx.xxx.xxx.xxx

(此处只支持IP,不要加中括号)

4.重启

service elasticsearch restart

su - elasticsearch -c "/usr/lib/elasticsearch/bin/elasticsearch -d" (前提是用户可登陆哈)
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值