Save data to InfluxDB V2 & InfluxDB Cloud

    Configure the resource

    Open EMQX Dashboard (opens new window), select the “Resources” tab on the left, click “Create”, and select “InfluxDB HTTP V2 Service” as the resource type.

    The following configurations are included in the resource:

    • InfluxDB host: fill in the host address or the service address created in InfluxDB Cloud;
    • InfluxDB port: The default port for local installation or docker installation is 8086, and the https default port 443 is used for InfluxDB Cloud installation;
    • InfluxDB Bucket: Bucket set name;
    • InfluxDB organization name: the name of the organization filled in when creating the service;
    • Timestamp accuracy: milliseconds by default;
    • Process pool size: The size of the connection process pool, which can be adjusted according to the amount of concurrency of the business (it is recommended to increase one process per 10,000 concurrencies when there is no bottleneck in the network speed);
    • Enable HTTPS: enable the certificate according to the installation and service configuration (For InfluxDB Cloud, please enable this option, but no additional certificate configuration is required);

    Example of obtaining organization name by InfluxDB Cloud (For local or docker deployment, you can enter the console by accessing port 8086 of the deployment address):

    image

    Example of obtaining API Token by InfluxDB Cloud (For local or docker deployment, you can enter the console by accessing port 8086 of the deployment address):

    Create a rule:

    Open and select the “Rule” tab on the left.

    Fill in the rule SQL:

    Related action:

    On the “Action” interface, select “Add action”, and then select “Data to InfluxDB” in the “Action Type” drop-down box.

    • Enable batch insertion: whether to enable batch function;
    • Maximum batch interval: the maximum interval between batch messages;
    • Measurement: InfluxDB Measurement unit;
    • Fields: data key-value pair fields;
    • Tags: data tags;

    image

    Finally, click “Confirm”.

    Return to the response action interface, select the InfluxDB resource just created, fill in other configurations and click “Confirm”.

    The rule has been created. Now, send a message:

    In the rule list, you can see that the number of matches of the rule just created has increased by 1:

    image