-
-
Notifications
You must be signed in to change notification settings - Fork 507
Does mosca support clustered Redis? #509
Comments
BTW, mosca can initialize and connect to the clustered Redis correctly. Ths exception thrown when a client tried to connect to it. |
Between v1 and v2 the format of data on Redis changed from JSON to msgpack.
|
The DB is clean. I got this issue on a brand new Redis cluster. |
that error means there is some data in there that Mosca cannot parse. You might want to put a logline in there to see what's going on, and which key it is, and what content it has. |
I added two lines in lib/persistence/redis.js in RedisPersistence.prototype._cleanClient function: this._client.get(key, function(err, subs) { Not sure if I log this correctly. Below please find the detail log: {"pid":22323,"hostname":"vincent-devbox","name":"mosca","level":20,"msg":"setting keepalive timeout","time":1467135884667,"timeout":90000,"client":"mosqsub/22329-vincent-d","v":1} SyntaxError: Unexpected token u in JSON at position 0 Thanks a lot for your prompt responses! |
Are you trying to clean a clean=true client? What is your client code? |
I'm using mosquitto_sub/mosquitto_pub for testing. $ mosquitto_sub -h localhost -p 1883 -t "mqtt/test" -d BTW, I got the same error for mosquitto_pub |
Any update on this one ? I have the exact same issue using AWS elasticache with cluster mode enabled. Also note that I override update : Actually constructing a According to redis/ioredis#175 it's not something to be used in cluster mode. |
@jeanadrien I have little time to add the support for this. But I would be very happy to review and merge a PR. |
@mcollina sure, if I manage to have a working solution, I'll send you a patch. |
@mcollina ,any updates on this. I am facing the same issue as above while connecting to clustered redis with AWS elastic cache . While starting Mosca server getting below error ,but server able to run. Unhandled rejection ReplyError: ERR SELECT is not allowed in cluster mode But while connecting to server from client ,getting below error. SyntaxError: Unexpected token u in JSON at position 0 ,The same issue is happening with Aedes also. |
Code does not write itself, and currently Mosca does not support Redis cluster. Feel free to step in. For Aedes, there is moscajs/aedes-persistence-redis#6 |
Before v2.0.x, I knew that mosca didn't support clustered Redis. I'm hoping this can be solved by changing the redis driver to ioredis. However, I am still having problems using clustered Redis.
Error messages:
{"pid":2765,"hostname":"vincent-devbox","name":"mosca","level":30,"msg":"server started","time":1466722028912,"mqtt":1883,"v":1}
/home/vincent.peng/git/infra/mosca/node_modules/bluebird/js/main/async.js:43
fn = function () { throw arg; };
^
SyntaxError: Unexpected token u in JSON at position 0
at Object.parse (native)
at /home/vincent.peng/git/infra/mosca/lib/persistence/redis.js:301:17
at tryCatcher (/home/vincent.peng/git/infra/mosca/node_modules/bluebird/js/main/util.js:26:23)
at Promise.errorAdapter (/home/vincent.peng/git/infra/mosca/node_modules/bluebird/js/main/nodeify.js:36:34)
at Promise._settlePromiseAt (/home/vincent.peng/git/infra/mosca/node_modules/bluebird/js/main/promise.js:579:21)
at Promise._settlePromises (/home/vincent.peng/git/infra/mosca/node_modules/bluebird/js/main/promise.js:697:14)
at Async._drainQueue (/home/vincent.peng/git/infra/mosca/node_modules/bluebird/js/main/async.js:123:16)
at Async._drainQueues (/home/vincent.peng/git/infra/mosca/node_modules/bluebird/js/main/async.js:133:10)
at Immediate.Async.drainQueues as _onImmediate
at tryOnImmediate (timers.js:543:15)
at processImmediate as _immediateCallback
It seems that in lib/persistence/redis.js:301, the subs is undefined.
Any suggestion?
The text was updated successfully, but these errors were encountered: