登入

請登入已查看專屬折扣

忘記密碼?

始終保持最新狀態

使用我們的電子郵件,您將收到有關產品,活動,服務和Balluff的定期信息。

以公司名稱註冊

我們將確認貴公司是否已為現有客戶,並將公司資訊與網路商城的使用帳戶做連結。

註冊
產品範圍
服務支援
產業和解決方案
企業
版本 1.0
·
最後編輯於 2025-06-27

MQTT Broker Setup on CMTK

1. Prerequisites

1) SD Card Inserted

2) Docker Enabled

3) Portainer Setup

2. Setup Internet Access

  1. Conect LAN2 Port on the CMTK to your router
  2. Go to the "Netwrok Settings tab and set the LAN2 port as a DHCP client and press save.
  3. If wired and configured properly, the IP address information should be poplulated.you should be able to use the Ping Server to successfully ping the balluff.com URL.
  4. You should be able to use the "Ping Server" function to successfully ping balluff.com

3. Open Portainer

  1. Go to the "Settings Tab" --> Docker --> Open Portainer
  2. Input your credentials and login.  If this is the first time logging into portainer, it will prompt you to create a user name and password.

4. Create the MQTT Broker

  1. Once logged into Portainer, navigate to the "Stacks" tab.
  2. Create a Stack
    1. Give the stack a name.  It must be lowercase characters.  In this example, the name is "mqtt". 
    2. Select "Web editor" as the build method
    3. Copy and paste the following into the web editor.  You can change the port numbers if you would like to, in this example it is set to "50008:50008"
      1. services:

          mosquitto:

            image: eclipse-mosquitto:latest

            container_name: MQTT_Broker

            ports:

              - "50008:50008"

            volumes:

              - mosquitto_config:/mosquitto/config

              - mosquitto_data:/mosquitto/data

              - mosquitto_log:/mosquitto/log

            restart: always

        volumes:

          mosquitto_config:

          mosquitto_data:

          mosquitto_log:

  3. Click "Deploy the Stack"
  4. Go to the "Volumes" tab and confirm the volumes were created.  There should be a total of three (log, config, and data).
  5. Go to the "Containers" tab.  There should be a newly created container running with the name "MQTT_Broker".  Under the Quick Actions column, click on the "Exec Console" command.
  6. Select " /bin/sh" as the command and click "Connect"
  7. Input the following commands:
    1. Change Directory
      1. cd/mosquitto/config
    2. Allow listener on the port (50008 for this example)
      1. echo "listener 50008" > mosquitto.conf
    3. Do not allow anonymous connection
      1. echo "allow_anonymous false >> mosquitto.conf
    4. Create a password file
      1. echo "password_file /mosquitto/config/passwordfile" >> mosquitto.conf 
    5. Set your username
      1. mosquitto_passwd -c passwordfile admin
      2.  I am using admin as the username.  If you would like to change the name, modify the end of the command by changing admin to your desired name.
      3. Once you hit enter, it will prompt you to enter a password and then prompt you to re-enter the password for confirmation.  When entering the password, the characters will not display on the screen.
    6. Command to confirm config settings
      1. cat mosquitto.conf
    7. You can also set the allow anonymous to true instead of false, which will make it where a username and password does not need to be input to access the broker.  If setting this to true, you do not need to run the "mosquitto_passwd -c passwordfile admin" command.
      1. echo "allow_anonymous true" >> mosquito.conf
    8.  
      1. cd /mosquitto/config
  8.  Go back to the "Containers" tab to stop the container and then start it again.  This will allow for the configuration setting done in the previous step to take effect.
    1. Stop the container
    2. After stopping the container, start it back.
  9. You can now use the MQTT broker to store data from a MQTT device.
Energy consumption labeling
Energy consumption labeling

EPREL - European Product Database for Energy Labeling

免費樣品產品

為了將免費樣品產品添加到購物車,我們需要從購物車中刪除所有正常產品。你確定你要繼續嗎