我看过一些这样的帖子,但都没有解决我的问题,所以:
我按照本教程创建了一个弹性集群:https://www.elastic.co/guide/en/elasticsearch/reference/current/configuring-tls-docker.html
我已经设置了内置密码,可以访问elasticsearch
$ curl -k --user elastic:$ELASTIC_PWD https://localhost:9200/
{
"name" : "es01",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "hqrGkTUGR0W2Clsaxp75pQ",
"version" : {
"number" : "7.6.2",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "ef48eb35cf30adf4db14086e8aabd07ef6fb113f",
"build_date" : "2020-03-26T06:34:37.794943Z",
"build_snapshot" : false,
"lucene_version" : "8.4.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}我将证书颁发机构复制到主机(我将在其中运行metricbeat),如下所示:
sudo -s
mkdir -p /etc/pki/root
docker exec kibana cat /usr/share/elasticsearch/config/certificates/ca/ca.crt > /etc/pki/root/ca.pem我可以检查证书是否在那里:
$ cat /etc/pki/root/ca.pem
-----BEGIN CERTIFICATE-----
<certificate>
-----END CERTIFICATE-----到目前为止一切顺利,然后,我按照本教程安装了metricbeat:https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-installation.html
并在/etc/metricbeat/metricbeat.yml上设置以下配置
setup.kibana:
host: "https://localhost:5601"
ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]
output.elasticsearch:
hosts: ["https://localhost:9200"]
username: "metricbeat"
password: "<password>"
ssl.certificate_authorities: ["/etc/pki/root/ca.pem"]我在Kibana中创建的metricbeat用户如下:https://www.elastic.co/guide/en/beats/metricbeat/current/feature-roles.html
基本上,我在metricbeat-*上创建了一个名为metricbeat_setup的角色,具有群集权限monitor和manage_ilm以及索引权限manage,然后,我创建了metricbeat用户,角色为metricbeat_setup、kibana_admin、ingest_admin、<代码>D18、<代码>D19
我想我的问题可能出在这里,我不太理解必要的权限,所以我就做得太过分了,不管怎么说,继续...
我运行了设置sudo metricbeat setup -e,一切都很顺利,设置中没有错误,然后我用sudo service metricbeat start启动了它,但没有任何东西进入elasticsearch,当我查看sudo service metricbeat status时,我得到了多行WARN Cannot index event
我试图查看/var/log/metricbeat/中的日志,但在那里没有发现任何有用的信息,在docker中的elasticsearch日志中也没有发现任何有用的信息。
创建metricbeat-*索引并分配分片:
$ curl -k --user elastic:$ELASTIC_PWD https://localhost:9200/_cat/indices/metricbeat-*?pretty
green open metricbeat-7.7.0-2020.05.25-000001 p_0nuiX1S8SARk9QZK01EA 1 1 0 0 566b 283b$ curl -k --user elastic:$ELASTIC_PWD https://localhost:9200/_cluster/allocation/explain?pretty
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "unable to find any unassigned shards to explain [ClusterAllocationExplainRequest[useAnyUnassignedShard=true,includeYesDecisions?=false]"
}
],
"type" : "illegal_argument_exception",
"reason" : "unable to find any unassigned shards to explain [ClusterAllocationExplainRequest[useAnyUnassignedShard=true,includeYesDecisions?=false]"
},
"status" : 400
}所以,请告诉我,我错过了什么?我在日志或帖子中找不到任何相关信息,我在这里看到的帖子说这与磁盘空间不足有关,我有14G的空闲空间,所以我猜这不是问题。此外,我知道metricbeat可以连接到elasticsearch和kibana,因为它能够创建索引和仪表板,我可以在kibana中打开仪表板,但没有数据。
我做错了什么?
谢谢
发布于 2020-05-26 05:57:05
为了能够在索引中写入,用户需要拥有所需索引中的特权create_doc。
在这种情况下,对于每个名为metricbeat-*的索引,用户需要拥有create_doc的index特权。
https://stackoverflow.com/questions/62010657
复制相似问题