Data Source
RobustMQ MQTT supports multiple data sources for authentication, authorization, and blacklist data.
What Is a Data Source
A data source is where identity and policy data comes from:
- users
- ACL rules
- blacklist entries
Broker loads these data sets and uses them in the connection auth and access-control path.
Why Multiple Data Sources
- Different teams already store identity data in different systems.
- Some scenarios prefer built-in metadata, others require external system integration.
- It enables gradual migration: start built-in, move to external sources when needed.
- It avoids hard-binding to a single storage model.
How to Use
Typical steps:
- Configure
storage_typethrough the management console or CLI. - Fill the matching config block (for example
mysql_config,redis_config,mongodb_config). - For SQL-based sources, configure queries and ensure result mappings match expected contracts.
- Validate auth result and cache sync behavior after startup.
Runtime Principle
The auth path is cache-first, with different update strategies per source:
- CONNECT auth checks in-memory cache first.
- Built-in data source (Meta Service) updates cache in real time (no delay).
- External data sources (MySQL/PostgreSQL/Redis/MongoDB/HTTP) update cache by periodic sync.
- External sources are used for sync/management, not queried on every CONNECT.
By moving the hot path to memory, broker remains stable under connection bursts.
By default, external source sync has around a 5-second delay; built-in source does not.
Currently Supported Data Sources
- Built-in Data Source (Meta Service)
- MySQL
- PostgreSQL
- Redis
- MongoDB
- HTTP
Design Goals
- No forced fixed table schema.
- SQL/query-driven adaptation for existing systems.
- Cache-first auth hot path with manageable consistency trade-offs.
