1. 集群的状态查看
- 查看es各个节点的状态,包括负载和内存:
http://IP:9201/_cat/nodes?v - 查看es磁盘空间占用情况:
http://IP:9201/_cat/allocation?v - 查看健康状况
http://IP:9201/_cat/health?v
2. 索引的关闭和打开
- 查看所有索引
http://IP:9200/_cat/indices - 打开索引
http://IP:9200/{索引名称}/_open - 关闭索引
http://IP:9200/{索引名称}/_close
3. 索引设置查看
http://IP:9201/{索引名称}/_mappings
http://IP:9201/{索引名称}/_settings
4. 索引设置
PUT http://IP:9201/{索引名称}/_settings
{
"index": {
"routing": {
"allocation": {
"total_shards_per_node": "5",
"include": {
"_name": "node01,node02,node03,node04,node05"
}
}
}
}
}
PUT http://IP:9201/{索引名称}/_settings
{
"index": {
"refresh_interval": "120s"
}
}
PUT http://IP:9201/{索引名称}/_mappings
{
"properties": {
"ad_content": {
"type": "string",
"analyzer": "standard"
},
"ad_time": {
"type": "long"
},
"ad_id": {
"type": "string",
"index": "not_analyzed"
}
}
}
5. 移动分片到另外一个节点
POST _cluster/reroute
{
"commands" : [
{
"move" : {
"index" : "index_1", "shard" : 6,
"from_node" : "node01", "to_node" : "node06"
}
}
]
}
6. 分配分片
POST _cluster/reroute
{
"commands" : [
{
"allocate" : {
"index" : "index_1", "shard" : 10, "node" : "node08"
}
}
]
}
7. 别名删除和新增
POST http://IP:9200/_aliases
{
"actions": [
{
"remove": {
"index": "index_v1",
"alias": "index_v1_alias"
}
},
{
"add": {
"index": "index_v1_day_1",
"alias": "index_v1_day_aiase"
}
}
]
}