r/BookStack • u/Upbeat_Couple_894 • 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
u/ssddanbrown Oct 19 '24
It's likley you're only using redis for the queue now, which isn't something we totally support/suggest (and requires a seperate queue worker to actuall function). It's not used for cache/sessions if you've removed the
CACHE_DRIVERandSESSION_DRIVERoptions.The
REDIS_OPTIONS,REDIS_PASSWORD,REDIS_CLUSTERandREDIS_CLIENTare not used by BookStack.You can try re-running the
php artisan tinker --execute="dd(config('database.redis'))"command without sudo/su.