Set Up the Influx Client for InfluxQL Queries
6 min
You can set up the Influx client to execute influxQL queries.
Before You Begin
Make sure you do the following:
- Pull the Influxdb application image into Belden Horizon Data Operations. See Upload an Image for details.
Step 1: Deploy Influx Container
To deploy the Influx container:
- In Belden Horizon Data Operations, navigate to Applications > Containers. The Containers pane appears.
- Click Run. The Enter command to run field appears.
- Enter the following:
docker run -d --name influxdb influxdb
The named container appears in the Containers pane and displays a running state. The container runs locally.
Step 2: Provide Database User Access to Influx Database
To provide database user access to Influx database:
- In Belden Horizon Data Operations, navigate to Applications > Containers. The Containers pane appears.
- Click the Terminal icon next to the Influx container. The Influxdb Terminal pane appears.
- Enter influx -host 'host-IP' -port '8086' -database 'tsdata' -username 'your-username' -password 'your-password' and press ENTER. The host-IP parameter is the Belden Horizon Data Operations URL IP address. For example: influx -host '192.168.7.236' -port '8086' -database 'tsdata' -username 'jsmith' -password 'jsmithpwd'
Step 3: Enter and Execute InfluxQL Queries
After completing step 2, you can enter and execute InfluxQL Queries.
Example 1: Show Measurements
> use tsdata
Using database tsdata
>
>
> show measurements
name: measurements
name
----
PLC1.A29A572B-A69F-4BA2-8AA5-AA842832E2D0
PowerMeter.A29A572B-A69F-4BA2-8AA5-AA842832E2D0
simulator.E12E832D-33F9-4E8F-A52B-CAE93607DE3D
>Example 2: Show Tag Keys
>
>show tag keys on tsdaya
name: PLC1.A29A572B-A69F-4BA2-8AA5-AA842832E2D0
tagKey
------
datatype
device_id
register_id
tag
topic
name: PowerMeter.A29A572B-A69F-4BA2-8AA5-AA842832E2D0
tagKey
------
datatype
device_id
register_id
tag
topic
name: simulator.E12E832D-33F9-4E8F-A52B-CAE93607DE3D
tagKey
------
datatype
device_id
register_id
tag_topic