chovy
chovy

Reputation: 75864

Express redis session store stopped working on new machine

I installed redis, and can connect to it, but the session doesn't persist and nothing shows up. I have not changed any of my code, except for upgrading to node 0.8.15 instead of 0.8.6

  var RedisStore = require('connect-redis')(express);

  app.use(express.session({
    store: new RedisStore({
      host: cfg.redis.host,
      db: cfg.redis.db
    }),
    secret: 'meow'
  }));


//after login:
      req.session.userid = user._id;

I had to re-install redis and I'm pretty sure I didn't do this correctly on debian. The code works fine on another server. I can run redis-cli and connect to the db, but there are no keys. I have debugging enabled, but don't see anything obvious.

Upvotes: 0

Views: 959

Answers (1)

chovy
chovy

Reputation: 75864

I was using debian version of redis, this won't work. I had to install 2.6.6 fully, specifically running ./utils/install_server.sh

Incidentally, there is a bug with their script:

sudo update-rc.d -f mongodb defaults
update-rc.d: using dependency based boot sequencing
insserv: warning: script 'K01redis_6379' missing LSB tags and overrides
insserv: warning: script 'redis_6379' missing LSB tags and overrides

You need to add the following code to the top of /etc/init.d/redis_6379

# chkconfig: - 58 74
# description: redis_6379 is the redis daemon.
### BEGIN INIT INFO
# Provides: redis_6379
# Required-Start:    $network $remote_fs $local_fs 
# Required-Stop:     $network $remote_fs $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: start and stop redis_6379
# Description: Redis daemon
### END INIT INFO

I filed a bug here: https://github.com/antirez/redis/issues/804

Upvotes: 2

Related Questions