InfluxDB vs VictoriaMetrics

…hard to say what the trend will be, but I consider VM a top contender and the logical choice for those who don’t want to deal with InfluxDB 2.

fwiw, I’ve been running both side by side on a pi4 with no performance issues. as far as I can tell the storage is comparable and I’ll be shutting down Influx in the near future and sticking with VM.

Same experience here, but switched Influx off a couple of weeks ago. Keeping the data as I don’t know how to import it into VM.

sorry that was a typo, I meant: “Pi 3B+” it has 1GB of RAM from 2018
Raspberry Pi 3 B+

Sorry for my late answer. The binary ist loaded from the official Victoria metrics repo. I will release new versions when someone needs it.

I didn’t like the bloated influxdb way anymore and Victoria Metrics was the logical choice. Tiny, fast, stable and reliable. Never had a problem on my pi4 since the switch to Victoria Metrics. So give it a try and i hope you will like it as much as i do.

Tiny, fast, stable and reliable.
How Tiny?
Does anyone have any stats of how much memory /swap it uses.
I’m already struggling with the 1GB in my PI.
(Yes the obvious answer is a bigger PI, but as we all know they are in short supply!)

I will release new versions when someone needs it.
@fulwusl THANKYOU (My of my friends is already using, its on my plans too, see above)

I’ve been at this for some time now… I used InfluxDB for a long time but got discouraged when 2.0 was released because i couldn’t figure it out. Now I’ve managed to both have Grafana work with InfluxQL and have the InfluxDB-integration in Home Assistant write directly to VitoriaMetrics, which means values are written at change instead of scraped :slight_smile:
Write if you wanna know more.

Interesting. I would certainly like to knife more!

Some knifeledge for you @jchh :stuck_out_tongue_winking_eye:
I run it in docker with compose and my VictoriaM-container looks like this:

influxdb:
    container_name: influxdb
    image: "influxdb:latest"
    restart: unless-stopped
    ports:
      - 8086:8086
      - 8083:8083
      - 2003:2003
    env_file:
      - ~/iotstack/configurations/influxdb.env #<-- see below
    volumes:
      - ~/iotstack/influxdb/data:/var/lib/influxdb2
      - ~/iotstack/influxdb/backup:/var/lib/influxdb/backup
# I can't remember why I have the line below 😁
    command: influxd run --bolt-path /var/lib/influxdb2/influxd.bolt --engine-path /var/lib/influxdb2/engine --store bolt

  victoriametrics:
    container_name: victoriametrics
    image: victoriametrics/victoria-metrics:latest
    volumes:
      - ~/iotstack/victoriametrics/data:/storage
    command:
      - "--storageDataPath=/storage"
#      - "--graphiteListenAddr=:2003"
      - "--opentsdbListenAddr=:4242"
      - "--httpListenAddr=:8428"
      - "--influxListenAddr=:8089"
      - "--vmalert.proxyURL=http://vmalert:8880"
      - "--retentionPeriod=3y"
      - "--selfScrapeInterval=20s"
      - "--loggerTimezone=Europe/Stockholm"
    network_mode: host
    restart: unless-stopped

*I think there might be some commands in victoriametrics compose that aren’t needed…

#2012-12-07
TZ=Europe/Stockholm
INFLUXDB_DATA_ENGINE=tsm1
INFLUXDB_REPORTING_DISABLED=false
INFLUXDB_HTTP_ENABLED=true
INFLUXDB_HTTP_AUTH_ENABLED=true
INFLUXDB_ADMIN_ENABLED=true
INFLUXDB_ADMIN_USER=YOURUSER
INFLUXDB_ADMIN_PASSWORD=YOURPASSWORD

#INFLUXDB_USER=nodered
#INFLUXDB_USER_PASSWORD=nodered
#INFLUXDB_READ_USER=myreaduser
#INFLUXDB_READ_USER_PASSWORD=myreadpassword
#INFLUXDB_WRITE_USER=mywriteuser
#INFLUXDB_WRITE_USER_PASSWORD=mywritepassword

We can write immediately to VM with the influx integration in Home Assistant.

I just copied my previous Influx in configuration.yaml but chagned the port to 8428
(see “–httpListenAddr=:8428”)

#influxdb
influxdb:
  api_version: 2
  ssl: false
  host: 192.168.1.59
  port: 8086
  token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  organization: xxxxxxx
  bucket: HA
  tags:
    source: HA
  tags_attributes:
    - friendly_name
    - device_class
  default_measurement: units
  
#victoriametrics
influxdb:
  api_version: 2
  ssl: false
  host: 192.168.1.59
  port: 8428  #<-- port changed
  token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  organization: xxxxxxx
  bucket: HA
  tags:
    source: HA_VM
  tags_attributes:
    - friendly_name
    - device_class
  default_measurement: units

To read this in Grafana.
Influx-Query Language

Add datasource → InfluxDB
URL: http://192.168.1.59:8428
Select Basic Auth
User: YOURUSER
Password: YOURPASSWORD
I only use one user/pass and not different for each DB. Up to you.

Go to InfluxDB → “arrow pointing up in menu on the left” → API Tokens.
Generate a new token.
*Note, I also use this token in the compose file above.

Click Add header → Enter Authorization in the first field.
Enter Token YOUR VERY LONG TOKEN ← Note the space between Token and actual token.

Victoria Metrics
Add datasource → Prometheus
URL: http://192.168.1.59:8428
*I haven’t experimented with passwords for VM so there is not much more to do. Just click “Save and test”.

2 Likes

awesome - I also use Docker so will try this over the weekend - thanks!

Hey all,
I work as a DevRel over at InfluxData. Hearing your pain over the 1.X to 2.X move of InfluxDB OSS. If you have any questions or ideas to pass on happy to take them back to the team.

To help answer some of your questions:

  1. 2.X still has influxql support available: Use Grafana with InfluxDB OSS | InfluxDB OSS 2.6 Documentation

  2. 2.X also provides inbuilt dashboarding capabilities and automation via tasks.

  3. 1.8.10 or InfluxDB is also alive and well but completely understand if Victoria Metrics fits your use case better.

1 Like

would I be right in assuming the excludes/filters are that are listed for influx will be applied to VM as well?

eg:

influxdb:
  [[...]]
  exclude:
    domains:
      - alarm_control_panel
      - sun
      - updater
      - media_player
      - zone
      - device_tracker
      - remote
      - weather

in my current docker-compose (pre your changes), I only have the following:

    command:
      - "--selfScrapeInterval=60s"      # to enable self-monitoring => Grafana dashboard
      - "--retentionPeriod=3y"          # default is "1 m"
      - "--storageDataPath=/storage"
      - "--httpListenAddr=:8428" 

I would assume that since the filtering is done before pushing, and we only change where the data is pushed.

1 Like

I don’t have this line.

1 Like

I got it working!
Here is my docker and HA configuration.yaml for anyone else…

docker-compose.yaml - note: vmagent no longer needed…

# uses InfluxDb integration in HA to push changes to VM's listening port: 8428
  victoriametrics: # http://dietpi:8428
    container_name: victoriametrics
    image: victoriametrics/victoria-metrics:latest
    volumes:
      - ./vm/vmdata:/storage
      - /etc/localtime:/etc/localtime:ro  # only for RPi (Docker Mac is a VM)
    command:
      - "--selfScrapeInterval=60s"        # to enable self-monitoring ➜ Grafana
      - "--retentionPeriod=3y"            # default is "1m"
      - "--storageDataPath=/storage"
      - "--httpListenAddr=:8428"          # Influx HA config must also use 8428
    network_mode: host
    restart: unless-stopped

configuration.yaml (HA) note: prometheus no longer needed

influxdb:  # for VictoriaMetrics
  api_version: 2
  ssl: false
  host: 192.168.1.100
  port: 8428                            # VM docker command: --httpListenAddr=:8428
  token: !secret influxdb_token
  organization: !secret influxdb_org
  bucket: !secret influxdb_bucket
  tags:
    source: HA
  tags_attributes:
    - friendly_name
    - device_class
  default_measurement: units
  exclude:
    entities:
      - sensor.date
      - sensor.time
    domains:
      - sun
      - updater
      - media_player
      - zone
      - device_tracker
      - remote
      - weather
    entity_globs:
      - sensor.anniversary_*
      - sensor.count*
      - sensor.speedtest_*
      - sensor.pirateweather_*
1 Like

FYI, recent versions of VictoriaMetrics allow controlling the frequency of disk write operations with the -inmemoryDataFlushInterval command-line flag. This may help saving the lifetime for commodity SD cards with limited number of write cycles. See CHANGELOG · VictoriaMetrics for more details.

Thankyou fuslwusl for this add-on and thank-you @fuslwusl , @jchh and others for all the development to this topic and advice.

I upgraded to a raspberry PI4 (4GB) and now have Victoria Metrics and Grafna running, using the HA Influx integration. (Graphs on steriods and long term statistics here I come :slight_smile: )

For anyone with some experience of HA, its a minimal effort. I have offered @fuslwusl some tweaks to the installation instructions based on my experience.

For the record: HA says the Victoria metrics add-on is using 1.1% “add-on RAM usage” that would be 4.5% of 1GB I guess.
And Grafna: 1.5% ie 6% of 1GB
The added CPU is apparently 0.3% (of a PI4)
(The whole rPI4 (4GB) is running at 31% RAM utilisation and zero swap file use, :slight_smile: )

2 Likes

Hey, I’m trying to set up VictoriaMetrics now and I’m struggling to understand the token, organization and bucket settings. I cannot find any of these in any place in VM? I seem to remember these from way back when I meddled with Influxdb, but are these needed when working with VM?

VictoriaMetrics doesn’t need any of that, the setup is trivial in the VM side, there is no configuration at all, you just pass the retention period in the docker command line, that’s it, in the HA side you use the config for influx v1 without org, bucket, token ok r password, see the link below.

Thanks to this thread I discovered VM while researching options for long term storage, and I got VM/grafana running in 10 minutes, it’s fantastic. All in a raspberry pi with a just-installed crucial x6 ssd. Also running frigate with a coral accelerator, all dockerized.