elastic 基础


原文链接: elastic 基础

查看集群状态

curl -u elastic:changeme '120.92.36.21:9200/_cat/nodes?v'
curl -u elastic:changeme '127.0.0.1:9200/_cat/nodes?v'

列出所有index

curl -u elastic:changeme '120.92.36.21:9200/_cat/indices?v'

curl -XPUT -u elastic:changeme '120.92.36.21:9200/_template/mysqlbeat -d@/etc/mysqlbeat/mysqlbeat.template.json'

  1. curl -u elastic:changeme '120.92.36.21:9200/_cat'

    /_cat/allocation
    /_cat/shards
    /_cat/shards/{index}
    /_cat/master
    /_cat/nodes
    /_cat/tasks
    /_cat/indices
    /_cat/indices/{index}
    /_cat/segments
    /_cat/segments/{index}
    /_cat/count
    /_cat/count/{index}
    /_cat/recovery
    /_cat/recovery/{index}
    /_cat/health
    /_cat/pending_tasks
    /_cat/aliases
    /_cat/aliases/{alias}
    /_cat/thread_pool
    /_cat/thread_pool/{thread_pools}
    /_cat/plugins
    /_cat/fielddata
    /_cat/fielddata/{fields}
    /_cat/nodeattrs
    /_cat/repositories
    /_cat/snapshots/{repository}
    /_cat/templates
    
  2. curl -u elastic:changeme '120.92.36.21:9200/_cat/?help'

  3. 通过h参数设置显示的header Headers
    GET /_cat/nodes?h=ip,port,heapPercent,name

elasticsearch.yml > path.repo: ["/etc/elasticsearch/backup"] << EOF

curl -XPUT 'http://120.92.36.21:9200/_snapshot/backup' -d '{
"type": "fs",
"settings": {

 "location": "/etc/elasticsearch/backup",
 "compress": true

}
}'

curl -XPUT http://120.92.36.21:9200/_snapshot/backup/snapshot_1?wait_for_completion=true

快照备份

curl -XPUT -u elastic:P@ssw0rd http://120.92.36.21:9200/_snapshot/backup/snapshot_`date +%Y.%m.%d?wait_for_completion=true && curl -XDELETE -u elastic:infra321 http://120.92.36.21:9200/access-date +%Y.%m.%d -d "-31 day" #curl -XDELETE http://120.92.36.21:9200/access-date +%Y.%m.%d -d "-1 day"`
#curator_cli --host 192.168.19.12 snapshot --repository backup

查看文档数量

curl -u elastic:changeme 120.92.36.21:9200/.kibana/_count?pretty

`