diff --git a/README.md b/README.md index a87a7c4..6008add 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,8 @@ var status = require('pomelo-status-plugin'); app.use(status, {status: { host: '127.0.0.1', - port: 6379 + port: 6379, + db: 1, }}); ``` @@ -75,6 +76,7 @@ var mysqlStatusManager = require('./mysqlStatusManager'); app.use(status, {status: { host: '127.0.0.1', port: 6379, + db: 1, channelManager: mysqlStatusManager }}); @@ -85,6 +87,7 @@ in >=0.0.3 version add cleanOnStartUp option, when you enable this option, statu app.use(status, {status: { host: '127.0.0.1', port: 6379, + db: 1, cleanOnStartUp: true }}); diff --git a/lib/manager/statusManager.js b/lib/manager/statusManager.js index 492a2ae..b91a838 100644 --- a/lib/manager/statusManager.js +++ b/lib/manager/statusManager.js @@ -19,6 +19,12 @@ StatusManager.prototype.start = function(cb) { if (this.opts.auth_pass) { this.redis.auth(this.opts.auth_pass); } + var db = this.opts.db || 0; + this.redis.select(db, function (err) { + if (!!err) { + console.error("[status-plugin][redis]" + err.stack); + } + }); this.redis.on("error", function (err) { console.error("[status-plugin][redis]" + err.stack); });