php请求elk接口,ELK接口调用

一、查询

1、查看ES集群健康值

curl http://:9200/_cluster/health?pretty

2、查看每个索引的状态

curl -XGET "http://:9200/_cat/indices?v"

3、查看某个索引的status

curl -s http://:9200/_cat/indices/IndexName?h=status

4、查看状态red的索引

curl -XGET http://:9200/_cat/indices |awk '$1 ~/red/'

5、查询索引库的settings信息

curl -XGET http://:9200//settings?pretty?pretty=true

6、查询索引别名

查询所有别名信息:

curl -XGET http://:9200/_cat/aliases?v

查询某个索引下的别名信息:

curl -XGET http://:9200//_alias/*

7、查看用户信息

curl -XGET http://:9200/_xpack/security/role_mapping/

二、修改

1、关闭不需要的索引,减少内存占用

curl -XPOST "http://:9200//_close"

2、操作索引

操作不存在索引:

curl -XPUT 'http://:9200//' -d'{"settings":{"number_of_shards":3,"number_of_replicas":0}}'

操作已存在索引:

curl -XPUT 'http://:9200//_settings' -d '{"index":{"number_of_replicas":1}}'

总结:就是,不存在索引时,可以指定副本和分片,如果已经存在,则只能修改副本。

3、操作索引别名

POST /_aliases

{

"actions" : [

{ "remove" : { "index" : "test1", "alias" : "alias1" } },

{ "add" : { "index" : "test2", "alias" : "alias1" } }

]

}

4、添加用户权限组

curl -XPUT 'http://:9200/_xpack/security/role_mapping/' -d

'{

"enabled" : true,

"roles" : [

"ops.test",

"ops.eic.test.group"

],

"rules" : {

"any" : [

{

"field" : {

"username" : ""

}

}

]

},

"metadata" : {

"username" : ""

}

}'

5、取消索引只读

curl -XPUT 'http://:9200/_all/_settings' -d '{"index.blocks.read_only_allow_delete": null}'

三、删除

1、删除索引数据:

curl -XDELETE 'http://:9200/jr-2018.08.06'

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值