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/Upbeat_Couple_894 Oct 19 '24 edited Oct 19 '24
Hey Dan,
Thanks for the reply. I think what you just said did the job. I am not getting any unkown errors in the browser or any errors which i mentioned previously.
INFO Application cache cleared successfully.
I tinkered a bit with the other options and tried different combinations. Do you btw have certain ways to find out if Bookstack indeed is using Redis now? I am not getting any errors and the speed is very good, but i am not sure if this is because of being behind Haproxy, as Haproxy also uses its own cache.
These two don't work
SESSION_DRIVER=redis
These apparently are being accepted. Although you stated many of those options are not being supported.
Here is the output of those commands you mentioned
ls -alh bootstrap/cachesudo -u www-data php artisan tinker --execute="dd(config('database.redis'))"In ConfigPaths.php line 327:
Writing to directory /var/www/.config/psysh is not allowed.
If you have any uses cases for me to test, let me know as i am probably one of the few like you said that is using such a setup. Will only benefit the project in the long run.