您的位置:首页 > 其它

Elasticsearch::Transport::Transport::Errors::Unauthorized" error="[401]

2016-04-06 10:01 686 查看
功能描述:fluentd(td-agent) 提取日志存储到elasticsearch 中

环境配置:elasticsearch 添加了shield 插件。配置了用户角色。

fluentd(td-agent)相关配置如下: 

<match **>

    type elasticsearch_dyn_index

    hosts loghub-es-01.yr.local:9200,loghub-es-02.yr.local:9200,loghub-es-03.yr.local:9200

    buffer_queue_limit 512

    buffer_chunk_limit 16m

    # NOTE! type_name must be consitent with what we set when creating new index in ES

    type_name applog

    index_prefix_key app-name

    index_dateformat %Y-%m-%d

    utc_index false

    message_key msg

    parse_msg_timestamp true

    time_key time

    num_threads 8

    retry_wait 5s

    max_retry_wait 600s

    disable_retry_limit true

    flush_interval 5s

    user es_admin

    password es_admin

</match>

日志信息报warn信息如下:

2016-04-06 09:38:19 +0800 [warn]: temporarily failed to flush the buffer. next_retry=2016-04-06 09:38:25 +0800 error_class="Elasticsearch::Transport::Transport::Errors::Unauthorized" error="[401] {\"error\":{\"root_cause\":[{\"type\":\"security_exception\",\"reason\":\"unable
to authenticate user [es_admin] for REST request [/_bulk]\",\"header\":{\"WWW-Authenticate\":\"Basic realm=\\\"shield\\\"\"}}],\"type\":\"security_exception\",\"reason\":\"unable to authenticate user [es_admin] for REST request [/_bulk]\",\"header\":{\"WWW-Authenticate\":\"Basic
realm=\\\"shield\\\"\"}},\"status\":401}" plugin_id="object:1b8f1cc"

  2016-04-06 09:38:19 +0800 [warn]: suppressed same stacktrace

2016-04-06 09:38:25 +0800 [warn]: retry succeeded. plugin_id="object:1b8f1cc"

问题分析:

日志中 retry succeeded  可以看出消息存储成功。td-agent 是轮询插入到es cluster 中的nodes 。 最后查看es nodes 发现有一台node 没有配置用户。

配置成功后,无发现上面warn信息。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: