bayman
bayman

Reputation: 1719

Can't start redis server on Centos 7

I'm trying to install OpenVas but having trouble starting Redis server on CentOS. What should I do to troubleshoot?

I install openvas by running (this installs redis and all other dependencies):

# yum install openvas

I try to start it by running:

# systemctl enable redis && systemctl restart redis

I check the systemctl status log for redis by running:

# systemctl status redis -l

It shows connection refused and failed to start:

Mar 19 12:37:13 hostname.local systemd[1]: Started Redis persistent key-value database.
Mar 19 12:37:13 hostname.local systemd[1]: Starting Redis persistent key-value database...
Mar 19 12:37:14 hostname.local systemd[1]: redis.service: main process exited, code=exited, status=1/FAILURE
Mar 19 12:37:14 hostname.local redis-shutdown[19127]: Could not connect to Redis at 127.0.0.1:6379: Connection refused
Mar 19 12:37:14 hostname.local systemd[1]: redis.service: control process exited, code=exited status=1
Mar 19 12:37:14 hostname.local systemd[1]: Unit redis.service entered failed state.
Mar 19 12:37:14 hostname.local systemd[1]: redis.service failed.

Upvotes: 0

Views: 12411

Answers (3)

Chatree Siangklom
Chatree Siangklom

Reputation: 1

CentOs8 Configure the private network

  1. Update the firewall service to allow incoming connections from the private network:

    sudo firewall-cmd --permanent --zone=trusted --change-interface=ens7

is mean interface network name 2. Create a systemd service to delay the Redis start-up until the private interface is up and IP address is assign

sudo nano /etc/systemd/system/redis.service.d/wait-for-ips.conf
  1. Paste the following text into the file, then save and close it:

    [Unit] After=network-online.target Wants=network-online.target

  2. reload service

    sudo systemctl daemon-reload

  3. Restart Service

    sudo systemctl restart redis.service

Thank you Credit https://www.vultr.com/docs/install-and-configure-redis-on-centos-8

Upvotes: 0

yanqian
yanqian

Reputation: 96

Is SELinux enabled? you can check that using this command:

$ getenforce

If it is ‘Enforcing’, maybe redis is blocked by SELinux policy, could you please also check the /etc/redis.conf ? find the line started with 'unixsocket', if it is /tmp/redis.sock, try to change it to '/var/run/redis/redis.sock':

unixsocket /var/run/redis/redis.sock

then restart redis server, check the server status, OpenVAS setup need redis listen on a unix socket.

Upvotes: 0

breezzz
breezzz

Reputation: 27

First, look into /var/log/redis/redis.log

I try setup with this post https://forums.atomicorp.com/viewtopic.php?f=31&t=8047

1) Disable SELINUX.
Edit /etc/selinux/config, save and reboot
2) Add required packages
yum install wget bzip2 texlive net-tools alien
3) Add Atomicorp repo
wget -q -O - http://www.atomicorp.com/installers/atomic | sh
4) Install OpenVAS 
yum install openvas
5) edit /etc/redis.conf. Add/uncomment the following
unixsocket /tmp/redis.sock
unixsocketperm 700
6) Restart Redis
systemctl enable redis && systemctl restart redis

redis ip up and running

[root@localhost ~]# cat /var/log/redis/redis.log
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 3.2.3 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 29645
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

29645:M 21 Mar 14:55:00.551 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
29645:M 21 Mar 14:55:00.551 # Server started, Redis version 3.2.3
29645:M 21 Mar 14:55:00.551 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
29645:M 21 Mar 14:55:00.551 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
29645:M 21 Mar 14:55:00.551 * The server is now ready to accept connections on port 6379

Upvotes: 1

Related Questions