{"id":1483,"date":"2024-11-05T19:14:00","date_gmt":"2024-11-05T17:14:00","guid":{"rendered":"https:\/\/www.rocworks.at\/wordpress\/?p=1483"},"modified":"2024-11-05T12:17:02","modified_gmt":"2024-11-05T10:17:02","slug":"replicate-and-archive-data-from-a-mqtt-broker-to-monstermq","status":"publish","type":"post","link":"https:\/\/www.rocworks.at\/wordpress\/?p=1483","title":{"rendered":"Replicate and Archive Data from a MQTT Broker to MonsterMQ"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2024\/11\/image-1.webp\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2024\/11\/image-1.webp\" alt=\"\" class=\"wp-image-1485\" srcset=\"https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2024\/11\/image-1.webp 1024w, https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2024\/11\/image-1-300x300.webp 300w, https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2024\/11\/image-1-150x150.webp 150w, https:\/\/www.rocworks.at\/wordpress\/wp-content\/uploads\/2024\/11\/image-1-768x768.webp 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>Here\u2019s a straightforward example of how data replication can be achieved using the Frankenstein Automation-Gateway.com to transfer data from a remote broker to a local MonsterMQ Broker. <\/p>\n\n\n\n<p>The local MonsterMQ Broker is configured so that data is stored in TimescaleDB to maintain a historical record. This process converts the current state of the UNS into archived historical data. <\/p>\n\n\n\n<p>It will also create a Frankenstein OPC UA Server, allowing you to access the data from the MQTT broker. However, since we have it data-agnostic, all the data in the OPC UA Server will be available as a string data type.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Monster.yaml<\/h2>\n\n\n\n<p>Create a file monster.yaml with this content :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>TCP: 1883 \nWS: 1884\nSSL: false\nMaxMessageSizeKb: 64\nQueuedMessagesEnabled: false\n\nSessionStoreType: POSTGRES\nRetainedStoreType: POSTGRES\n\nArchiveGroups:\n  - Name: \"source\"\n    Enabled: true\n    TopicFilter: &#91; \"source\/#\" ]\n    RetainedOnly: false\n    LastValType: NONE\n    ArchiveType: POSTGRES\n\nPostgres:\n  Url: jdbc:postgresql:\/\/timescale:5432\/postgres\n  User: system\n  Pass: manager<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Frankenstein.yaml<\/h2>\n\n\n\n<p>Create a file frankenstein.yml with this content and adapt the Host of the soruce broker and the Topic paths which you want to replicate from the source to your local MonsterMQ Broker.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Servers:\n  OpcUa:\n    - Id: \"opcsrv\"\n      Port: 4840\n      EndpointAddresses:\n        - linux0 # Change this to your hostname!\n      Topics:\n        - Topic: mqtt\/source\/path\/Enterprise\/Dallas\/#\nDrivers:\n  Mqtt:\n    - Id: \"source\"\n      Enabled: true\n      LogLevel: INFO\n      Host: test.monstermq.com # Change this to your source MQTT Broker!\n      Port: 1883\n      Format: Raw\nLoggers:\n  Mqtt:\n    - Id: \"source\"\n      Enabled: true\n      LogLevel: INFO\n      Host: 172.17.0.1\n      Port: 1883\n      Format: Raw\n      BulkMessages: false\n      LogLevel: INFO\n      Logging:\n        - Topic: mqtt\/source\/path\/Enterprise\/Dallas\/#<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Docker Compose<\/h2>\n\n\n\n<p>Create a docker-compose.yaml file with this content and then start it with docker-compose up -d<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>services:\n  timescale:\n    image: timescale\/timescaledb:latest-pg16\n    container_name: timescale\n    restart: unless-stopped\n    ports:\n      - \"5432:5432\"\n    volumes:\n      - timescale_data:\/var\/lib\/postgresql\/data\n    environment:\n      POSTGRES_USER: system\n      POSTGRES_PASSWORD: manager\n  monstermq:\n    image: rocworks\/monstermq:latest\n    container_name: monstermq\n    restart: unless-stopped\n    ports:\n      - 1883:1883\n      - 1884:1884\n    volumes:\n      - .\/log:\/app\/log\n      - .\/monster.yaml:\/app\/config.yaml\n    command: &#91;\"+cluster\", \"-log FINE\"]\n  frankenstein:\n    image: rocworks\/automation-gateway:1.37.1\n    container_name: frankenstein\n    restart: always\n    ports:\n      - 1885:1883\n      - 4840:4840\n    environment:\n      JAVA_OPTS: '-Xmx1024m'\n    volumes:\n      - .\/frankenstein.yaml:\/app\/config.yaml\n      - .\/security:\/app\/security\nvolumes:\n  timescale_data:      <\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here\u2019s a straightforward example of how data replication can be achieved using the Frankenstein Automation-Gateway.com to transfer data from a remote broker to a local MonsterMQ Broker. The local MonsterMQ Broker is configured so that data is stored in TimescaleDB to maintain a historical record. This process converts the current state of the UNS into &hellip; <a href=\"https:\/\/www.rocworks.at\/wordpress\/?p=1483\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Replicate and Archive Data from a MQTT Broker to MonsterMQ<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39,79],"tags":[54],"class_list":["post-1483","post","type-post","status-publish","format-standard","hentry","category-frankenstein","category-monstermq","tag-mqtt"],"_links":{"self":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1483","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1483"}],"version-history":[{"count":3,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1483\/revisions"}],"predecessor-version":[{"id":1488,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/1483\/revisions\/1488"}],"wp:attachment":[{"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1483"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1483"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rocworks.at\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1483"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}