步骤一:部署插件
插件装在哪一台机器上,只能在哪台机器上使用(这里安装在se5机器上面)
1)使用远程 uri 路径可以直接安装
[root@se5 ~]# cd /usr/share/elasticsearch/bin
[root@se5 bin]# ./plugin install \
ftp://192.168.1.254/elk/elasticsearch-head-master.zip //安装head插件
[root@se5 bin]# ./plugin install \
ftp://192.168.1.254/elk/elasticsearch-kopf-master.zip //安装kopf插件
[root@se5 bin]# [root@se5 bin]# ./plugin install \
ftp://192.168.1.254/elk/bigdesk-master.zip
//安装bigdesk插件
[root@se5 bin]# ./plugin list //查看安装的插件
Installed plugins in /usr/share/elasticsearch/plugins:
- head
- kopf
- bigdesk
2)访问head插件
[root@room9pc01 ~]# firefox http://192.168.1.65:9200/_plugin/head
3)访问kopf插件
[root@room9pc01 ~]# http://192.168.1.65:9200/_plugin/kopf
4)访问bigdesk插件
[root@room9pc01 ~]# http://192.168.1.65:9200/_plugin/bigdesk
步骤二:使用head创建index
[root@se5 bin]# curl -X PUT "http://192.168.1.65:9200/index" -d '
> {
> "settings":{
> "index":{
> "number_of_shards":5, //分片数
> "number_of_replicas":1 //副本数
> }
> }
> }'
{"acknowledged":true}
步骤三:使用kopf查看数据
插入,增加,删除查询数据
步骤一:增加数据
[root@se5 ~]# locale
[root@se5 ~]# LANG=en_US.UTF-8 //设置编码
[root@se5 ~]# curl -X PUT "http://192.168.1.65:9200/taindex/teacher/1" -d '{
"职业":"诗人",
"名字":"李白",
"称号":"诗仙",
"年代":"唐"
}'
{"_index":"taindex","_type":"teacher","_id":"1","_version":2,"_shards": {"total":2,"successful":2,"failed":0},"created":false}
步骤二:修改数据
[root@se5 ~]# curl -X PUT "http://192.168.1.65:9200/taindex/teacher/1" -d '{
"doc":{
"年代": "唐代"
}
}'
{"_index":"taindex","_type":"teacher","_id":"1","_version":3,"_shards":{"total":2,"successful":2,"failed":0},"created":false}
步骤三:查询数据
[root@se5 ~]# curl -X GET "http://192.168.1.65:9200/taindex/teacher/3?pretty"
步骤四:删除数据
[root@se5 ~]# curl -X DELETE "http://192.168.1.65:9200/taindex/teacher/3?pretty"
步骤五:删除索引
[root@se5 bin]# curl -X DELETE http://192.168.1.65:9200/taindex/ //删除索引
[root@se5 bin]# curl -X DELETE http://192.168.1.65:9200/* //删除所有索引