Failed to start Redis Datastore Server (Ubuntu 16.04.1 LTS)

60,709

Solution 1

I had the same issue and could not find a working solution anywhere. After some searching, the following fix worked for me ( Ubuntu 16.04 )

In /etc/systemd/system/redis.service add the following under the [Service] section.

Type=forking

Solution 2

Open your service using whatever editor.

vim /etc/systemd/system/redis.service

Look at your [Service] section at ExecStart mine was:

ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf

Run this command to see what errors are occuring. Mine responded with this:

 Fatal error, can't open config file '/etc/redis/redis.conf'

So I just updated that line to this (where my actual config file was)

ExecStart=/usr/local/bin/redis-server /etc/redis/6379.conf

Which is where redis quickstart places it by default... :)

Solution 3

In my case , the log directory (/var/log/redis) which I mention in /etc/redis/redis.conf file was not present

How I find the error

Try

/usr/local/bin/redis-server /etc/redis/redis.conf

This is same command present in my /etc/systemd/system/redis.service file

ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf

Solution

1) Create the log directory

sudo mkdir -p /var/log/redis

2) Give proper access to create and write logs

sudo chown redis:redis /var/log/redis

Try to start the service again

sudo service redis-server start 

or

sudo service redis start

Solution 4

redis.service file is missing in "/etc/systemd/system/" directory

sudo nano /etc/systemd/system/redis.service

then copy and paste these lines

[Unit]
Description=Redis In-Memory Data Store
After=network.target

[Service]
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always

[Install]
WantedBy=multi-user.target

save and close this file

next modify the directory permisssions

$ sudo adduser --system --group --no-create-home redis
$ sudo chown redis:redis /var/lib/redis
$ sudo chmod 770 /var/lib/redis

next start the redis server

$ sudo systemctl start redis

check if its running now

$ sudo systemctl status redis

REFERENCE : https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-redis-on-ubuntu-16-04

Solution 5

I faced the same error. But for me the reason was totally different: It was due to a typo in my redis.conf file. Correcting that and doing sudo systemctl restart redis-server restarted redis instantly. It is misleading that same error is being thrown for this case also.

Share:
60,709

Related videos on Youtube

Kakashi
Author by

Kakashi

Updated on September 18, 2022

Comments

  • Kakashi
    Kakashi over 1 year

    i just installed redis and it doesnt work at all when trying to start service with command:

    sudo service redis-server start

    this is result of journalctl -xe:

    Subject: Unit redis-server.service has finished shutting down
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    -- 
    -- Unit redis-server.service has finished shutting down.
    Mar 02 13:22:46 aaa-notebook systemd[1]: redis-server.service: Start request repeated too quickly.
    Mar 02 13:22:46 aaa-notebook systemd[1]: Failed to start Redis Datastore Server.
    

    and this is the result of systemctl status redis-server.service:

     redis-server.service - Redis Datastore Server
     Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
     Active: inactive (dead) (Result: resources) since Kam 2017-03-02 13:22:46 WIB; 5min ago
     Process: 12120 ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCCESS)
    
    Mar 02 13:22:46 aaa-notebook systemd[1]: Failed to start Redis Datastore Server.
    Mar 02 13:22:46 aaaaa-notebook systemd[1]: redis-server.service: Unit entered failed state.
    Mar 02 13:22:46 aaa-notebook systemd[1]: redis-server.service: Failed with result 'resources'.
    Mar 02 13:22:46 aaa-notebook systemd[1]: redis-server.service: Service hold-off time over, scheduling restart.
    Mar 02 13:22:46 aaa-notebook systemd[1]: Stopped Redis Datastore Server.
    Mar 02 13:22:46 aaa-notebook systemd[1]: redis-server.service: Start request repeated too quickly.
    Mar 02 13:22:46 aaa-notebook systemd[1]: Failed to start Redis Datastore Server.
    
  • fpghost
    fpghost about 6 years
    Mine too, thanks! How did you discover to add this? What does it actually do?
  • Admin
    Admin over 3 years
    I do not see how this answer works with the question ...
  • Koushik Das
    Koushik Das about 3 years
    Thank you so much. I screwed myself up by deleting everything in the log file and I suffered so much and spent hours and hours fixing all the programs :D