Having multiple nextcloud instances access the same redis server

I have several nextcloud instances running on the same server, residing in /var/www/nextcloud-xxxx. There seems to be no problem.
I am just reviewing my configuration and find that the redis configuration is just duplicated. All instances refer to the same unix socket at /var/run/redis/redis.sock.

  • is this error-prone?
  • should this be changed, and how?

My environment:
Debian 10
Apache 2.4
PHP 7.3

Thank you

I wouldn’t expect that using the same socket causes problems, but it might be of relevance if the stored data should be shared between the Nextcloud instances or not. This is an interesting article on it:


1 Like

Thanks. Reading that article, beside doing nothing there is the option of separate databases. I use Unix socket, not TCP sockets as mentioned in the article. Can I just put
‘host’ => ‘/var/run/redis/redis.sock/1’,
in my config?

Based on the Nextcloud documentation the syntax should be as follows:

'redis' => [
     'host'     => '/var/run/redis/redis.sock',
     'port'     => 0,
     'dbindex'  => 0,                             # <<< database index
     'password' => 'secret',
     'timeout'  => 1.5,
1 Like

I found out by experimenting that
'database' => 0,

also seems to work. What makes me think, when I refer to databases > 0, do I have to create a new password for them?

I would stick to “dbindex” because it is used in the Nextcloud code. See /lib/private/RedisFactory.php:

95: if (isset($config['dbindex'])) {
96      $this->instance->select($config['dbindex']);

I’m not aware of the possibility to use multiple passwords. The security concept of Redis is discussed here.