Error Failed to start redis service Unit redis-server service is masked

0 votes

I Installed Redis Server on ubuntu 16.04. but when i try to start(sudo systemctl start redis) the redis service I receive message as:

Failed to start redis.service: Unit redis-server.service is masked.

I don't have any idea about this error. Can some help me out?

May 18, 2020 in Docker by kartik
• 37,490 points
3,921 views

1 answer to this question.

0 votes

Hello,

If redis.service file is missed in directory path /etc/systemd/system/redis.service so we have to create file into this directory using command like:

sudo nano /etc/systemd/system/redis.service and write following things

[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

Here

  • Unit is description and defining the network behavior,
  • Service is to specify the service's behavior and
  • Install define the systemd target that the service should attach to if enabled.

Then create redis user group and directories using

sudo adduser --system --group --no-create-home redis
  1. sudo mkdir /var/lib/redis (Create directory)
  2. sudo chown redis:redis /var/lib/redis (Change owner permission)
  3. sudo chmod 770 /var/lib/redis

run the service sudo systemctl start redis It will be work fine and check the status using

sudo systemctl status redis

Thank you!!

answered May 18, 2020 by Niroj
• 82,680 points

Related Questions In Docker

0 votes
1 answer

Failed to start podman.service: Unit podman.service not found.

Hi@akhtar, Before starting Podman service, you have to ...READ MORE

answered Apr 20, 2020 in Docker by MD
• 95,140 points
978 views
0 votes
1 answer

Dockerfile to install apache server and start httpd service on it.

Hey @Kali, That's pretty simple. You could have ...READ MORE

answered Jan 22, 2019 in Docker by Yesha
14,868 views
0 votes
1 answer
0 votes
1 answer

Is it possible to start a shell session in a running container (without ssh)

use this docker exec -it "id of running ...READ MORE

answered Jul 25, 2018 in Docker by Kalgi
• 52,310 points
186 views
+2 votes
1 answer
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,100 points
1,106 views
0 votes
1 answer

How to run a cron job inside a docker container?

Hii, crond works well with tiny on Alpine RUN apk add --no-cache ...READ MORE

answered May 18, 2020 in Docker by Niroj
• 82,680 points
3,461 views
0 votes
1 answer

Google Kubernetes Engine: Enable HTTPS for Service type

Hello @kartik, Specifically in Google Kubernetes Engine (GKE), ...READ MORE

answered May 18, 2020 in Docker by Niroj
• 82,680 points
131 views