Search code examples
serverredisubuntu-16.04redis-server

Why my redis-server is inactive - Ubunut 16.04


I have installed Redis and Redis server on my ubuntu machine but the problem is that they both are not ACTIVE at once.

Command: root@muhammad-mohsin:/# systemctl status redis.service

Installation using: Digital Oceans

● redis.service - Redis In-Memory Data Store
   Loaded: loaded (/etc/systemd/system/redis.service; enabled; vendor preset: enabled)
   Active: active (running) since Wed 2018-02-21 22:53:42 PKT; 5s ago
  Process: 12113 ExecStop=/usr/local/bin/redis-cli shutdown (code=exited, status=0/SUCCESS)
 Main PID: 12115 (redis-server)
   CGroup: /system.slice/redis.service
           └─12115 /usr/local/bin/redis-server 127.0.0.1:6379       

Feb 21 22:53:42 muhammad-mohsin redis-server[12115]:   `-._    `-._`-.__.-'_.-'    _.-'
Feb 21 22:53:42 muhammad-mohsin redis-server[12115]:       `-._    `-.__.-'    _.-'
Feb 21 22:53:42 muhammad-mohsin redis-server[12115]:           `-._        _.-'
Feb 21 22:53:42 muhammad-mohsin redis-server[12115]:               `-.__.-'
Feb 21 22:53:42 muhammad-mohsin redis-server[12115]: 12115:M 21 Feb 22:53:42.620 # WARNING: The TCP backlog setting of 511 cannot be enforced bec
Feb 21 22:53:42 muhammad-mohsin redis-server[12115]: 12115:M 21 Feb 22:53:42.620 # Server initialized
Feb 21 22:53:42 muhammad-mohsin redis-server[12115]: 12115:M 21 Feb 22:53:42.620 # WARNING overcommit_memory is set to 0! Background save may fai
Feb 21 22:53:42 muhammad-mohsin redis-server[12115]: 12115:M 21 Feb 22:53:42.620 # WARNING you have Transparent Huge Pages (THP) support enabled 
Feb 21 22:53:42 muhammad-mohsin redis-server[12115]: 12115:M 21 Feb 22:53:42.620 * DB loaded from disk: 0.000 seconds
Feb 21 22:53:42 muhammad-mohsin redis-server[12115]: 12115:M 21 Feb 22:53:42.620 * Ready to accept connections

Command: root@muhammad-mohsin:/# systemctl status redis-server.service

Installation using: apt-get install redis-server

● redis-server.service - Advanced key-value store
   Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/redis-server.service.d
           └─redis.override.conf
   Active: inactive (dead) (Result: exit-code) since Wed 2018-02-21 22:53:12 PKT; 1min 2s ago
     Docs: http://redis.io/documentation,
           man:redis-server(1)
 Main PID: 16461 (code=exited, status=0/SUCCESS)

Feb 21 22:53:11 muhammad-mohsin systemd[1]: Failed to start Advanced key-value store.
Feb 21 22:53:11 muhammad-mohsin systemd[1]: redis-server.service: Unit entered failed state.
Feb 21 22:53:11 muhammad-mohsin systemd[1]: redis-server.service: Failed with result 'exit-code'.
Feb 21 22:53:12 muhammad-mohsin systemd[1]: redis-server.service: Service hold-off time over, scheduling restart.
Feb 21 22:53:12 muhammad-mohsin systemd[1]: Stopped Advanced key-value store.
Feb 21 22:53:12 muhammad-mohsin systemd[1]: redis-server.service: Start request repeated too quickly.
Feb 21 22:53:12 muhammad-mohsin systemd[1]: Failed to start Advanced key-value store.

How to make both of them ACTIVE at the same time?

Also is there any difference in both of them?

Plus, what need to be installed on machine everytime? Redis or Redis Server?

And, why I am not able to access Redis in browser with api:port?

Please reply me with these questions as well.


Solution

  • "Redis" == "Redis Server". They mean the same thing. The difference is in version numbers and how these two installations are managed.

    The DigitalOcean guide has you compile and install redis from source, giving you the very latest version of redis (currently 4.0.8). It's a very manual approach and does not leave you with an automatic update mechanism. However, if you want any of the many features added to redis since the older version apt will install this is a fine choice. Just know you have to repeat the process for every update.

    The alternative is the other thing you did: sudo apt install redis-server. This tells Ubuntu's built in package manager, apt, to install redis version 3.0.6 which is pretty far behind the latest stable version: 4.0.8.

    Really, unless you are using advanced redis features and know you need 4.0 features, I'd suggest sticking with the apt version and disabling the manual one. You get rock solid stability and automatic security updates.

    If you really want to have two concurrently running servers, the issue is probably the port number. You need to have separate redis.conf files for each server. You can update the redis.service systemd file the DigitalOcean guide had you create to point to a different config file than /etc/redis/redis.conf for your manual installation. The files can be nearly identical but they will need to be configured to use different ports as well as a different storage locations.