下面我具体描述一下我遇到的问题。
在kibana上面创建索引点击创建时,一直显示下面的页面
就看到不停的在那转,始终创建不成功。
查看后台日志,看到状态码为403,报了如下的错误
由于我用的是es6版本,所以怀疑是.kibana没有写入权限
我尝试修改index.blocks.write
执行:
PUT .kibana/_settings
{
"index.blocks.write": true
}
发现报了错:
然后我开放了kibana关于elasticsearch的索引权限
执行成功:
然后,再次尝试修改index.blocks.write
执行:
PUT .kibana/_settings
{
"index.blocks.write": true
}
执行成功:
但最后发现还是这样
着实搞得我头大,最后终于在官网上找到了解决方法,具体参照下面这篇文章
https://www.elastic.co/guide/en/kibana/6.0/migrating-6.0-index.html
一共分为四步:
第一步:设置.kibana的index.blocks.write属性为true
PUT .kibana/_settings
{
"index.blocks.write": true
}
执行失败可参照上面的解决方案
第二步:创建创建 .kibana-6 索引
PUT .kibana-6
{
"settings" : {
"number_of_shards" : 1,
"index.mapper.dynamic": false
},
"mappings" : {
"doc": {
"properties": {
"type": {
"type": "keyword"
},
"updated_at": {
"type": "date"
},
"config": {
"properties": {
"buildNum": {
"type": "keyword"
}
}
},
"index-pattern": {
"properties": {
"fieldFormatMap": {
"type": "text"
},
"fields": {
"type": "text"
},
"intervalName": {
"type": "keyword"
},
"notExpandable": {
"type": "boolean"
},
"sourceFilters": {
"type": "text"
},
"timeFieldName": {
"type": "keyword"
},
"title": {
"type": "text"
}
}
},
"visualization": {
"properties": {
"description": {
"type": "text"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"savedSearchId": {
"type": "keyword"
},
"title": {
"type": "text"
},
"uiStateJSON": {
"type": "text"
},
"version": {
"type": "integer"
},
"visState": {
"type": "text"
}
}
},
"search": {
"properties": {
"columns": {
"type": "keyword"
},
"description": {
"type": "text"
},
"hits": {
"type": "integer"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"sort": {
"type": "keyword"
},
"title": {
"type": "text"
},
"version": {
"type": "integer"
}
}
},
"dashboard": {
"properties": {
"description": {
"type": "text"
},
"hits": {
"type": "integer"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"optionsJSON": {
"type": "text"
},
"panelsJSON": {
"type": "text"
},
"refreshInterval": {
"properties": {
"display": {
"type": "keyword"
},
"pause": {
"type": "boolean"
},
"section": {
"type": "integer"
},
"value": {
"type": "integer"
}
}
},
"timeFrom": {
"type": "keyword"
},
"timeRestore": {
"type": "boolean"
},
"timeTo": {
"type": "keyword"
},
"title": {
"type": "text"
},
"uiStateJSON": {
"type": "text"
},
"version": {
"type": "integer"
}
}
},
"url": {
"properties": {
"accessCount": {
"type": "long"
},
"accessDate": {
"type": "date"
},
"createDate": {
"type": "date"
},
"url": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 2048
}
}
}
}
},
"server": {
"properties": {
"uuid": {
"type": "keyword"
}
}
},
"timelion-sheet": {
"properties": {
"description": {
"type": "text"
},
"hits": {
"type": "integer"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"timelion_chart_height": {
"type": "integer"
},
"timelion_columns": {
"type": "integer"
},
"timelion_interval": {
"type": "keyword"
},
"timelion_other_interval": {
"type": "keyword"
},
"timelion_rows": {
"type": "integer"
},
"timelion_sheet": {
"type": "text"
},
"title": {
"type": "text"
},
"version": {
"type": "integer"
}
}
},
"graph-workspace": {
"properties": {
"description": {
"type": "text"
},
"kibanaSavedObjectMeta": {
"properties": {
"searchSourceJSON": {
"type": "text"
}
}
},
"numLinks": {
"type": "integer"
},
"numVertices": {
"type": "integer"
},
"title": {
"type": "text"
},
"version": {
"type": "integer"
},
"wsState": {
"type": "text"
}
}
}
}
}
}
}
第三步:Reindex .kibana into .kibana-6
POST _reindex
{
"source": {
"index": ".kibana"
},
"dest": {
"index": ".kibana-6"
},
"script": {
"inline": "ctx._source = [ ctx._type : ctx._source ]; ctx._source.type = ctx._type; ctx._id = ctx._type + \":\" + ctx._id; ctx._type = \"doc\"; ",
"lang": "painless"
}
}
第四步:Alias .kibana-6 to .kibana and remove legacy .kibana index:
POST /_aliases
{
"actions" : [
{ "add": { "index": ".kibana-6", "alias": ".kibana" } },
{ "remove_index": { "index": ".kibana" } }
]
}
最后问题解决,可以重新创建索引模式!!!
但是发现一个问题,就是这样做,会丢失以前创建的所有模式。
解决思路
第一步:
定位磁盘空间是否够用,当磁盘空间不足时,.kibana是没有权限写入的,这个时候根据自身情况处理看如何减少磁盘使用量。
第二步:
在kibana界面的devtools
中输入:GET .kibana/_settings
并执行。
重点关注一个指标:read_only_allow_delete
是不是为true,
my kibana setting output:
{
".kibana": {
"settings": {
"index": {
"number_of_shards": "1",
"blocks": {
"read_only_allow_delete": "true"
},
"provided_name": ".kibana",
"creation_date": "1511984561925",
"number_of_replicas": "1",
"uuid": "95cOtsa8S6y83KP_3MZ6IQ",
"version": {
"created": "6000099"
}
}
}
}
}
如果为true,在终端执行如下命令,将read_only_allow_delete
的值重置,
curl -XPUT -H "Content-Type: application/json" http://localhost:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": null}'
返回值:
{"acknowledged":true}
证明执行成功。
正确的配置如下: