Skip to content

NoSQL Flux Asset

Introduction

What is Coreflux NoSQL?

Coreflux NoSQL is a flux asset designed to serve as a data aggregator and sink/lake, integrating seamlessly with your MQTT pipeline. It's tailored to register a set of intended topics from a specified MQTT Broker into its NoSQL database, similar in functionality to MongoDB. This database then makes the data available in a consistent JSON format, suitable for processing using various tools or languages.

Features and Benefits

  • Data Aggregation: Aggregates data from various MQTT topics into a unified NoSQL database.
  • Real-time Monitoring: Enables real-time monitoring of data flowing into the database.
  • Data Lake: Serves as a centralized repository for raw and transformed data from various sources.
  • Easy Integration: Simplifies the integration of the NoSQL database with your IIoT projects.

Installation

  1. Login to Coreflux Cloud:

    -L | --login <username> <password>
    
    Use this command to log in to the Coreflux cloud using the provided username and password.

  2. List All Assets:

    -l | --list
    
    Once logged in, you can list all available assets using this command.

  3. Install the Coreflux NoSQL Asset:

    -I | --install CorefluxNoSQL
    
    After logging in, you can install the Coreflux NoSQL asset using its name.

  4. Uninstall the Coreflux NoSQL Asset:

    -U | --uninstall <theAssetGuid>
    
    To remove the asset, use this command with the asset's unique GUID. Ensure you're logged in and have checked the Assets topic for the correct ID.

Configuration

The Coreflux NoSQL asset requires a specific configuration in JSON format to function correctly. Here's a detailed breakdown of a sample configuration:

{
  "MqttClient": {
    "mqttPort": 1883,
    "mqttAddress": "192.168.100.31",
    "isAnonymous": true,
    "username": "",
    "password": "",
    "withTLS": false,
    "DebugTopicEnabled": false,
    "DebugTopic": null
  },
  "nosql2mqtt": {
    "QueryTopic": "query",
    "ResultsTopic": "results",
    "tags": [
      {
        "mqttTopic": "machine/energy/${docId}",
        "collection": ["energyMonitoring"],
        "docId": ["current", "voltage", "total"],
        "restoreOnBootup": true
      },
      {
        "mqttTopic": "production/${docId}",
        "collection": ["productionLine"],
        "docId": ["quality", "speed", "errors"],
        "restoreOnBootup": true
      }
    ]
  }
}

Querying the Data

Energy Monitoring for Machines

Scenario: A factory with several machines, each consuming energy. Monitoring this consumption ensures efficient operation and cost reduction.

Query: To retrieve the current energy consumption of a specific machine over the past 24 hours, publish the following message to the query topic:

{
  "collection": "energyMonitoring",
  "field": "current",
  "timeRange": {
    "start": "2023-09-28T00:00:00Z",
    "end": "2023-09-29T00:00:00Z"
  }
}

Result: The results are published to the results topic:

{
  "collection": "energyMonitoring",
  "field": "current",
  "data": [
    {"timestamp": "2023-09-28T01:00:00Z", "value": 50},
    ...
    {"timestamp": "2023-09-29T00:00:00Z", "value": 49}
  ]
}

Machine Learning for Production Line

Scenario: A production line in a manufacturing plant produces thousands of items daily. Monitoring various metrics and using machine learning can predict potential issues or optimize the production process.

Query: To retrieve all production errors that occurred in the last week, publish the following message to the query topic:

{
  "collection": "productionLine",
  "field": "errors",
  "timeRange": {
    "start": "2023-09-22T00:00:00Z",
    "end": "2023-09-29T00:00:00Z"
  }
}

Result: The results are published to the results topic:

{
  "collection": "productionLine",
  "field": "errors",
  "data": [
    {"timestamp": "2023-09-22T05:23:00Z", "error": "Machine malfunction in Segment A"},
    ...
    {"timestamp": "2023-09-28T20:45:00Z", "error": "Power outage in Segment C"}
  ]
}

FAQ

Q: What is the Coreflux NoSQL Asset?
A: The Coreflux NoSQL Asset is a flux asset provided by Coreflux that serves as a data aggregator and sink/lake, integrating seamlessly with your MQTT pipeline.

Q: How do I configure the Coreflux NoSQL Asset for energy monitoring?
A: For energy monitoring, set the MQTT topics to monitor energy metrics like current, voltage, and total energy consumed. Refer to the "Energy Monitoring for Machines" section for a detailed example.

Q: How can I use the asset for Machine Learning in a production line?
A: Configure the asset to listen to topics related to production metrics like quality, speed, and errors. This data can then be fed into a machine learning model for analysis and predictions. Refer to the "Machine Learning for Production Line" section for more details.

Q: How do I restore data on bootup?
A: The restoreOnBootup configuration option allows you to restore data from the database to the MQTT broker target topic on startup. Set it to true if you want to enable this feature.