Kibana数据可视化
1,3.1使用logstash导入数据的问题
会出现错误提示:
[location] is defined as an object in mapping [doc] but this name is already used for a field in other types
错误原因是创建的mapping为accident,但是默认覆盖的mapping默认为doc,与之前创建的不一样;
本机ELK版本为6.2.4;logstash对于处理过的数据不会重复处理,需要删除data文件夹里面的内容,之后重复导入;
处理办法,修改csv_to_es.conf,删除了其中的 type内容;
input { file { path => "/Users/stono/Downloads/LK5/Chapter3/source/accident*" start_position => "beginning" } }
修改template.json,mapping下面doc名称为doc;
{ "template" : "accident*", "mappings" : { "doc": { "properties": { "location": { "type": "geo_point" }, "involvedCount": { "type": "double" } } } } }
logstash启动之后不会自动退出,出现可以导入的文件,会自己进行导入;
2,4.1Elasticsearch快照恢复的问题
使用ES5.2.2进行快照恢复,
在ES5.2.2/config/elasticsearch.yml中配置:
http.port: 19200 transport.tcp.port: 19300
path.repo: ["/pathto/Chapter4/basic_logstash_repository"]
恢复快照命令:
PUT /_snapshot/basic_logstash_repository { "type":"fs", "settings":{ "location":"/Users/stono/Downloads/LK5/Chapter4/basic_logstash_repository", "compress": true } } GET _snapshot/basic_logstash_repository/_all POST /_snapshot/basic_logstash_repository/snapshot_201608031111/_restore GET /_snapshot/basic_logstash_repository/snapshot_201608031111/_status
然后在ES6.2.4内重建索引;
在ES6.2.4/config/elasticsearch.yml中增加
reindex.remote.whitelist: 'localhost:19200'
重建索引命令:
POST _reindex { "source":{ "remote": { "host": "http://localhost:19200" }, "index": "basic-logstash-2015" }, "dest": { "index": "basic-logstash-2015" } }
注意参考:http://doc.codingdict.com/elasticsearch/436/
进行快照的创建和删除,参考:https://www.jianshu.com/p/a757f77cf126
GET /_snapshot/ # 查询仓库
PUT /_snapshot/basic_logstash_repository/backup01?wait_for_completion=true # 创建快照
GET /_snapshot/basic_logstash_repository/_all # 获取快照信息
DELETE /_snapshot/basic_logstash_repository/backup01 # 删除快照