3

I am trying to install redis on my AWS server. I have Ubuntu 18.04 installed on it. I am following steps to install redis from digitalocean article.

When i run sudo systemctl status redis command i am getting below error.

screenshot

I tried to edit /etc/systemd/system/redis.service file and added Type=forking under [Service] section but still getting the same error.

Can anyone suggest me how i can get it fixed?

Thanks in advance.

Developer
  • 43
  • 1
  • 8
  • Perhaps you could add the log file from the Redis server? It is usually located under `/var/log` – Itamar Haber Dec 03 '18 at 10:31
  • https://stackoverflow.com/questions/45776003/fixing-a-systemd-service-203-exec-failure-no-such-file-or-directory – Niloct Dec 04 '18 at 03:21
  • Thanks for your valuable replies @Niloct and Itamar Haber. After spending hours by myself, I finally get the installation done by hiring a person and its now working fine. – Developer Dec 04 '18 at 05:54
  • Hello, do you mind to share how to fix this? I have the same problem with you. I have been siting for almost 24h to fix just this problem :( – Anderson Koh Apr 26 '20 at 05:51

2 Answers2

1

Based on same digitalocean tutorial, actually it's running fine.

Run this command sudo systemctl restart redis.service, we get (showing "failed" on last line):

● redis.service - Redis In-Memory Data Store
   Loaded: loaded (/etc/systemd/system/redis.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2021-06-28 12:03:11 +03; 1min 0s ago
  Process: 20428 ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf (code=exited, status=
 Main PID: 20428 (code=exited, status=203/EXEC)

Jun 28 12:03:11 XYZ systemd[1]: redis.service: Service hold-off time over, scheduling restar
Jun 28 12:03:11 XYZ systemd[1]: redis.service: Scheduled restart job, restart counter is at 
Jun 28 12:03:11 XYZ systemd[1]: Stopped Redis In-Memory Data Store.
Jun 28 12:03:11 XYZ systemd[1]: redis.service: Start request repeated too quickly.
Jun 28 12:03:11 XYZ systemd[1]: redis.service: Failed with result 'exit-code'.
Jun 28 12:03:11 XYZ systemd[1]: Failed to start Redis In-Memory Data Store.

But if you run sudo service redis-server status, we get (showing "running" on 3rd line):

● redis-server.service - Advanced key-value store
   Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2021-06-28 11:50:13 +03; 19min ago
     Docs: http://redis.io/documentation,
           man:redis-server(1)
  Process: 19278 ExecStop=/bin/kill -s TERM $MAINPID (code=exited, status=0/SUCCESS)
  Process: 19371 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=0/SUCC
 Main PID: 19382 (redis-server)
    Tasks: 4 (limit: 4915)
   CGroup: /system.slice/redis-server.service
           └─19382 /usr/bin/redis-server 127.0.0.1:6379

Jun 28 11:50:13 XYZ systemd[1]: Starting Advanced key-value store...
Jun 28 11:50:13 XYZ systemd[1]: redis-server.service: Can't open PID file /var/run/redis/red
Jun 28 11:50:13 XYZ systemd[1]: Started Advanced key-value store.

After searching for hours, it seems like it's some difference between systemctl & service and nothing more, but the actual redis server is running fine. Corrects me if that's not the case. Here's the link: https://askubuntu.com/questions/903354/difference-between-systemctl-and-service-commands

You can even check if redis is working fine, by redis-cli ping, should print PONG

evilReiko
  • 19,501
  • 24
  • 86
  • 102
0

I also encountered this problem, then I tried to check it again. Finally, I found that when I authorized /var/lib/redis, I entered the wrong command, causing the redis account to have no access to /var/lib/redis.

sudo chown redis:redis /var/lib/redis
sudo systemctl restart redis

succeeded.

LuckyLikey
  • 3,504
  • 1
  • 31
  • 54
gorquan
  • 16