我在Ubuntu(版本Ubuntu 17.04)上安装了Elastic Heartbeat(版本6.0.0(amd64),libbeat 6.0.0),并在另一台服务器上连接到Elasticsearch(版本5.6.4)的实例。 Heartbeat启动正常,但在尝试向Elasticsearch发送数据时会抛出错误。
在日志中我看到:
2017-11-27T20:57:13Z DBG PublishEvents: 5 events have been published to elasticsearch in 7.248554ms.
2017-11-27T20:57:13Z WARN Can not index event (status=400): {"type":"mapper_parsing_exception","reason":"Failed to parse mapping [_default_]: Mapping definition for [monitor] has unsupported parameters: [properties : {duration={properties={us={type=long}}}, scheme={ignore_above=1024, type=keyword}, ip={type=ip}, host={ignore_above=1024, type=keyword}, name={ignore_above=1024, type=keyword}, id={ignore_above=1024, type=keyword}, type={ignore_above=1024, type=keyword}, status={ignore_above=1024, type=keyword}}]","caused_by":{"type":"mapper_parsing_exception","reason":"Mapping definition for [monitor] has unsupported parameters: [properties : {duration={properties={us={type=long}}}, scheme={ignore_above=1024, type=keyword}, ip={type=ip}, host={ignore_above=1024, type=keyword}, name={ignore_above=1024, type=keyword}, id={ignore_above=1024, type=keyword}, type={ignore_above=1024, type=keyword}, status={ignore_above=1024, type=keyword}}]"}}
该错误,为了便于查看,请说:
2017 - 11 - 27 T20: 57: 13 Z WARN Can not index event(status = 400): {
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping [_default_]: Mapping definition for [monitor] has unsupported parameters:
[properties: {
duration = {
properties = {
us = {
type = long
}
}
},
scheme = {
ignore_above = 1024,
type = keyword
},
ip = {
type = ip
},
host = {
ignore_above = 1024,
type = keyword
},
name = {
ignore_above = 1024,
type = keyword
},
id = {
ignore_above = 1024,
type = keyword
},
type = {
ignore_above = 1024,
type = keyword
},
status = {
ignore_above = 1024,
type = keyword
}
}]",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "Mapping definition for [monitor] has unsupported parameters: "
}
我安装软件包的步骤是:
> wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
OK
> sudo apt-get install apt-transport-https
> echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
> sudo apt-get update
> sudo apt-get install heartbeat-elastic
> /usr/share/heartbeat/bin/heartbeat --version
heartbeat version 6.0.0 (amd64), libbeat 6.0.0
> vi /etc/heartbeat/heartbeat.yml
heartbeat.monitors:
- hosts:
- 0.0.0.0:9190
schedule: '@every 60s'
type: tcp
- hosts:
- 0.0.0.0:3030
schedule: '@every 60s'
type: tcp
- hosts:
- ****************:3306
schedule: '@every 60s'
type: tcp
logging.files:
keepfiles: 7
name: heartbeat.log
path: /var/log/heartbeat
logging.level: debug
logging.to_files: true
logging.to_syslog: false
output.elasticsearch:
hosts:
- http://****************:9200
password: ****************
username: elastic
> /usr/share/heartbeat/bin/heartbeat setup --template -c /etc/heartbeat/heartbeat.yml -path.home /usr/share/heartbeat -path.config /etc/heartbeat -path.data /var/lib/heartbeat -path.logs /var/log/heartbeat
Loaded index template
> /usr/share/heartbeat/bin/heartbeat setup --dashboards -c /etc/heartbeat/heartbeat.yml -path.home /usr/share/heartbeat -path.config /etc/heartbeat -path.data /var/lib/heartbeat -path.logs /var/log/heartbeat
Loaded dashboards
> sudo service heartbeat-elastic restart
> sudo service heartbeat-elastic status
heartbeat-elastic.service - heartbeat
Loaded: loaded (/lib/systemd/system/heartbeat-elastic.service; disabled; vendor preset: enabled)
Active: active (running) since Mon 2017-11-27 21:26:23 UTC; 1min 11s ago
Docs: https://www.elastic.co/guide/en/beats/heartbeat/current/index.html
Main PID: 25014 (heartbeat)
Tasks: 7 (limit: 4915)
Memory: 4.7M
CPU: 49ms
CGroup: /system.slice/heartbeat-elastic.service
└─25014 /usr/share/heartbeat/bin/heartbeat -c /etc/heartbeat/heartbeat.yml -path.home /usr/share/heartbeat -path.config /etc/heartbeat -path.data /var/lib/heartbeat -path.logs /var/log/heartbeat
systemd[1]: Started heartbeat.
> tail /var/log/heartbeat/heartbeat.log -n100
"scheme": "tcp",
"id": "tcp-plain@0.0.0.0:9190"
},
"type": "monitor",
"beat": {
"hostname": "*************",
"version": "6.0.0",
"name": "*************"
}
}
2017-11-27T21:33:25Z DBG Job 'tcp-plain@0.0.0.0:9190' returned at 2017-11-27 21:33:25.82402829 +0000 UTC (cont=0).
2017-11-27T21:33:25Z DBG Next wakeup time: 2017-11-27 21:34:25.820400426 +0000 UTC
2017-11-27T21:33:25Z DBG Publish event: {
"@timestamp": "2017-11-27T21:33:25.822Z",
"@metadata": {
"beat": "heartbeat",
"type": "doc",
"version": "6.0.0"
},
"beat": {
"hostname": "*************",
"version": "6.0.0",
"name": "*************"
},
"tcp": {
"rtt": {
"connect": {
"us": 1719
}
},
"port": 3030
},
"monitor": {
"duration": {
"us": 2203
},
"status": "up",
"scheme": "tcp",
"id": "tcp-plain@0.0.0.0:3030",
"name": "tcp",
"type": "tcp",
"ip": "0.0.0.0"
},
"type": "monitor"
}
2017-11-27T21:33:25Z DBG Publish event: {
"@timestamp": "2017-11-27T21:33:25.820Z",
"@metadata": {
"beat": "heartbeat",
"type": "doc",
"version": "6.0.0"
},
"tcp": {
"port": 3306,
"rtt": {
"connect": {
"us": 2465
}
}
},
"monitor": {
"ip": "*************",
"duration": {
"us": 3155
},
"status": "up",
"scheme": "tcp",
"id": "tcp-plain@*************:3306",
"type": "tcp",
"name": "tcp"
},
"type": "monitor",
"beat": {
"version": "6.0.0",
"name": "*************",
"hostname": "*************"
}
}
2017-11-27T21:33:25Z DBG Job 'tcp-plain@0.0.0.0:3030' returned at 2017-11-27 21:33:25.828833688 +0000 UTC (cont=0).
2017-11-27T21:33:25Z DBG Next wakeup time: 2017-11-27 21:34:25.820400426 +0000 UTC
2017-11-27T21:33:25Z DBG Job 'tcp-plain@*************:3306' returned at 2017-11-27 21:33:25.828912205 +0000 UTC (cont=0).
2017-11-27T21:33:25Z DBG Next wakeup time: 2017-11-27 21:34:25.820400426 +0000 UTC
2017-11-27T21:33:26Z DBG ES Ping(url=http://gmri-metrics.upswell.io:9200)
2017-11-27T21:33:26Z DBG Ping status code: 200
2017-11-27T21:33:26Z INFO Connected to Elasticsearch version 5.6.4
2017-11-27T21:33:26Z DBG HEAD http://gmri-metrics.upswell.io:9200/_template/heartbeat-6.0.0 <nil>
2017-11-27T21:33:26Z INFO Template already exists and will not be overwritten.
2017-11-27T21:33:26Z DBG PublishEvents: 3 events have been published to elasticsearch in 13.392505ms.
2017-11-27T21:33:26Z WARN Can not index event (status=400): {"type":"mapper_parsing_exception","reason":"Failed to parse mapping [_default_]: Mapping definition for [monitor] has unsupported parameters: [properties : {duration={properties={us={type=long}}}, scheme={ignore_above=1024, type=keyword}, ip={type=ip}, host={ignore_above=1024, type=keyword}, name={ignore_above=1024, type=keyword}, id={ignore_above=1024, type=keyword}, type={ignore_above=1024, type=keyword}, status={ignore_above=1024, type=keyword}}]","caused_by":{"type":"mapper_parsing_exception","reason":"Mapping definition for [monitor] has unsupported parameters: [properties : {duration={properties={us={type=long}}}, scheme={ignore_above=1024, type=keyword}, ip={type=ip}, host={ignore_above=1024, type=keyword}, name={ignore_above=1024, type=keyword}, id={ignore_above=1024, type=keyword}, type={ignore_above=1024, type=keyword}, status={ignore_above=1024, type=keyword}}]"}}
2017-11-27T21:33:26Z WARN Can not index event (status=400): {"type":"mapper_parsing_exception","reason":"Failed to parse mapping [_default_]: Mapping definition for [monitor] has unsupported parameters: [properties : {duration={properties={us={type=long}}}, scheme={ignore_above=1024, type=keyword}, ip={type=ip}, host={ignore_above=1024, type=keyword}, name={ignore_above=1024, type=keyword}, id={ignore_above=1024, type=keyword}, type={ignore_above=1024, type=keyword}, status={ignore_above=1024, type=keyword}}]","caused_by":{"type":"mapper_parsing_exception","reason":"Mapping definition for [monitor] has unsupported parameters: [properties : {duration={properties={us={type=long}}}, scheme={ignore_above=1024, type=keyword}, ip={type=ip}, host={ignore_above=1024, type=keyword}, name={ignore_above=1024, type=keyword}, id={ignore_above=1024, type=keyword}, type={ignore_above=1024, type=keyword}, status={ignore_above=1024, type=keyword}}]"}}
2017-11-27T21:33:26Z WARN Can not index event (status=400): {"type":"mapper_parsing_exception","reason":"Failed to parse mapping [_default_]: Mapping definition for [monitor] has unsupported parameters: [properties : {duration={properties={us={type=long}}}, scheme={ignore_above=1024, type=keyword}, ip={type=ip}, host={ignore_above=1024, type=keyword}, name={ignore_above=1024, type=keyword}, id={ignore_above=1024, type=keyword}, type={ignore_above=1024, type=keyword}, status={ignore_above=1024, type=keyword}}]","caused_by":{"type":"mapper_parsing_exception","reason":"Mapping definition for [monitor] has unsupported parameters: [properties : {duration={properties={us={type=long}}}, scheme={ignore_above=1024, type=keyword}, ip={type=ip}, host={ignore_above=1024, type=keyword}, name={ignore_above=1024, type=keyword}, id={ignore_above=1024, type=keyword}, type={ignore_above=1024, type=keyword}, status={ignore_above=1024, type=keyword}}]"}}
2017-11-27T21:33:26Z DBG ackloop: receive ack [0: 0, 3]
2017-11-27T21:33:26Z DBG broker ACK events: count=1, start-seq=1, end-seq=1
2017-11-27T21:33:26Z DBG broker ACK events: count=1, start-seq=1, end-seq=1
2017-11-27T21:33:26Z DBG broker ACK events: count=1, start-seq=1, end-seq=1
2017-11-27T21:33:26Z DBG ackloop: return ack to broker loop:3
2017-11-27T21:33:26Z DBG ackloop: done send ack
我正在使用(或多或少)开箱即用的配置,但我不明白为什么我收到“无法解析映射...”错误。
非常感谢任何帮助!
答案 0 :(得分:0)
I solved this by updating Elasticsearch to 6.x so that both Elasticsearch and Heartbeat are running on the same version.