1

I’d like to have an InfluxDB database as part of my cloud project. However, I do not want to manage any VMs in the cloud. My first thought was to use Azure Container Instance Service since it allows to run single docker container. InfluxDB can be run as a docker container so it would be possible to use that. However, I see that Azure Container Instance is often described as a platform for running SHORT-lived containers. This is not my case, my DB needs to be running continuously to serve queries/writes.

Is ACI not the right service to use for my case? What should I use? I know there’s also Azure Kubernetes Service, but this one seems to be used to run whole solutions, not just single containers, as far as I understand.

If I’m unable to use InfluxDB, I will have to stick with CosmosDB for storing my time series data... (Time Series Insights is way too expensive for my simple home project)

Loreno
  • 668
  • 8
  • 26
  • you can also run containers on Web App https://azure.microsoft.com/en-us/services/app-service/containers/ – Thiago Custodio Jan 21 '20 at 19:27
  • 1
    Sidenote: I pay roughly 24 euro per month for my hobby project using the new SKU of time series insights. You have probably looked at the older S1 and S2 SKU's. – Peter Bons Jan 21 '20 at 21:47
  • @PeterBons Ha, I'll have to look at that. However, I really liked InfluxDB. Pleasant to use and has great docs. – Loreno Jan 22 '20 at 11:18
  • @PeterBons How did you go down to 24 euro? When using the TSI Preview, you also need Event Hub (or IoT Hub if you need that) and Azure Storage. Combined, the price will be probably 2x higher at least – Loreno Jan 22 '20 at 12:04
  • @Loreno I use Azure IoT Central, which is free for the first 5 devices. In addition I have a basic tier Event Hub for 10 euro /month. My Pay as you go Time Series Insights costs 8 euro/month currently. Combined it is 18 euro. Even less than I thought. – Peter Bons Jan 22 '20 at 14:22

1 Answers1

3

You can use Azure Container Instance. It can be used to run LONG-lived containers. The only thing you need to pay attention to is attaching a file share as the persistent storage for database. For more details, you may refer to: Mount an Azure file share in Azure Container Instances

Generally:

  1. You need to create a storage account, and create a file share in it.

  2. Then create a ACI with Azure CLI as following:

az container create \
    --resource-group "JackACI" \ 
    --name "jackacidemo245" \
    --image "influxdb" \
    --dns-name-label "jack-aci-demo" \
    --ports 8086 \ 
    --azure-file-volume-account-name $storageAccount \
    --azure-file-volume-account-key $accountKey \ 
    --azure-file-volume-share-name $shareName \ 
    --azure-file-volume-mount-path "/var/lib/influxdb"

Then your container will be created and started:

enter image description here

Then you can create your database and write data:

curl -i -XPOST http://jack-aci-demo.eastasia.azurecontainer.io:8086/query --data-urlencode "q=CREATE DATABASE mydb2"

curl -i -XPOST 'http://jack-aci-demo.eastasia.azurecontainer.io:8086/write?db=mydb2' --data-binary 'cpu_load_short,host=server01,region=us-west value=0.64 1434055562000000000'

Finally, you can check the storage file share:

enter image description here


More documentations for your reference:

  1. influxdb image
  2. Set environment variables in container instances
Jack Jia
  • 5,268
  • 1
  • 12
  • 14
  • Notice that as you are using file share based on SMB protocol, the performance may not be as good as you expected. – Jack Jia Jan 22 '20 at 06:41
  • Thanks. I was afraid I would just expose those queries if someone just had a link, but a token is required and unauthorized message is returned. – Expressingx Oct 16 '21 at 09:19