How to run Redis 3.2

redis

#1

Hi folks,

How can I run Redis 3.2 in Circle? I need it because of the geo* commands.

Read some tips on downloading/compiling it manually here, but trying these out I’m running into issues as the new server apparently conflicts with the Redis provisioned automatically by Circle (3.0.7).

My circle.yml:

machine:
  environment:
    REDIS_URL: redis://localhost:6391
dependencies:
  pre:
    - wget http://download.redis.io/releases/redis-3.2.0.tar.gz
    - tar xzf redis-3.2.0.tar.gz
    - cd redis-3.2.0 && make
  cache_directories:
    - redis-3.2.0
test:
  pre:
    - sudo service redis-server start --port 6391

That pre step fails like:

sudo service redis-server start --port 6391
/var/run/redis-server.pid exists, process is already running or crashed

I tried restarting the server to see if it would reboot with the newer version but that doesn’t seem to do it.

Any ideas?

Thanks!


#2

Does redis have a docker image? If so I think that might be the easiest way to get a newer version running. You can either run it on a different port, or kill redis after the container starts to use the same port.


#3

Hmm ended up just fiddling around a bit more with this and got this to work:

machine:
  environment:
    REDIS_URL: redis://localhost:6391
dependencies:
  pre:
    - wget http://download.redis.io/releases/redis-3.2.0.tar.gz
    - tar xzf redis-3.2.0.tar.gz
    - cd redis-3.2.0 && make
  cache_directories:
    - redis-3.2.0
test:
  pre:
    - sudo service redis-server stop
    - ./redis-3.2.0/src/redis-server --port 6391 --daemonize yes

#4

Still not 100%, getting occasional failures like:

Error connecting to Redis on localhost:6391

I suspect it’s because the new Redis didn’t finish booting (or just didn’t boot properly), but wasn’t able to tweak the redis-server call to address this yet :{


#5

Just to update this for anyone else looking to get redis 3.2 running on CircleCI.

Our 14.04 image has Redis 2.8.4 preinstalled (https://circleci.com/docs/build-image-trusty/#redis), so if that’s new enough you’d just need to add the following to circle.yml:

machine:
  services:
    - redis

To get 3.2 running, keep the above ‘machine’ section and add:

dependencies:
  pre:
    - sudo service redis-server stop
    - >
      cd ~ && if [ ! -d "redis-3.2.5" ]; then
        wget http://download.redis.io/releases/redis-3.2.5.tar.gz
        tar xzf redis-3.2.5.tar.gz
        cd redis-3.2.5 && make;
      fi
    - cd ~/redis-3.2.5 && sudo make install
    - sudo sed -i 's/bin/local\/bin/g' /etc/init/redis-server.conf
    - sudo service redis-server start
  cache_directories:
    - ~/redis-3.2.5

Installing redis this way should allow it to run more reliably in our environment and the installation will be cached so the process will only add a couple of seconds to your build after the initial installation.


#6

docker:
- image: redis


#7

This is correct now, the original posts were regarding the old platform. In 2.0 running redis (along with any other database service) is a breeze thanks to docker.


#8

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.