2

i have a question here..

i already install redis-server on my CentOS vps for my wordpress frontend cache.. but i have a little problem here..

sometimes my redis-server was closed/disconnected suddenly, and i must have to restart it manually using command

/etc/init.d/redis-server start

my question is..

how to auto start the redis-server if my redis-server down or crashed suddenly..

i install redis using this tutorial http://www.saltwebsites.com/2012/install-redis-245-service-centos-6

great thanks before

Wawan Brutalx
  • 603
  • 6
  • 15
  • 27

3 Answers3

2

how to auto start the redis-server if my redis-server down or crashed suddenly

Try to look at tools like upstart or monit which can be used to respawn redis if it dies unexpectedly.

yojimbo87
  • 65,684
  • 25
  • 123
  • 131
2

If you use docker with docker-compose:

version: '3'

services:
  redis:
    container_name: "redis"
    image: redis:5.0.3-alpine
    command: ["redis-server", "--appendonly", "yes"]
    hostname: redis
    ports:
      - "6339:6379"
    volumes:
      - /opt/docker/redis:/data
    restart:
      always

look at the last line: restart: always

Cletrix
  • 403
  • 5
  • 11
0

I Don't know exactly with centos with linux

sudo systemctl enable redis_6379

The above worked like charm ,The above will create a symlink in /etc/systemd/system/redis_6379.service.

Rangeesh
  • 361
  • 1
  • 13