创建索引:
curl –XPUT 'http://localhost:9200/blog' –d'{
"settings" : {
"number_of_shards" : 3,
"number_of_replicas" : 1
}
}'
curl –XPUT 'http://localhost:9200/blog/_mapping/article?pretty' -d'{
"properties":{
"id":{"type":"long"},
"name":{"type":"string"}
}
}'
删除索引:
curl –XDELETE 'http://localhost:9200/blog'
插入数据:
curl –XPUT 'http://localhost:9200/blog/article/1' -d '{
"id":123,
"name":"steve"
}'
查询数据:
curl –XGET 'http://localhost:9200/blog/article/1’
集群健康:curl -XGET'http://localhost:9200/_cluster/health'
集群分区:curl -s 'http://localhost:9200/_cat/shards'
curl -XDELETE 'http://localhost:9200/music/qingtingRadio/山东%23畅行952'
path.repo:["/export/servers/elasticsearch-2.4.2/backups/es_backup"]
创建快照仓库:
curl -XPUT 'http://localhost:9200/_snapshot/bakup' -d '{
"type":"fs",
"settings": {
"location": "/mnt/es/bakup",
"compress": true
}
}'
curl -XPUT 'http://localhost:9200/_snapshot/backup_hdfs' –d '{
"type":"hdfs",
"settings": {
"uri": "hdfs://node:8020/",
"path": "/elasticsearch/respositories/my_hdfs_repository",
"conf.dfs.client.read.shortcircuit": "true"
}
}'
快照仓库查询:
curl -XGET 'http://localhost:9200/_snapshot/es_backup?pretty'
curl -XGET 'http://localhost:9200/_snapshot'
curl -XGET 'http://localhost:9200/_snapshot/_all'
创建快照:
curl -XPUT 'http://localhost:9200/_snapshot/es_backup/snapshot_2017081815?wait_for_completion=true'
curl -XPUT 'http://localhost:9200/_snapshot/es_backup/snapshot_music_2017081815' -d '{
"indices": "indexName",
"ignore_unavailable": true,
"include_global_state": false,
"partial": false
}'
删除快照:
curl -XDELETE
' http://localhost:9200/_snapshot/es_backup/ snapshot
_xxx_2017081815'
查询快照信息:
curl -XGET
'http://localhost:9200/_snapshot/es_backup/snapshot_1
'
curl -XGET
'http://localhost:9200/_snapshot/es_backup/_all
'
恢复快照:
curl -XPOST
'http://localhost:9200/_snapshot/es_backup/snapshot
_xxx_2017081815/_restore
'
目录:/export/servers/elasticsearch-2.4.2/backups/bakData"