Coder Social home page Coder Social logo

xiaoxinpro / mqttgolisten Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 31 KB

MqttGoListen是一款基于Golang开发的MQTT订阅监听并写入数据库的工具,支持 MQTT 3.1 和 MQTT 3.1.1,支持Mysql、Postgres、Sqlite、Memory数据库。

License: GNU General Public License v3.0

Go 100.00%
go golang memory mqtt mysql postgres sqlite

mqttgolisten's Introduction

MqttGoListen

MqttGoListen是一款基于Golang开发的MQTT订阅监听并写入数据库的工具,支持 MQTT 3.1 和 MQTT 3.1.1,支持Mysql、Postgres、Sqlite、Memory数据库。

开发状态

目前MqttGoListen处于开发初期,主要应用于测试环境,不建议部署在生产环境中。

因此配置文件可能因版本不同而不兼容,请阅读指定版本的配置文档。

  • master 分支属于开发版本(稳定性没有经过验证,不提供二进制文件)
  • release 版本为经测试稳定的版本(建议下载最新的 release 版本部署)

Docker版本将待功能基本稳定后进行开发。

部署说明

MqttGoListen 采用 应用程序 + 配置文件 的方式启动,因此配置文件再部署过程中是不可或缺的,关于配置文件的详情请参考 配置文件 章节。

二进制文件部署

首先在 Release 页面下载最新二进制文件,需要根据部署系统选择相应的架构二进制文件。

然后在项目创建一个 config.ini 文件

DbType="sqlite"
DbPath="./db.sqlite"
[test_mqtt]
Host="iot.eclipse.org"
Port=1883

最后启动监听程序

./MqttGoListen -c config.ini

配置文件

目前配置文件只采用ini的格式,其中

  • 默认分区 为全局配置项,如数据库配置等。
  • 自定义分区 为MQTT配置项,分区名自定义但不能重复。

全局配置

全局配置必须放在默认分区,否则将被忽略执行。

备注
DbType string 数据库类型(sqlite,mysql,postgre,memory)
DbHost string 数据库主机,仅mysql,postgre需要此项
DbPort int(0-65535) 数据库端口号,仅mysql,postgre需要此项
DbName string 数据库名称,仅mysql,postgre需要此项
DbUsername string 数据库用户名,仅mysql,postgre需要此项
DbPassword string 数据库密码,仅mysql,postgre需要此项
DbPath string 数据库文件路径,仅sqlite需要此项

MQTT配置

备注
Table string 数据库表名,默认为配置分区名称
Host string MQTT主机地址,必填
Port int(0-65535) MQTT端口号,默认为1883
ClientId string MQTT客户端ID,默认为随机字符串
IsCleanSession bool MQTT会话清除,默认为true
IsLogin bool MQTT用户名密码登录,默认为false
Username string MQTT用户名,只有IsLogintrue时有效
Password string MQTT密码,只有IsLogintrue时有效
SubTopic string 订阅主题,默认为#
SubQos int(0-2) 订阅主题的Qos,取值范围(0,1,2),默认为0

mqttgolisten's People

Contributors

xiaoxinpro avatar

Watchers

 avatar

Forkers

riobotz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.