Elasticsearch 服务启动与集群运维
elasticsearch 是分布式搜索与分析引擎,提供 REST API。它负责索引、分片、副本和集群状态;客户端通常用 curl、Kibana 或语言 SDK。
elasticsearch
curl -s http://127.0.0.1:9200/
curl -s http://127.0.0.1:9200/_cluster/health?pretty
curl -s http://127.0.0.1:9200/_cat/nodes?v
curl -s http://127.0.0.1:9200/_cat/indices?v
curl -s http://127.0.0.1:9200/_cat/shards?v
curl -X PUT http://127.0.0.1:9200/app -H 'Content-Type: application/json' \
-d '{"settings":{"number_of_shards":3,"number_of_replicas":1}}'
curl -s 'http://127.0.0.1:9200/_cluster/allocation/explain?pretty'
cluster.name: app-search
node.name: es-1
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
discovery.seed_hosts: ["es-1", "es-2", "es-3"]
cluster.initial_master_nodes: ["es-1", "es-2", "es-3"]
network.host 默认只监听本地;远程访问要改配置并配防火墙。_cluster/health 和节点日志,不要盲目重启全部节点。opensearch — 兼容分支kibana — 可视化logstash / filebeat — 数据写入合上页面,先回答,再展开对照。
_cluster/health、_cat/shards 和 _cluster/allocation/explain 定位原因,不要盲目重启全部节点。