尝试使用Shield的Elasticsearch到kibana仪表板获取错误?

时间:2015-04-17 14:40:06

标签: elasticsearch kibana elasticsearch-shield

我在我的环境中使用的以下示例数据

数据:

{ "index" : { "_index" : "cases", "_type" : "case", "_id" : "101" } }
{ "admission" : "2015-01-03", "discharge" : "2015-01-04", "injury" : "broken arm" }
{ "index" : { "_index" : "cases", "_type" : "case", "_id" : "102" } }
{ "admission" : "2015-01-03", "discharge" : "2015-01-06", "injury" : "broken leg" }
{ "index" : { "_index" : "cases", "_type" : "case", "_id" : "103" } }
{ "admission" : "2015-01-06", "discharge" : "2015-01-07", "injury" : "broken nose" }
{ "index" : { "_index" : "cases", "_type" : "case", "_id" : "104" } }
{ "admission" : "2015-01-07", "discharge" : "2015-01-07", "injury" : "bruised arm" }
{ "index" : { "_index" : "cases", "_type" : "case", "_id" : "105" } }
{ "admission" : "2015-01-08", "discharge" : "2015-01-10", "injury" : "broken arm" }
{ "index" : { "_index" : "patients", "_type" : "patient", "_id" : "101" } }
{ "name" : "Adam", "age" : 28 }
{ "index" : { "_index" : "patients", "_type" : "patient", "_id" : "102" } }
{ "name" : "Bob", "age" : 45 }
{ "index" : { "_index" : "patients", "_type" : "patient", "_id" : "103" } }
{ "name" : "Carol", "age" : 34 }
{ "index" : { "_index" : "patients", "_type" : "patient", "_id" : "104" } }
{ "name" : "David", "age" : 14 }
{ "index" : { "_index" : "patients", "_type" : "patient", "_id" : "105" } }
{ "name" : "Eddie", "age" : 72 }

将数据编入索引

$ curl -X POST 'http://localhost:9200/_bulk' --data-binary @./hospital.json


[2015-02-12 08:18:01,347][INFO ][shield.license ] [node0] enabling license for [shield]
[2015-02-12 08:18:01,347][INFO ][license.plugin.core ] [node0] license for [shield] - valid
[2015-02-12 08:18:01,355][ERROR][shield.license ] [node0]
#
# Shield license will expire on [Saturday, March 14, 2015]. Cluster health, cluster stats and indices stats operations are
# blocked on Shield license expiration. All data operations (read and write) continue to work. If you
# have a new license, please update it. Otherwise, please reach out to your support contact.
#

已安装Shield并按上述

启动

数据受到保护,如果我正在尝试访问,我可以看到如下。

$ curl localhost:9200/cases/case/101?pretty=true
{
    "error" : "AuthenticationException[missing authentication token for REST request [/cases/case/1]]",
    "status" : 401
}

添加用户和角色,如下所示

$ elasticsearch/bin/shield/esusers useradd alice -r nurse
$ elasticsearch/bin/shield/esusers useradd bob -r doctor

我已经编辑了roles.yml,并试图根据上面提到的例子添加医生和护士。安全性对我没用。

ubuntu@ip-10-142-247-183:~/elkproject/elasticsearch-1.4.4/config/shield$ curl --user alice:abc123 localhost:9200/_count?pretty=true
{
"error" : "AuthenticationException[unable to authenticate user [alice] for REST request [/_count?pretty=true]]",
"status" : 401
}

注意:我引用了此博客http://blog.trifork.com/2015/03/05/shield-your-kibana-dashboards/ 任何帮助都将受到高度赞赏

1 个答案:

答案 0 :(得分:2)

您是否从软件包(如RPM或DEB)安装了elasticsearch?如果是这样,esusers工具可能会出现问题,将用户置于错误的位置。现在,您必须使用正确的位置configure your environment并添加用户。如果是这种情况,您可以将$ ES_HOME / config / shield目录移动到/ etc / elasticsearch,这是RPM和DEB安装的默认配置目录。在将来使用esusers命令时,只需确保环境变量的设置如链接中所示。

您也可以删除Shield并按照完整的getting started guide开始安装,然后开始修改博客中提到的文件。要删除现有的Shield安装:bin/plugin -r shield