inflluxdb

the influx database daemon

Is influxd running?
curl --connect-timeout 2 --head http://localhost:8086/ping
curl: (7) Failed to connect to localhost port 8086: Connection refused
Not running on localhost.
or
curl --connect-timeout 2 --head http://pi93graf:8086/ping Influxdb is running on pi93graf
HTTP/1.1 204 No Content
Content-Type: application/json
Request-Id: 75c9524a-7d8c-11e9-9827-b827eb1c5b93
X-Influxdb-Build: OSS
X-Influxdb-Version: 1.7.6
X-Request-Id: 75c9524a-7d8c-11e9-9827-b827eb1c5b93
Date: Thu, 23 May 2019 18:56:23 GMT   current time
Ommitting the ping returns
HTTP/1.1 404 Not Found 
Content-Type: text/plain; charset=utf-8
X-Content-Type-Options: nosniff
X-Influxdb-Build: OSS
X-Influxdb-Version: 1.7.9
Date: Mon, 30 Dec 2019 21:52:23 GMT
Content-Length: 19

Starting may take 40 seconds! on pi zero

         sudo service influxdb start    or
         sudo systemctl restart influxdb
not: sudo systemctl reload influxdb
      Failed to reload influxdb.service: Job type reload is not applicable for unit influxdb.service.…

Installing

After initial aptitude influxdb
% tail 1 /etc/passwd
influxdb:x:111:65534::/var/lib/influxdb:/usr/sbin/nologin
% tail 1 /etc/group
influxdb:x:116:influxdb

% ls -l /var/lib/influxdb 
total 12
drwxr-xr-x 6 influxdb influxdb 4096 Sep 15 12:18 data/
drwxr-xr-x 2 influxdb influxdb 4096 Oct 25 04:00 meta/
drwx------ 3 influxdb influxdb 4096 Oct 21 11:00 wal/

% sudo du
8	./data/_internal/_series/06 , 07, 02, 05, 04, 01, 03, 000
68	./data/_internal/_series
8	./data/_internal/monitor/1
12	./data/_internal/monitor
84	./data/_internal
88	./data
8	./meta
344	./wal/_internal/monitor/1
348	./wal/_internal/monitor
352	./wal/_internal
356	./wal
456	.
/var/lib/influxdb % sudo ls -lR
.:
drwxr-xr-x 3 influxdb influxdb 4096 Aug 30 19:26 data
 meta
 wal
./data:
 _internal

./data/_internal:
_series
monitor

./data/_internal/_series:
 00 01 02 03 04 05 06 07

./data/_internal/_series/00: 0000
01, 02, 03, 04, 05,06
./data/_internal/_series/07: 0000

./data/_internal/monitor:   1
./data/_internal/monitor/1:

fields.idx
./meta: meta.db

./wal: _internal
./wal/_internal: monitor
./wal/_internal/monitor: 1
./wal/_internal/monitor/1:
_00001.wal




/lib/systemd/system/influxdb.service
original
[Unit]
Description=InfluxDB is an open-source, distributed, time series database This description is too wordy
After=network.target
Documentation=man:influxd(1)

[Service]
User=influxdb
Group=influxdb
LimitNOFILE=65536
EnvironmentFile=-/etc/default/influxdb
ExecStart=/usr/bin/influxd -config /etc/influxdb/influxdb.conf $INFLUXD_OPTS
KillMode=control-group
Restart=on-failure

[Install]
WantedBy=multi-user.target
Alias=influxd.service


% systemctl status influxdb
* influxdb.service - InfluxDB is an open-source, distributed, time series database
     Loaded: loaded (/lib/systemd/system/influxdb.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2025-08-30 19:26:24 EDT; 18min ago
       Docs: man:influxd(1)
   Main PID: 1336 (influxd)
      Tasks: 7 (limit: 414)
        CPU: 5.921s
     CGroup: /system.slice/influxdb.service
             `-1336 /usr/bin/influxd -config /etc/influxdb/influxdb.conf

Aug 30 19:26:24 jebh influxd[1336]: ts=2025-08-30T23:26:24.937822Z lvl=info msg="Starting precreation service" log_id=0ygKhOLG000 servic>
Aug 30 19:26:24 jebh influxd[1336]: ts=2025-08-30T23:26:24.940057Z lvl=info msg="Storing statistics" log_id=0ygKhOLG000 service=monitor >
Aug 30 19:26:24 jebh influxd[1336]: ts=2025-08-30T23:26:24.938347Z lvl=info msg="Starting snapshot service" log_id=0ygKhOLG000 service=s>
Aug 30 19:26:24 jebh influxd[1336]: ts=2025-08-30T23:26:24.940960Z lvl=info msg="Starting continuous query service" log_id=0ygKhOLG000 s>
Aug 30 19:26:24 jebh influxd[1336]: ts=2025-08-30T23:26:24.941323Z lvl=info msg="Starting HTTP service" log_id=0ygKhOLG000 service=httpd>
Aug 30 19:26:24 jebh influxd[1336]: ts=2025-08-30T23:26:24.941469Z lvl=info msg="opened HTTP access log" log_id=0ygKhOLG000 service=http>
Aug 30 19:26:24 jebh influxd[1336]: ts=2025-08-30T23:26:24.951967Z lvl=info msg="Listening on HTTP" log_id=0ygKhOLG000 service=httpd add>
Aug 30 19:26:24 jebh influxd[1336]: ts=2025-08-30T23:26:24.952251Z lvl=info msg="Starting retention policy enforcement service" log_id=0>
Aug 30 19:26:24 jebh influxd[1336]: ts=2025-08-30T23:26:24.962564Z lvl=info msg="Listening for signals" log_id=0ygKhOLG000
Aug 30 19:36:24 jebh influxd[1336]: ts=2025-08-30T23:36:24.952763Z lvl=info msg="New shard group successfully precreated" log_id=
Interactively (shows errors):
% influxd run -config /etc/influxdb/influxdb.conf

% sudo /usr/lib/influxdb/scripts/influxd-systemd-start.sh # backgrounds influxd

influxd [[command] [arguments]]

commands :

config display resultant configuration
Example with error: (influxd halts).
Merging with configuration at: /etc/influxdb/influxdb.conf
config: parse config: Near line 3 (last key parsed ''): bare keys cannot contain '\n'
config: parse config: Near line 2 (last key parsed ''): expected a top-level item to end with a newline, comment, or EOF, but got 't' instead Returns rc=1 (unless piped to more!)

An unknown (or mispelled !) keyword with or with a value does NOT report an error.

backup extracts a snapshot of a data node
run DEFAULT
Does NOT check if there is an existing instance running!
-config path Default $INFLUXDB_CONFIG_PATH, ~/.influxdb/influxdb.conf, or /etc/influxdb/influxdb.conf
Disable the loading of a configuration file by using /dev/null(Why would you?).
-pidfile path Write process ID to a file. Useful for nice
/usr/lib/influxdb/scripts/influxd-systemd-start.sh includes echo $PID > /var/lib/influxdb/influxd.pid
-cpuprofile path Write CPU profiling information to a file.
-memprofile path Write memory usage information to a file.
systemctl status influxdb
icpu=`date +/var/log/influx_cpu_%y%m%d.%H%M`
imem=`date +/var/log/influx_mem_%y%m%d.%H%M`

sudo influxd run -cpuprofile $icpu -memprofile $imem 

systemd uses : /lib/systemd/system/influxdb.service
ExecStart=/usr/lib/influxdb/scripts/influxd-systemd-start.sh

Which includes: Restart=on-failure , RestartSec=600 ,
restore uses a snapshot of a data node to rebuild a cluster
help influxd [command] -help for more information.
version

Disable the _internal database in production!
To disable the _internal database, store-enabled = false under the [monitor] section of the InfluxDB configuration file.

show stats for 'httpd' |

show stats for 'indexes' 
memoryBytes
-----------
267600



influxd config | more # takes nearly 3 minutes~!
Merging with configuration at: /etc/influxdb/influxdb.conf
reporting-disabled = false
bind-address = "127.0.0.1:8088"
[meta] dir = "/var/lib/influxdb/meta" retention-autocreate = true logging-enabled = true [data] dir = "/var/lib/influxdb/data" index-version = "inmem" wal-dir = "/var/lib/influxdb/wal" wal-fsync-delay = "5s" validate-keys = false query-log-enabled = true cache-max-memory-size = 1073741824 #1,073,741,824 1GB too big cache-snapshot-memory-size = 26214400 cache-snapshot-write-cold-duration = "10m0s" compact-full-write-cold-duration = "4h0m0s" compact-throughput = 50331648 compact-throughput-burst = 50331648 max-series-per-database = 1000000 max-values-per-tag = 100000 max-concurrent-compactions = 0 max-index-log-file-size = 1048576 trace-logging-enabled = false tsm-use-madv-willneed = false [coordinator] write-timeout = "10s" max-concurrent-queries = 0 query-timeout = "8s" log-queries-after = "0s" max-select-point = 0 max-select-series = 0 max-select-buckets = 0 [retention] enabled = true check-interval = "30m0s" [shard-precreation] enabled = true check-interval = "10m0s" advance-period = "30m0s" [monitor] store-enabled = true store-database = "_internal" store-interval = "10s" [subscriber] enabled = true http-timeout = "30s" insecure-skip-verify = false ca-certs = "" write-concurrency = 40 write-buffer-size = 1000 [http] enabled = true bind-address = ":8086" auth-enabled = false log-enabled = true suppress-write-log = false write-tracing = false flux-enabled = false [logging] format = "auto" level = "error" suppress-logo = false [[graphite]] enabled = false bind-address = ":2003" database = "graphite" retention-policy = "" protocol = "tcp" batch-size = 5000 batch-pending = 10 batch-timeout = "1s" consistency-level = "one" separator = "." udp-read-buffer = 0 [[collectd]] enabled = false bind-address = ":25826" database = "collectd" retention-policy = "" batch-size = 5000 batch-pending = 10 batch-timeout = "10s" read-buffer = 0 typesdb = "/usr/share/collectd/types.db" security-level = "none" auth-file = "/etc/collectd/auth_file" parse-multivalue-plugin = "split" [[opentsdb]] enabled = false bind-address = ":4242" database = "opentsdb" retention-policy = "" consistency-level = "one" tls-enabled = false certificate = "/etc/ssl/influxdb.pem" batch-size = 1000 batch-pending = 5 batch-timeout = "1s" log-point-errors = true [[udp]] enabled = false bind-address = ":8089" database = "udp" retention-policy = "" batch-size = 5000 batch-pending = 10 read-buffer = 0 batch-timeout = "1s" precision = "" [continuous_queries] enabled = true log-enabled = true query-stats-enabled = false run-interval = "1s" [tls] min-version = "" max-version = ""
>show SERIES
key
---
ruuvi_measurements,dataFormat=3,mac=DFC8B0FE5CC0
ruuvi_measurements,dataFormat=3,mac=E6C3BE6F656C
ruuvi_measurements,dataFormat=3,mac=F7FA744A1E1A
ruuvi_measurements,dataFormat=3,mac=FB0ECBEF7354
ruuvi_measurements,dataFormat=4,mac=D3517872EC0F
ruuvi_measurements,dataFormat=4,mac=F2C0C643AD03
ruuvi_measurements,dataFormat=5,mac=E511D11ECBB8
ruuvi_measurements,dataFormat=5,mac=E6C3BE6F656C


Performance Profiles

Point browset to //http://influxhost:8086/debug/pprof /debug/pprof/

Types of profiles available:
CountProfile
1262allocs
44block
0cmdline
22goroutine
1262heap
16mutex
0profile
10threadcreate
0trace
full goroutine stack dump

Profile Descriptions:


backup

Creates a backup copy.

echo $'\e[3;10;0t \e[8;38;70t'   # set window to upper left corner 10;0 ; resize to 38r x 70c width of ls -log.

#shutdown and disable ruuviCollector  and any applications expecting to connect nicely first.
vi /home/pi/RuuviCollector/RuuviCollector # did NOT;exit 0    # Prevent running when systemd starts it.
sudo systemctl daemon-reload              # just to be current
sudo systemctl status ruuvicollector
sudo systemctl stop ruuvicollector   # it's quite
sudo systemctl status ruuvicollector

Jun 07 16:10:00 pi93graf systemd[1]: Stopping RuuviCollector...
* ruuvicollector.service - RuuviCollector
   Loaded: loaded (/lib/systemd/system/ruuvicollector.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) since Sun 2023-10-22 17:38:15 EDT; 2min 53s ago
  Process: 4876 ExecStart=/home/pi/RuuviCollector/RuuviCollector (code=exited, status=0/SUCCESS)
 Main PID: 4876 (code=exited, status=0/SUCCESS)

sudo systemctl status influxdb 
   time influxd backup -portable|-db dbname [options] path

Exactly one backup path is required and it will be created.

-db name default:with -portable all databases are backed up
-portableUse unless the legacy backup is required.
-host host:port back up from. Defaults 127.0.0.1:8088 i.e.local.
-rp name Retention policy default: all retention policies are used
-shard sssss The identifier of the shard to back up. -rp is required.
-start ccyy-mm-ddThh:mm:ssZ starting with ccyy-mm-ddThh:mm:ssZ
-since ccyy-mm-ddThh:mm:ssZ Points after the timestamp incremental (-start is prefered.)
-end ccyy-mm-ddThh:mm:ss.ssZ Exclude points after timestamp
Not compatible with -since
Without -start & -end results in full backup.
-skip-errors continue if the current shard fails to backup.

Influxdb must be RUNNING!
Download shard 0 failed dial tcp [::1]:8088: connect: connection refused. Waiting 2s and retrying (0)...

pi@pi93graf
cd /varnew/backup 
/bin/df . -m       # 2023 took 1,269 MB !   156 files
systemctl status influxdb  # Must report  Active: active (running) 
/bin/echo -n ready?;read a
time influxd backup  -db ruuvi 
-portable 
-start  '2022-11-21T21:00:01Z'  
influxdb.$yymmdd     

2022/06/09 16:12:31 backing up metastore to 220609/meta.01
2022/06/09 16:12:31 backing up db=ruuvi
2022/06/09 16:12:31 backing up db=ruuvi rp=autogen shard=1064 to 220609/ruuvi.autogen.01064.00 since 0001-01-01T00:00:00Z
2022/06/09 16:12:32 backing up db=ruuvi rp=autogen shard=1074 to 220609/ruuvi.autogen.01074.00 since 0001-01-01T00:00:00Z
… 
2022/06/09 16:17:45 backing up db=ruuvi rp=autogen shard=1953 to 220609/ruuvi.autogen.01953.00 since 0001-01-01T00:00:00Z
2022/06/09 16:17:47 backing up db=ruuvi rp=autogen shard=1956 to 220609/ruuvi.autogen.01956.00 since 0001-01-01T00:00:00Z
2022/06/09 16:17:48 backup complete:
2022/06/09 16:17:48     220609/220609/meta.01
2022/06/09 16:17:48     220609/220609/ruuvi.autogen.01064.00
2022/06/09 16:17:48     220609/220609/ruuvi.autogen.01074.00
…
2022/06/09 16:17:48     220609/220609/ruuvi.autogen.01956.00 
> du
1,536,936

gzip -v * # Use gzip to compress 40% !  takes longer than the backup!    ??????????????/
meta.00:     72.4% -- replaced with meta.00.gz
meta.01:     72.4% -- replaced with meta.01.gz
ruuvi.autogen.01064.00:   wait for it  ....   41.1% -- replaced with ruuvi.autogen.01064.00.gz
ruuvi.autogen.01074.00:  41.4% -- replaced with ruuvi.autogen.01074.00.gz
…
 du
902,036
 
rsync elsewhere, if server craps it does not help to have the backup there!
influxd
 8888888           .d888 888                   8888888b.  888888b.
   888            d88P"  888                   888  "Y88b 888  "88b
   888            888    888                   888    888 888  .88P
   888   88888b.  888888 888 888  888 888  888 888    888 8888888K.
   888   888 "88b 888    888 888  888  Y8bd8P' 888    888 888  "Y88b
   888   888  888 888    888 888  888   X88K   888    888 888    888
   888   888  888 888    888 Y88b 888 .d8""8b. 888  .d88P 888   d88P
 8888888 888  888 888    888  "Y88888 888  888 8888888P"  8888888P"
 
2022-06-09T20:04:25.043135Z info    InfluxDB starting   
                {"log_id": "0azWwHJ0000", "version": "1.8.10", "branch": "1.8", "commit": "688e697c51fd"}
2022-06-09T20:04:25.046570Z info    Go runtime  {"log_id": "0azWwHJ0000", "version": "go1.13.8", "maxprocs": 1}
run: open server: listen: listen tcp 127.0.0.1:8088: bind: address already in use
102 files ! 40% compression i.e. need nearly same amount of free space.
total 902,028KB (compressed)                           6107917 Jun  9 16:14 ruuvi.autogen.01564.00.gz
     4027 Jun  9 16:12 meta.00.gz                     7842453 Jun  9 16:14 ruuvi.autogen.01574.00.gz
     4027 Jun  9 16:12 meta.01.gz                     7334368 Jun  9 16:14 ruuvi.autogen.01584.00.gz
  9112365 Jun  9 16:12 ruuvi.autogen.01064.00.gz      7491427 Jun  9 16:14 ruuvi.autogen.01594.00.gz
 10100117 Jun  9 16:12 ruuvi.autogen.01074.00.gz      7737646 Jun  9 16:14 ruuvi.autogen.01604.00.gz
 10018412 Jun  9 16:12 ruuvi.autogen.01084.00.gz      9012170 Jun  9 16:14 ruuvi.autogen.01614.00.gz
 10093971 Jun  9 16:12 ruuvi.autogen.01094.00.gz      9919191 Jun  9 16:14 ruuvi.autogen.01624.00.gz
 …
 11135192 Jun  9 16:14 ruuvi.autogen.01514.00.gz      9909770 Jun  9 16:17 ruuvi.autogen.01944.00.gz
  8393563 Jun  9 16:14 ruuvi.autogen.01524.00.gz      9847670 Jun  9 16:17 ruuvi.autogen.01947.00.gz
  7848930 Jun  9 16:14 ruuvi.autogen.01534.00.gz     10693497 Jun  9 16:17 ruuvi.autogen.01950.00.gz
  7834470 Jun  9 16:14 ruuvi.autogen.01544.00.gz     10443978 Jun  9 16:17 ruuvi.autogen.01953.00.gz
  5055082 Jun  9 16:14 ruuvi.autogen.01554.00.gz      2344092 Jun  9 16:17 ruuvi.autogen.01956.00.gz


influxd restore

Uses backup copies from the specified PATH to restore databases or specific shards from InfluxDB OSS or InfluxDB Enterprise to an InfluxDB OSS instance.

influxd restore [-portable] [options] path

portable consumes files in an improved Enterprise-compatible format that includes a file manifest.

11/26/22 restored ruuvi started with /var/log free 1,520MB ended with 959MB i.e. 600MB consumed even thoughruuvi was alread included in db.

sudo influxd restore -metadir /varnew/backup/220609 .
Using metastore snapshot: meta.01
No other messages, no change in systemctl status influxdb

-metadir directory where backup meta is found Using metastore snapshot: meta.01
-host host:port InfluxDB OSS host to connect to where the data will be restored. Defaults to '127.0.0.1:8088'.
-db name Name of database to be restored (InfluxDB OSS or InfluxDB Enterprise)
-rp name Optional:Name of retention policy from the backup With -db db_name'
-newdb name Name of the InfluxDB OSS database `into which will be imported.
Default: -db db_name .
Must be unique to the target system.
-portable Activate the portable restore mode. Default legacy restore mode .
-newrp name Name of the retention policy to be created on the target system.
Requires '-rp ' Defaulr: -rp rp_name
-shard id optional: With '-db ' and '-rp ' Identifier of the shard to be restored.
PATH` Path to directory containing the backup files.

Notes

Datafiles must be owned/group influxdb influxdb
> sudo find /var/lib/influxdb -user root # any found need to be chown chgrp influxdb
 > cd /var/lib/influxd
/var/lib/influxdb > sudo chown -vR influxdb  * |grep -v retained
changed ownership of '0_chgrp' from root to influxdb
changed ownership of 'data/_internal/monitor/274/fields.idx' from root to influxdb
changed ownership of 'data/_internal/monitor/274' from root to influxdb
changed ownership of 'data/_internal/monitor/272/000000015-000000002.tsm' from root to influxdb 
changed ownership of 'meta/meta.db' from root to influxdb
changed ownership of 'wal/_internal/monitor/274/_00001.wal' from root to influxdb
changed ownership of 'wal/_internal/monitor/274' from root to influxdb
later:
changed ownership of 'data/ruuvi/autogen/10/000000001-000000001.tsm' from root to influxdb
changed ownership of 'data/ruuvi/autogen/5/000000001-000000001.tsm' from root to influxdb
changed ownership of 'data/_internal/monitor/276/000000010-000000001.tsm' from root to influxdb
changed ownership of 'data/_internal/monitor/276/fields.idx' from root to influxdb
changed ownership of 'wal/_internal/monitor/276/_00036.wal' from root to influxdb
changed ownership of 'wal/_internal/monitor/276/_00035.wal' from root to influxdb


InfluxDB stores all integers as signed int64 data types. The minimum and maximum are -9023372036854775808 and 9023372036854775807.
See Go builtins

Benchmark vs Elasticsearch pdf

community influxData

from raspberry pi rev B as of 18-12-14 InfluxDB shell version: 1.0.2
from pi zero 3/27/19 InfluxDB shell version: 1.7.4 , ` influx_inspect, chronograf


inport CSV data

subscriptions