elasticsearch常用接口和集群动态设置

欢迎关注鄙人公众号,技术干货随时看!
elasticsearch常用接口和集群动态设置_第1张图片

  1. 查看接口,返回的结果是目录,也就是可用的URL节点,自己把每个节点试一次就基本上明白其用处了
    http://10.202.250.91:9200/_cat/
/_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
  1. 集群节点查看接口,返回的是节点的配置信息
    http://10.201.207.77:9200/_nodes 获取集群所有节点的所有信息
    http://10.201.207.77:9200/_nodes/nodeId1,nodeId2 获取指定节点的信息
    http://10.201.207.77:9200/_nodes/thread_pool 获取集群所有节点的thread_pool信息
    http://10.201.207.77:9200/_nodes/10.201.207.77/thread_pool 获取集群指定节点的thread_pool信息,可以获取的信息包括settings, os, process, jvm, thread_pool, transport, http, plugins, ingest ,indices
{
_nodes: {
total: 7,
successful: 7,
failed: 0
},
cluster_name: "bd-platform",
nodes: {
1osjMBB3Q3KmOaQKMO2JCA: {
name: "10.201.207.74",
transport_address: "10.201.207.74:9300",
host: "10.201.207.74",
ip: "10.201.207.74",
version: "7.1.0",
build_flavor: "default",
build_type: "tar",
build_hash: "606a173",
total_indexing_buffer: 2138760806,
roles: [
"master",
"data",
"ingest"
],
attributes: {
ml.machine_memory: "52575121408",
ml.max_open_jobs: "20",
xpack.installed: "true"
},
settings: {
cluster: {
initial_master_nodes: [
"10.201.207.71",
"10.201.207.72",
"10.201.207.73"
],
name: "bd-platform"
  1. 集群状态接口,返回的是集群的状态,基本上都是见名知义
    http://10.201.207.77:9200/_cluster/state
    http://10.201.207.77:9200/_cluster/health
    http://10.201.207.77:9200/_cluster/stats
    http://10.201.207.77:9200/_cluster/settings?include_defaults=true
    http://10.201.207.77:9200/_cluster/settings
{
cluster_name: "bd-platform",
status: "green",
timed_out: false,
number_of_nodes: 7,
number_of_data_nodes: 7,
active_primary_shards: 13,
active_shards: 30,
relocating_shards: 0,
initializing_shards: 0,
unassigned_shards: 0,
delayed_unassigned_shards: 0,
number_of_pending_tasks: 0,
number_of_in_flight_fetch: 0,
task_max_waiting_in_queue_millis: 0,
active_shards_percent_as_number: 100
}
  1. 集群参数动态设置
    PUT http://10.202.250.92:9200/_cluster/settings persistent部分的设置,集群重启后依然有效;transient部分的设置,集群重启后将失效,可以动态设置的参数有很多,也很分散。
    {
    “persistent” : {
    “indices.recovery.max_bytes_per_sec” : “50mb”
    },
    “transient”:{}
    }

  2. max_compilations_per_minute参数设置(每分钟可编译的最大脚本数量)
    PUT /_cluster/settings
    {
    “transient”: {
    “script.max_compilations_per_minute”: 40
    }
    }

你可能感兴趣的:(elasticsearch)