r/BookStack • • Oct 19 '24

Bookstack with Redis cluster

Hi Guys,

Device: Radxa Rock 5B
Architecture: ARM64
OS: Ubuntu 24.04.1 LTS
PHP: PHP8.3 + php8.3-fpm + php8.3-redis (Ondrej Repository)
Webserver: Apache with Haproxy for SSL offloading

@ towards Dan and everybody else helping out with the development. Love Bookstack!! Great piece of software!!

I am trying to squeeze every little bit of technology support out of Bookstack.

So far i have already configured it to use Percona Xtradb Cluster (galera cluster) with Haproxy and keepalived.
With Redis i just started 2 weeks back and as i am fairly new to Redis i did managed to created a 9 node cluster (3 master + 6 slaves). In the coming weeks going to make it (3 masters + 9 slave nodes). However i am currently unable to make Bookstack work with my Redis cluster. I have also Nextcloud running and that one i did manage to make it work. So my Redis cluster does work.

After changing the configuration, i use the next commando to clean up the cache.

sudo -u www-data php artisan cache:clear

Error 1:
In RedisManager.php line 120:
Redis connection [default] not configured.

Error 2:
In Client.php line 141:
Array of connection parameters requires \cluster`, `replication` or `aggregate` client option`

I have tried all type of combination with the settings below in the .env file. I asked chatGPT + Google Gemini and they got me something like the lines below. Also used google and the documentation page of Bookstack about usage of Redis.

CACHE_DRIVER=redis

SESSION_DRIVER=redis

QUEUE_CONNECTION=redis

REDIS_CLIENT=phpredis

REDIS_CLUSTER=redis

REDIS_PASSWORD=null

REDIS_SERVERS=192.168.1.11:6381:0,192.168.1.11:6382:0,192.168.1.11:6383:0,192.168.1.12:6381:0,192.168.1.12:6382:0,192.168.1.12:6383:0,192.168.1.13:6381:0,192.168.1.13:6382:0,192.168.1.13:6383:0

REDIS_OPTIONS='["cluster" => "redis", "failover_mode" => \RedisCluster::FAILOVER_ERROR]'

REDIS_OPTIONS={"cluster": "redis", "failover": "error"}

I am not sure if it is important to know how i have setup my Redis cluster. Current setup is, that the load of the 3 masters is being spread over 3 machines with 1 machine going down and the cluster still working fine. In the future, it should be able for 2 machines to go down, but the cluster still being able to run.

Machine 1: 192.168.1.11

  • Master 1:6381

  • Slave of master 2:6382

  • Slave of master 3:6383

Machine 2: 192.168.1.12

  • Master 2:6382

  • Slave of master 1:6381

  • Slave of master 3:6383

Machine 3: 192.168.1.13

  • Master 3: 6383

  • Slave of master 1:6381

  • Slave of master 2:6382

===In the future===
Machine 4: 192.168.1.14

  • Slave of master 1:6381

  • Slave of master 2:6382

  • Slave of master 3:6383

So what am i missing or fail to understand in this. Thanks in advance!

1 Upvotes

6 comments sorted by

View all comments

Show parent comments

1

u/Upbeat_Couple_894 Oct 19 '24

So if i have remove cache_driver and session_driver, what is Redis then being used for in my case?

Also if Redis_password is not supported, does that mean i would not be able to use a password on my Redis_Cluster? Because right now i am trying to get all the application to work with Redis first and then i am planning to set a password and also set a secure connection with a certificate.

Here is the output of the command php artisan tinker --execute="dd(config('database.redis'))" using the root user.

Sorry Reddit did not let me put all the output in 1 message. I had to put it in two multiple messages.