voxpupuli / puppet-redis

Puppet Module to manage Redis
https://forge.puppet.com/puppet/redis
Apache License 2.0
40 stars 183 forks source link

redis installation on ubuntu 22.04 fails because /var/run/redis directory doesn't exists. #457

Open fidalcastro opened 1 year ago

fidalcastro commented 1 year ago

Affected Puppet, Ruby, OS and module versions/distributions

How to reproduce (e.g Puppet code you use)

Running below code on ubuntu 22.04 which installs the redis-server & redis-tools using ppa package but fails to start the redis.service(systemd).

Error is unable to create redis.sock because directory /var/run/redis is not available. If I create this directory manually & changes, its ownershipt to redis:redis then it works.

class { '::redis':
    bind                     => '0.0.0.0',
    daemonize          => false,
    databases           => 16,
    manage_repo      => true,
    maxclients           => 4000,
    package_ensure  => $package_ensure,
    port                      => 6379,
    ppa_repo             => 'ppa:redislabs/redis',
    protected_mode  => false,
    syslog_enabled   => true,
    syslog_facility      => 'local0',
    timeout                => 0,
  }

What are you seeing

Installs the required version of redis-server but fails to start the service because of missing /var/run/redis

What behaviour did you expect instead

Directory /var/run/redis should be created as part of config.pp

Output log

root@redis-server-02:~# sudo systemctl status redis-server
× redis-server.service - Redis Advanced key-value store for instance default
     Loaded: loaded (/etc/systemd/system/redis-server.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2022-12-02 11:42:43 UTC; 3min 10s ago
    Process: 1379 ExecStart=/usr/bin/redis-server /etc/redis/redis.conf --supervised systemd --daemonize no (code=exited, status=1/FAILURE)
   Main PID: 1379 (code=exited, status=1/FAILURE)
     Status: "Redis is loading..."
        CPU: 11ms

Dec 02 11:42:43 redis-server-02 systemd[1]: redis-server.service: Main process exited, code=exited, status=1/FAILURE
Dec 02 11:42:43 redis-server-02 systemd[1]: redis-server.service: Failed with result 'exit-code'.
Dec 02 11:42:43 redis-server-02 systemd[1]: Failed to start Redis Advanced key-value store for instance default.
Dec 02 11:42:43 redis-server-02 systemd[1]: redis-server.service: Scheduled restart job, restart counter is at 5.
Dec 02 11:42:43 redis-server-02 systemd[1]: Stopped Redis Advanced key-value store for instance default.
Dec 02 11:42:43 redis-server-02 systemd[1]: redis-server.service: Start request repeated too quickly.
Dec 02 11:42:43 redis-server-02 systemd[1]: redis-server.service: Failed with result 'exit-code'.
Dec 02 11:42:43 redis-server-02 systemd[1]: Failed to start Redis Advanced key-value store for instance default.
root@redis-server-02:~#
root@redis-server-02:~#
root@redis-server-02:~#
root@redis-server-02:~# tail -10f /var/log/redis/redis-server.log
42258:M 02 Dec 2022 11:41:07.998 # Warning: Could not create server TCP listening socket ::1:6379: bind: Cannot assign requested address
42258:M 02 Dec 2022 11:41:07.999 * Running mode=standalone, port=6379.
42258:M 02 Dec 2022 11:41:07.999 # Server initialized
42258:M 02 Dec 2022 11:41:07.999 # 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.
42258:M 02 Dec 2022 11:41:07.999 * Ready to accept connections
42258:M 02 Dec 2022 11:41:22.475 # User requested shutdown...
42258:M 02 Dec 2022 11:41:22.475 * Saving the final RDB snapshot before exiting.
42258:M 02 Dec 2022 11:41:22.480 * DB saved on disk
42258:M 02 Dec 2022 11:41:22.480 * Removing the pid file.
42258:M 02 Dec 2022 11:41:22.480 # Redis is now ready to exit, bye bye...
^C
root@redis-server-02:~#
root@redis-server-02:~#
root@redis-server-02:~#
root@redis-server-02:~# tail -10f /var/log/redis/redis.log
1378:C 02 Dec 2022 11:42:43.029 # Redis version=7.0.5, bits=64, commit=00000000, modified=0, pid=1378, just started
1378:C 02 Dec 2022 11:42:43.029 # Configuration loaded
1378:M 02 Dec 2022 11:42:43.030 * monotonic clock: POSIX clock_gettime
1378:M 02 Dec 2022 11:42:43.030 # Failed opening Unix socket: bind: No such file or directory
1379:C 02 Dec 2022 11:42:43.271 * Supervised by systemd. Please make sure you set appropriate values for TimeoutStartSec and TimeoutStopSec in your service unit.
1379:C 02 Dec 2022 11:42:43.272 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1379:C 02 Dec 2022 11:42:43.272 # Redis version=7.0.5, bits=64, commit=00000000, modified=0, pid=1379, just started
1379:C 02 Dec 2022 11:42:43.272 # Configuration loaded
1379:M 02 Dec 2022 11:42:43.273 * monotonic clock: POSIX clock_gettime
1379:M 02 Dec 2022 11:42:43.273 # Failed opening Unix socket: bind: No such file or directory

Any additional information you'd like to impart