InfluxDB 1.x auth-enabled=true: application writes succeed but continuous queries stop populating retention policy
0 reputation · 11 Oct 2021, 08:27 UTC
0 reputation · 11 Oct 2021, 08:27 UTC
When auth-enabled=true is set in the [http] section of influxdb.conf, InfluxDB 1.x requires all clients to authenticate. Local development typically runs with auth-enabled=false, so applications never send credentials. After enabling auth in production, the admin user must exist and application users need explicit GRANT READ/WRITE/ALL on databases.
Continuous queries execute internally within the server. The key uncertainty is which identity a CQ uses for its write operations once authentication is enforced. If the CQ was created by a user who later loses privileges or is dropped, the background writes to the downsampled retention policy may fail silently without clear error messages.
Questions:
Continuous queries in InfluxDB 1.x run as an internal server process, not under the identity of the user who created them. Enabling auth-enabled=true does not, by itself, break CQ writes, and dropping or revoking the creating user does not stop a CQ. When a downsampled retention policy stops populating right after auth is enabled, the usual cause is upstream: the application's writes are now failing with 401/403, so the CQ has no new source data to aggregate. An empty target RP almost always means empty input, not a failed CQ.
Confirmed behavior:
EVERY/FOR clauses. They do not carry the creator's credentials, so user management changes don't disable them.SHOW CONTINUOUS QUERIES only lists definitions. It reports no last-run timestamp and no errors./var/log/influxdb, depending on how you run it), typically with "continuous query" in the message.Likely explanation for your case: your application "writes succeed" only in the sense that no exception is thrown. Many InfluxDB clients don't raise on non-2xx responses, so a 401 (no credentials) or 403 (missing WRITE grant) looks like success. A second possibility is an RP mismatch introduced while re-creating users/databases: writes land in autogen while the CQ selects from a named RP (or the reverse). Fully qualified measurement names in the CQ (db.rp.measurement) make this explicit.
curl -i -u appuser:secret -XPOST \
'http://localhost:8086/write?db=mydb' \
--data-binary 'cq_test,tag=a value=1'A 401/403 here explains the empty downsampled RP: fix the client's credentials or GRANT WRITE ON mydb TO appuser.SELECT count(*) FROM "mydb"."autogen"."raw_measurement"
WHERE time > now() - 1h -- match the CQ's FOR intervalSELECT ... INTO manually as an authenticated admin. If it returns and writes rows, the CQ logic is fine and the problem is input data.journalctl -u influxdb | grep -i 'continuous query' | tail -20SELECT * FROM "mydb"."downsampled_rp"."agg_measurement"
ORDER BY time DESC LIMIT 5Exact log wording and CQ scheduling details vary across 1.x minor versions, so verify against your deployed version. Also note that dropping and re-creating a CQ resets its internal execution watermark, which can cause reprocessing or gaps — avoid recreating CQs as a "fix" until you've confirmed where the data flow actually breaks.
One diagnostic detail that would change this recommendation: the HTTP status code your application receives on writes. If it is genuinely 204 and source points exist in the correct RP, then the CQ itself or its RP qualification needs a closer look.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.