See: https://emqx.atlassian.net/wiki/spaces/P/pages/612368639/open+e5.1+remove+auto+restart+interval+from+buffer+worker+resource+options Current problem: In 5.0.x, we have two timer options that control the state changing of buffer worker resources: auto_restart_interval and health_check_interval. - auto_restart_interval controls how often the resource attempts to transition from disconnected to connected. - health_check_interval controls how often the resource is checked and potentially moved from connected to disconnected or connecting. The existence of two independent timers for very similar purposes is confusing to users, QA and even developers. Also, an intimately related configuration is request_timeout, which can interact badly with auto_restart_interval if the latter is poorly configured: requests may always expire if request_timeout < auto_restart_interval and if the resource enters the disconnected state. For health_check_interval, we attempt to derive a sane default that gives requests a chance to retry (if request timeout is finite, then the resource retries requests with a period of min(health_check_interval, request_timeout / 3). Another problem with the separate auto_restart_interval is that its default value (60 s) is too high when compared to the default request timeout and health check, leading to the problems described above if not tuned. Proposed solution: We propose to drop auto_restart_interval in favor of health_check_interval, which will be used for both disconnected -> connected and connected -> {disconnected, connecting} transition checks. With that, the resource will attempt to reconnect at the same interval as the health check, which currently is 15 s. Also, as two smaller changes to accompany this one: - Increase the default request_timeout from 15 s to 45 s. - Rename request_timeout to request_ttl. |
||
|---|---|---|
| .. | ||
| certs | ||
| docker-compose.yaml | ||
| emqx.conf | ||
| influx-bridge.conf | ||
| README.md | ||
| start.sh | ||
Test influxdb integration
This script starts two EMQX nodes and a influxdb server in docker container. The bootstraping rule engine and data bridge config is provided in influx-bridge.conf which got included in the bootstraping config bundle emqx.conf.
Start the cluster
./start.sh
How to run tests
The rule and bridge are configured to pipe data from MQTT topic t/# to the 'myvalues' measurement in the 'mqtt' bucket.
Manual verification steps
- Start the cluster
- Send mqtt messages to topic
/t/awith a JSON object as MQTT paylaod like{"value": 1} - Observe data in influxdb
curl -k -H 'Authorization: Token abcdefg' -G 'https://localhost:8086/query?pretty=true' --data-urlencode "db=mqtt" --data-urlencode "q=SELECT * from myvalues"
Example output the curl query against influxdb:
{"results":[{"statement_id":0,"series":[{"name":"myvalues","columns":["time","clientid","value"],"values":[["2023-02-28T11:13:29.039Z","a1",123]]}]}]