7

I ran redis using Docker like so:

docker run  --rm -p '6379:6379' -v "$redis_data_dir:/data" --name my_redis_server -d redis redis-server --appendonly 'yes'

in the past this worked fine, but now I get this error:

{ ReplyError: ERR DB index is out of range
    at parseError (/root/interos/repos/ntrs-cli/node_modules/redis-parser/lib/parser.js:179:12)
    at parseType (/root/interos/repos/ntrs-cli/node_modules/redis-parser/lib/parser.js:302:14)

command: { name: 'select', args: [ '20127' ] } }

It looks like it's trying to connect to db 20127, I am certain it's one of these four:

const client_db0 = new Redis(`redis://${conf["platform-build.public-dns"]}:6379/0`);
const client_db1 = new Redis(`redis://${conf["platform-build.public-dns"]}:6379/1`);
const client_db2 = new Redis(`redis://${conf["platform-build.public-dns"]}:6379/2`);
const client_db3 = new Redis(`redis://${conf["platform-build.public-dns"]}:6379/3`);

so is there some way to start redis up and tell it to add more databases? something like:

docker run  .... redis redis-server --appendonly 'yes' --db-count=16

4 Answers4

9

in file etc/redis/redis.conf change line databases 16 (by default, it has 16), most likely you need more than 16

by default, each DB index is responsible for 8 or 10 databases (don't remember), so by default you use only 2 indexes (0 and 1)

3

The SELECT command is used to pick which database you're using. 20127 is way beyond your configured limit of 16.

Either change databases in /etc/redis.conf to be higher, which is probably a bad idea for very large values like 20K, or pick a value in the range 0..15.

If you're not sure where 20127 is coming from, track it down in the originating code or configuration.

tadman
  • 208,517
  • 23
  • 234
  • 262
1

It was due to the extra whitespace that I had here:

 'platform-build.public-dns': ' 127.0.0.1'

Maybe the parser could be improved?

tadman
  • 208,517
  • 23
  • 234
  • 262
  • It's usually not the job of the config tool to trim extraneous spaces, so it's just garbage-in, garbage-out. – tadman Sep 26 '19 at 18:21
  • Could throw a parsing error tho, instead of completely misinterpreting it –  Sep 26 '19 at 18:51
0

When i stop my docker environment and execute

docker volume prune

Error ERR DB index is out of range (Redis::CommandError) dissapears.

Sergio Belevskij
  • 2,478
  • 25
  • 24