35

redis-server wont work in the server i have nginx, apache, php and mysql

is there any package can cause the problem below

PS: this error when i'm installing BBB

https://github.com/bigbluebutton/bbb-install

redis-server.service: Control process exited, code=exited status=1 Failed to start Advanced key-value store.

--
-- The result is failed.
Apr 05 12:28:44 ns3081715 systemd[1]: redis-server.service: Unit entered failed state.
Apr 05 12:28:44 ns3081715 systemd[1]: redis-server.service: Failed with result 'exit-code'.
Apr 05 12:28:44 ns3081715 systemd[1]: redis-server.service: Service hold-off time over, scheduling restart.
Apr 05 12:28:44 ns3081715 systemd[1]: Stopped Advanced key-value store.
-- 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.
Apr 05 12:28:44 ns3081715 systemd[1]: Starting Advanced key-value store...
-- Subject: Unit redis-server.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit redis-server.service has begun starting up.
Apr 05 12:28:44 ns3081715 run-parts[19223]: run-parts: executing /etc/redis/redis-server.pre-up.d/00_example
Apr 05 12:28:44 ns3081715 redis-server[19239]: *** FATAL CONFIG FILE ERROR ***
Apr 05 12:28:44 ns3081715 redis-server[19239]: Reading the configuration file, at line 108
Apr 05 12:28:44 ns3081715 redis-server[19239]: >>> 'logfile /var/log/redis/redis-server.log'
Apr 05 12:28:44 ns3081715 redis-server[19239]: Can't open the log file: Permission denied
Apr 05 12:28:45 ns3081715 systemd[1]: redis-server.service: Control process exited, code=exited status=1
Apr 05 12:28:45 ns3081715 systemd[1]: Failed to start Advanced key-value store.
-- Subject: Unit redis-server.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit redis-server.service has failed.
--
-- The result is failed.
Apr 05 12:28:45 ns3081715 systemd[1]: redis-server.service: Unit entered failed state.
Apr 05 12:28:45 ns3081715 systemd[1]: redis-server.service: Failed with result 'exit-code'.
Apr 05 12:28:45 ns3081715 systemd[1]: redis-server.service: Service hold-off time over, scheduling restart.
Apr 05 12:28:45 ns3081715 systemd[1]: Stopped Advanced key-value store.
-- 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.
Apr 05 12:28:45 ns3081715 systemd[1]: Starting Advanced key-value store...
-- Subject: Unit redis-server.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit redis-server.service has begun starting up.
Apr 05 12:28:45 ns3081715 run-parts[19251]: run-parts: executing /etc/redis/redis-server.pre-up.d/00_example
Apr 05 12:28:45 ns3081715 redis-server[19270]: *** FATAL CONFIG FILE ERROR ***
Apr 05 12:28:45 ns3081715 redis-server[19270]: Reading the configuration file, at line 108
Apr 05 12:28:45 ns3081715 redis-server[19270]: >>> 'logfile /var/log/redis/redis-server.log'
Apr 05 12:28:45 ns3081715 redis-server[19270]: Can't open the log file: Permission denied
Apr 05 12:28:45 ns3081715 systemd[1]: redis-server.service: Control process exited, code=exited status=1
Apr 05 12:28:45 ns3081715 systemd[1]: Failed to start Advanced key-value store.
-- Subject: Unit redis-server.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit redis-server.service has failed.
--
-- The result is failed.
Apr 05 12:28:45 ns3081715 systemd[1]: redis-server.service: Unit entered failed state.
Apr 05 12:28:45 ns3081715 systemd[1]: redis-server.service: Failed with result 'exit-code'.

other log

> -- Defined-By: systemd
> -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> --
> -- Unit redis-server.service has failed.
> --
> -- The result is failed. Apr 05 12:38:23 ns3081715 systemd[1]: redis-server.service: Unit entered failed state. Apr 05 12:38:23
> ns3081715 systemd[1]: redis-server.service: Failed with result
> 'exit-code'. Apr 05 12:38:23 ns3081715 systemd[1]:
> redis-server.service: Service hold-off time over, scheduling restart.
> Apr 05 12:38:23 ns3081715 systemd[1]: Stopped Advanced key-value
> store.
> -- 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. Apr 05 12:38:23 ns3081715 systemd[1]: Starting Advanced key-value store...
> -- Subject: Unit redis-server.service has begun start-up
> -- Defined-By: systemd
> -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> --
> -- Unit redis-server.service has begun starting up. Apr 05 12:38:23 ns3081715 run-parts[20653]: run-parts: executing
> /etc/redis/redis-server.pre-up.d/00_example Apr 05 12:38:23 ns3081715
> redis-server[20669]: *** FATAL CONFIG FILE ERROR *** Apr 05 12:38:23
> ns3081715 redis-server[20669]: Reading the configuration file, at line
> 108 Apr 05 12:38:23 ns3081715 redis-server[20669]: >>> 'logfile
> /var/log/redis/redis-server.log' Apr 05 12:38:23 ns3081715
> redis-server[20669]: Can't open the log file: Permission denied Apr 05
> 12:38:23 ns3081715 systemd[1]: redis-server.service: Control process
> exited, code=exited status=1 Apr 05 12:38:23 ns3081715 systemd[1]:
> Failed to start Advanced key-value store.
> -- Subject: Unit redis-server.service has failed
> -- Defined-By: systemd
> -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> --
> -- Unit redis-server.service has failed.
> --
> -- The result is failed. Apr 05 12:38:23 ns3081715 systemd[1]: redis-server.service: Unit entered failed state. Apr 05 12:38:23
> ns3081715 systemd[1]: redis-server.service: Failed with result
> 'exit-code'. Apr 05 12:38:23 ns3081715 systemd[1]:
> redis-server.service: Service hold-off time over, scheduling restart.
> Apr 05 12:38:23 ns3081715 systemd[1]: Stopped Advanced key-value
> store.
> -- 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. Apr 05 12:38:23 ns3081715 systemd[1]: redis-server.service: Start request
> repeated too quickly. Apr 05 12:38:23 ns3081715 systemd[1]: Failed to
> start Advanced key-value store.
> -- Subject: Unit redis-server.service has failed
> -- Defined-By: systemd
> -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> --
> -- Unit redis-server.service has failed.
> --
> -- The result is failed. Apr 05 12:38:24 ns3081715 sshd[20498]: Failed password for root from 218.65.30.46 port 47702 ssh2 Apr 05 12:38:24
> ns3081715 sshd[20498]: Received disconnect from 218.65.30.46 port
> 47702:11:  [preauth] Apr 05 12:38:24 ns3081715 sshd[20498]:
> Disconnected from 218.65.30.46 port 47702 [preauth] Apr 05 12:38:24
> ns3081715 sshd[20498]: PAM 2 more authentication failures; logname=
> uid=0 euid=0 tty=ssh ruser= rhost=218.65.30.46  user=root Apr 05
> 12:38:24 ns3081715 sshd[20540]: Failed password for root from
> 217.61.5.246 port 42706 ssh2 Apr 05 12:38:24 ns3081715 sshd[20540]: Received disconnect from 217.61.5.246 port 42706:11: disconnected by
> user [preauth] Apr 05 12:38:24 ns3081715 sshd[20540]: Disconnected
> from 217.61.5.246 port 42706 [preauth] Apr 05 12:38:24 ns3081715
> sshd[20540]: PAM 1 more authentication failure; logname= uid=0 euid=0
> tty=ssh ruser= rhost=217.61.5.246  user=root Apr 05 12:38:25 ns3081715
> sshd[20680]: pam_unix(sshd:auth): authentication failure; logname=
> uid=0 euid=0 tty=ssh ruser= rhost=218.65.30.46  user=root
dev.doc
  • 569
  • 3
  • 12
  • 18
hichem chouaibi
  • 481
  • 1
  • 4
  • 7

11 Answers11

37

I just bumped into the same issue with a fresh install of redis 5.0.3 from debian 10.1 packages repository.

For me the solution was to give access to the config file (read) and the log file (read-write) to user redis.

chown -R redis:redis /var/log/redis
chmod -R u+rwX,g+rwX,u+rx /var/log/redis

chmod +r /etc/redis/redis.conf
mhoareau
  • 631
  • 5
  • 6
  • I had a similar problem with directory ownership, and it wos for the root directory `/`. I resolved it with `chown root.root /`. – MarthyM Jun 26 '20 at 07:17
  • 1
    I have this problem every time I `sudo rm -fr /var/log/*`... – Taschetto Aug 04 '20 at 18:42
  • 6
    In my case, redis dir is getting deleted. I use these commands: ```sudo mkdir -p /var/log/redis/ && sudo touch /var/log/redis/redis-server.log && sudo chown redis:redis /var/log/redis/redis-server.log``` – manikanta Oct 29 '20 at 08:34
29

I've had the same issue a while on an ubuntu 16.04. It had happened after an update of the redis-server package.

The service was failing to start but running the server manually with

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

would let is start.

/var/log/redis/redis.log wouldn't provide useful information about it.

What I did was (being on ubutu 16.04) to remove redis-server and all its config files

sudo apt-get --purge remove redis-server

there was a leftover file dumb.rdb in /etc/redis so just to be sure :

sudo rm -rf /etc/redis/dump.rdb

then reinstall redis-server

sudo apt-get update
sudo apt-get install redis-server

and that solved it for me.

Bear in mind though that was just on my system. Apparently the redis server failing to start bug can be due to many conditions on different systems, some of those being for example :

You mileage may vary there.

In any case trying a reinstall, or even a downgrade to the previous version can't hurt :)

edit : corrected a typo

Community
  • 1
  • 1
Eric
  • 449
  • 5
  • 8
15

Redis was working fine and then I started to get this error

redis-server.service - Advanced key-value store
     Loaded: loaded (/lib/systemd/system/redis-server.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Mon 2021-07-19 09:43:47 EEST; 10s ago
       Docs: http://redis.io/documentation,
             man:redis-server(1)
    Process: 161736 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf (code=exited, status=1/FAILURE)

Then, I tried to run the command directly (This command can show you the problem in most cases)

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

It turned out that Redis can not find the log file

*** FATAL CONFIG FILE ERROR ***
Reading the configuration file, at line 171
>>> 'logfile /var/log/redis/redis-server.log'
Can't open the log file: No such file or directory

The solution was simple:

 sudo mkdir -p  /var/log/redis/ && sudo touch /var/log/redis/redis-server.log && sudo chown redis:redis /var/log/redis/redis-server.log
MohKoma
  • 964
  • 9
  • 9
  • Sadly, every time I reboot my system, that folder gets deleted (and it's RW, not RO). I guess a startup `.sh` with that command would fix the problem. But quite a pain to have to run this command on every boot and then `redis-server restart` – M.K Aug 10 '22 at 07:38
11

For me the solution was:

sudo ps aux | grep redis

Then I've killed the redis-server PID:

sudo kill 7453

And finally:

sudo service redis start
Is Ma
  • 913
  • 11
  • 14
  • 2
    for me this answer helped to figure out the problem. turned out there were two redis-server processes already running. had to kill those two and start the service again. – aimme Apr 03 '21 at 14:06
  • This led me in the right direction. I followed the official docs to install Redis on Linux and installed via snap. But I did not know that my PATH env variable did not include the snap install paths. Hence even after installation, `redis-cli ping` said `No command found`. I followed the linked answer and found `redis-server.service` was already running from snap's installation directory. So next was simple, uninstalled redis which I installed via snap. Then installed redis and redis-server afresh. Works like charm. – Anubhab Maji Jan 27 '23 at 11:46
2

I had to run redis with /usr/bin/redis-server /etc/redis/redis.conf and then it said that there is a configuration error (typo ..)

I couldn't see that when I was checking the status with systemctl.

france1
  • 141
  • 2
  • 12
1

If you have redis.service running, the port 6379 gets occupied and the mentioned error might happen.

So disable the default redis serive:

sudo systemctl stop redis
sudo systemctl restart redis-server
sudo systemctl status redis-server
Alireza Kavian
  • 375
  • 2
  • 14
0

Changes to redis.conf Make the below changes to redis.conf file to re-start the Redis Server. Edit the redis.conf file by executing the below command

nano /etc/redis/redis.conf

Change the line bind 127.0.0.1::1 to 127.0.0.1 Change the line supervised no to spervised systemd

Save the changes and close the file. The next step is to start Redis server. Execute the bellow commands to start the Redis server and create necessary symlinks for Redis service.

systemctl enable redis-server systemctl daemon-reload

Now you are all set and you can validate it by checking the status of the service by executing the command systemctl status redis.

anas shah
  • 41
  • 5
  • 1
    Answer going in the right direction, it may solve some people issue, but in my case I did the above commands but still getting: "Failed to enable unit: Unit file systemctl.service does not exist" – Sami-L Jun 24 '20 at 13:31
0

There's a pitfall when changing default paths and file locations in /etc/redis/redis.conf. It took me an evening to find that read-write permissions of a system service do not only depend on the file-system permissions, but also on permissions granted in the unit file of the service itself:

If you need to relocate log file and database somewhere outside of the default locations, you need to adjust the ReadWriteDirectories directive in /lib/systemd/system/redis-server.service according your needs.

Don't forget to run systemctl daemon-reload and you should be fine to systemctl start redis-server

A package update will likely break the fix, if the unit file is replaced.

Bernie
  • 1
0

I passed through this same issue, took me a whole day to solve. in my case it was file permission issue.

create this directory:

sudo mkdir /var/lib/redis

grant redis ownership permission to the directory:

sudo chown redis:redis /var/lib/redis

then run:

sudo systemctl status redis-server.service
0

I had the same issue with ubuntu 22.04 LTS and redis-server 6.0.16 Solved it by applying a solution mentionned above:

chown -R redis:redis /var/log/redis
chmod -R u+rwX,g+rwX,u+rx /var/log/redis
chmod +r /etc/redis/redis.conf

AND by copying /home/user/RedisJSON/bin/linux-x64-release/**rejson.so** to /etc/redis/

Finally adapting redis.conf : loadmodule /etc/redis/rejson.so

Result was Fine:

sudo systemctl status redis-server returned redis-server.service - Advanced key-value store Loaded: loaded ...

Benjamin Buch
  • 4,752
  • 7
  • 28
  • 51
0

I had a similar issue on a server running with SpinupWP. I had no trouble with other servers, but this one with a massive WordPress site was giving me these problems.

Here's how I fixed it:


sudo systemctl stop redis-server.service
sudo rm -rf /var/lib/redis 
sudo mkdir /var/lib/redis
sudo chown redis:redis /var/lib/redis
sudo systemctl start redis-server.service