0

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

数据:

{ "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/ 任何帮助将不胜感激

4

1 回答 1

2

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

您还可以删除 Shield 并按照完整的入门指南重新开始安装,然后开始修改博客中提到的文件。要删除现有的 Shield 安装:bin/plugin -r shield

于 2015-04-24T18:36:36.520 回答