-
Notifications
You must be signed in to change notification settings - Fork 24
Redis Settings
Redis database is mandatory for mithqtt. Client's session state, subscriptions, in-flight messages and etc are persisted in redis. Both mithqtt broker and mithqtt http requires redis database. Redis version 2.8.x, 3.0.x are supported at the moment.
Install and config redis database as standalone server. Standalone means there will be no fail-over, if your redis server goes offline new incoming messages will be dropped, if your redis server is broken data maybe lost. So standalone setup is not recommended for production enviroment.
Mithqtt broker and http use redis.properties to config redis database. For the standalone setup, you need config settings below:
The implementation class name should be RedisSyncSingleStorage.
# Storage implementation (full qualified class name)
storage.sync.class = com.github.longkerdandy.mithqtt.storage.redis.sync.RedisSyncSingleStorage
The redis server type should be single.
redis.type = single
Set the correct redis server address, it should be a single IP address.
redis.address = 192.168.0.10:6379
Set the redis database number, 0 is the default database.
redis.database = 0
Set the redis server password, leave blank if you didn't config redis password.
redis.password =
Install and config redis database as master-slave replication servers. Master-Slave setup has no automatic fail-over, if your master server goes offline, you have to manually switch to your replication server, however persisted data will not lost. Master-Slave setup is acceptable for production enviroment.
Mithqtt broker and http use redis.properties to config redis database. For the master-slave setup, you need config settings below:
The implementation class name should be RedisSyncMasterSlaveStorage.
# Storage implementation (full qualified class name)
storage.sync.class = com.github.longkerdandy.mithqtt.storage.redis.sync.RedisSyncMasterSlaveStorage
The redis server type should be master_slave.
redis.type = master_slave
Set the correct redis master and slave server addresses, the first one should be the master IP address. Slave server addresses are optional.
redis.address = 192.168.0.10:6379,192.168.0.11:6379
Set the redis database number, 0 is the default database.
redis.database = 0
Set the redis server password, leave blank if you didn't config redis password.
redis.password =
You can tweak redis read from setting, but make sure you understand both advantage and disadvantage.
redis.read = master
Install and config redis database as master-slave with sentinel. Sentinel setup has automatic fail-over, if your master server goes offline, one of the slave server will be promoted to master server, no data will lost. Sentinel setup is recommended for production enviroment.
Mithqtt broker and http use redis.properties to config redis database. For the sentinel setup, you need config settings below:
The implementation class name should be RedisSyncSentinelStorage.
# Storage implementation (full qualified class name)
storage.sync.class = com.github.longkerdandy.mithqtt.storage.redis.sync.RedisSyncSentinelStorage
The redis server type should be sentinel.
redis.type = sentinel
Set the correct sentinel server addresses, not the redis server addresses.
redis.address = 192.168.0.20:26379,192.168.0.21:26379
Set the redis database number, 0 is the default database.
redis.database = 0
Set the redis server password, leave blank if you didn't config redis password.
redis.password =
Set the sentinel master group name
redis.master = mqtt
You can tweak redis read from setting, but make sure you understand both advantage and disadvantage.
redis.read = master
Install and config redis database as cluster, only redis 3.0 above support cluster mode. Cluster setup has automatic fail-over, there will be no single point failure, and combined with slave servers to prevent data loss. Cluster setup provided better performance and is recommended for production enviroment.
Mithqtt broker and http use redis.properties to config redis database. For the cluster setup, you need config settings below:
The implementation class name should be RedisSyncClusterStorage.
# Storage implementation (full qualified class name)
storage.sync.class = com.github.longkerdandy.mithqtt.storage.redis.sync.RedisSyncClusterStorage
The redis server type should be cluster.
redis.type = cluster
Set the correct redis master server addresses, Slave server addresses are optional.
redis.address = 192.168.0.10:6379,192.168.0.12:6379
Set the redis database number, 0 is the default database.
redis.database = 0
Set the redis server password, leave blank if you didn't config redis password.
redis.password =
You can tweak redis read from setting, but make sure you understand both advantage and disadvantage.
redis.read = master