loopbackio / loopback-connector-redis

EXPERIMENTAL: Redis connector for LoopBack.
http://loopback.io/doc/en/lb2/Redis-connector.html
Other
36 stars 46 forks source link

`database` will cause error #21

Closed geminiyellow closed 8 years ago

geminiyellow commented 8 years ago

i create a config file datasources.local.js

module.exports = {
  redis: {
    connector: "redis",
    database: "redisdb",
    host: process.env.REDIS_PORT_6379_TCP_ADDR,
    port: process.env.REDIS_PORT_6379_TCP_PORT
  }
}

then i got a error:

/app/user$ node .
Web server listening at: http://0.0.0.0:3000
Browse your REST API at http://0.0.0.0:3000/explorer
Connection fails:  Error: ERR invalid DB index
    at Error (native)
    at HiredisReplyParser.execute (/app/user/node_modules/loopback-connector-redis/node_modules/redis/lib/parser/hiredis.js:30:33)
    at RedisClient.on_data (/app/user/node_modules/loopback-connector-redis/node_modules/redis/index.js:547:27)
    at Socket.<anonymous> (/app/user/node_modules/loopback-connector-redis/node_modules/redis/index.js:102:14)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:172:18)
    at Socket.Readable.push (_stream_readable.js:130:10)
    at TCP.onread (net.js:542:20)
It will be retried for the next request.
/app/user/node_modules/loopback-connector-redis/node_modules/redis/index.js:575
                throw callback_err;
                ^

Error: ERR invalid DB index
    at Error (native)
    at HiredisReplyParser.execute (/app/user/node_modules/loopback-connector-redis/node_modules/redis/lib/parser/hiredis.js:30:33)
    at RedisClient.on_data (/app/user/node_modules/loopback-connector-redis/node_modules/redis/index.js:547:27)
    at Socket.<anonymous> (/app/user/node_modules/loopback-connector-redis/node_modules/redis/index.js:102:14)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:172:18)
    at Socket.Readable.push (_stream_readable.js:130:10)
    at TCP.onread (net.js:542:20)

then i remove database key, the error gone.

geminiyellow commented 8 years ago

seems the max index is 15, so there 16 DBs(0 - 15) can be used by default. how to config index in loopback?

superkhau commented 8 years ago

You can configure indexes via https://docs.strongloop.com/display/public/LB/Model+definition+JSON+file#ModeldefinitionJSONfile-Indexes

Are you still running into issues? Can I close this? Or Can you provide a sample repo to reproduce the issue?

superkhau commented 8 years ago

Gonna close this as abandoned. @geminiyellow Feel free to ping if you're still running into this issue and we can reopen it then.