1.查看单个节点信息
curl http://127.0.0.1:9200
2.查看集群信息
curl http://127.0.0.1:9200/_cat/nodes?v
3.查看单节点索引信息
curl -X GET '127.0.0.1:9200/_cat/indices?v'
4.查看集群健康检查
curl -XGET 'http://127.0.0.1:9200/_cluster/health?pretty=true'
5.处理index read-only/ allow delete
curl -XPUT -H "Content-Type: application/json" http://127.0.0.1:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'
6.kibana 自动创建索引配置
curl -f -XPOST -H 'Content-Type: application/json' -H 'kbn-xsrf: anything' \
"http://127.0.0.1:5601/api/saved_objects/index-pattern/logname-{$date}" -d"{\"attributes\":{\"title\":\"logname*\",\"timeFieldName\":\"@timestamp\"}}"
7.批量调整索引yellow,设置副本集为0
curl -XPUT "http://localhost:9200/_settings" -H 'Content-Type: application/json' -d'
{
"index" : {
"number_of_replicas" : 0
}
}'
8.恢复副本集为1
curl -XPUT "http://localhost:9200/_settings" -H 'Content-Type: application/json' -d'
{
"index" : {
"number_of_replicas" : 1
}
}'
9.kibana 创建索引,$index 为需要创建的索引
curl -f -XPOST -H 'Content-Type: application/json' -H 'kbn-xsrf: anything' "http://127.0.0.1:5601/api/saved_objects/index-pattern/$index-{$date}" -d"{\"attributes\":{\"title\":\"$index*\",\"timeFieldName\":\"@timestamp\"}}"
10. kibana 批量创建索引
file=demo.txt
#获取索引文件行数
num=`wc -l ${file} | awk '{print $1}'`
echo $num
#开始循环创建索引
for((i=1;i<=${num};i++));
do
echo "for循环--$i"
index=`sed -n "${i}p" $file | awk '{print $1}'`
echo "索引名称: "$index
curl -f -XPOST -H 'Content-Type: application/json' -H 'kbn-xsrf: anything' \
"http://127.0.0.1:5601/api/saved_objects/index-pattern/${index}-{$date}" -d"{\"attributes\":{\"title\":\"${index}*\",\"timeFieldName\":\"@timestamp\"}}"
done