Redis/MediaWiki: Difference between revisions

From Bibliotheca Anonoma
(Created page with "https://blog.go2tech.de/2016/02/the-jobqueue-how-droidwiki-de-runs-jobs/")
 
No edit summary
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
Redis can be used as an alternative to memcached, and function as the job queue (no more running runJobs.php)
https://blog.go2tech.de/2016/02/the-jobqueue-how-droidwiki-de-runs-jobs/
https://blog.go2tech.de/2016/02/the-jobqueue-how-droidwiki-de-runs-jobs/
Make sure to get the latest versions of Redis from outside your distribution, which can be old: https://www.linode.com/docs/databases/redis/deploy-redis-on-ubuntu-or-debian
== Redis with PHP 7.4 on Red Hat ==
Redis isn't unfortunately packaged with PHP 7.4 and it doesn't have a RPM package with the Red Hat provided packages. But we can just install it using pecl. Say no to most of the compile flags, we don't have the necessary stuff for igbinary and its not really needed in our use case.
<pre>
dnf install php-devel make php-pecl
pecl install phpredis
</pre>
Then add the extension definition to /etc/php.d/50-redis.ini
<pre>
; Enable redis extension module
extension = redis.so
; phpredis can be used to store PHP sessions.
; To do this, uncomment and configure below
; RPM note : save_handler and save_path are defined
; for mod_php, in /etc/httpd/conf.d/php.conf
; for php-fpm, in /etc/php-fpm.d/*conf
;session.save_handler = redis
;session.save_path = "tcp://host1:6379?weight=1, tcp://host2:6379?weight=2&timeout=2.5, tcp://host3:6379?weight=2"
; Configuration
;redis.arrays.algorithm = ''
;redis.arrays.auth = ''
;redis.arrays.autorehash = 0
;redis.arrays.connecttimeout = 0
;redis.arrays.consistent = 0
;redis.arrays.distributor = ''
;redis.arrays.functions = ''
;redis.arrays.hosts = ''
;redis.arrays.index = 0
;redis.arrays.lazyconnect = 0
;redis.arrays.names = ''
;redis.arrays.pconnect = 0
;redis.arrays.previous = ''
;redis.arrays.readtimeout = 0
;redis.arrays.retryinterval = 0
;redis.clusters.auth = 0
;redis.clusters.cache_slots = 0
;redis.clusters.persistent = 0
;redis.clusters.read_timeout = 0
;redis.clusters.seeds = ''
;redis.clusters.timeout = 0
;redis.pconnect.pooling_enabled = 1
;redis.pconnect.connection_limit = 0
;redis.pconnect.echo_check_liveness = 1
;redis.pconnect.pool_pattern => ''
;redis.session.lock_expire = 0
;redis.session.lock_retries = 10
;redis.session.lock_wait_time = 2000
;redis.session.locking_enabled = 0
</pre>
https://developer.redis.com/develop/php/
<!--
== Redis with HHVM as Session Handler ==
Redis support is built into HHVM. You can just set redis as a save handler in HHVM, rather than using files.
{{hc|/etc/hhvm/php.ini|<nowiki>
session.save_handler = redis
session.save_path = "tcp://localhost:6379"
</nowiki>}}
* [https://www.digitalocean.com/community/tutorials/how-to-set-up-a-redis-server-as-a-session-handler-for-php-on-ubuntu-14-04 DigitalOcean - How to Set Up a Redis Server as a Session Handler for PHP on Ubuntu 14.04]
* [https://medium.com/@deboj88/load-balancing-a-reverse-proxy-with-nginx-hhvm-and-php-fpm-34fe1afee576 Source: Medium @deboj88 - Load balancing a Reverse Proxy with Nginx, HHVM and PHP FPM]
* [https://segmentfault.com/q/1010000004968214 Source: HHVM + mediawiki 怎么配置]
-->
== MediaWiki Object/Main/Session Cache with Redis ==
[[mw:Redis#Setup]]
== MediaWiki Job Queue with Redis ==
[[mw:Redis#Job queue]]

Latest revision as of 02:41, 4 April 2023

Redis can be used as an alternative to memcached, and function as the job queue (no more running runJobs.php)

https://blog.go2tech.de/2016/02/the-jobqueue-how-droidwiki-de-runs-jobs/

Make sure to get the latest versions of Redis from outside your distribution, which can be old: https://www.linode.com/docs/databases/redis/deploy-redis-on-ubuntu-or-debian

Redis with PHP 7.4 on Red Hat[edit]

Redis isn't unfortunately packaged with PHP 7.4 and it doesn't have a RPM package with the Red Hat provided packages. But we can just install it using pecl. Say no to most of the compile flags, we don't have the necessary stuff for igbinary and its not really needed in our use case.

dnf install php-devel make php-pecl
pecl install phpredis

Then add the extension definition to /etc/php.d/50-redis.ini

; Enable redis extension module
extension = redis.so

; phpredis can be used to store PHP sessions.
; To do this, uncomment and configure below

; RPM note : save_handler and save_path are defined
; for mod_php, in /etc/httpd/conf.d/php.conf
; for php-fpm, in /etc/php-fpm.d/*conf

;session.save_handler = redis
;session.save_path = "tcp://host1:6379?weight=1, tcp://host2:6379?weight=2&timeout=2.5, tcp://host3:6379?weight=2"

; Configuration
;redis.arrays.algorithm = ''
;redis.arrays.auth = ''
;redis.arrays.autorehash = 0
;redis.arrays.connecttimeout = 0
;redis.arrays.consistent = 0
;redis.arrays.distributor = ''
;redis.arrays.functions = ''
;redis.arrays.hosts = ''
;redis.arrays.index = 0
;redis.arrays.lazyconnect = 0
;redis.arrays.names = ''
;redis.arrays.pconnect = 0
;redis.arrays.previous = ''
;redis.arrays.readtimeout = 0
;redis.arrays.retryinterval = 0
;redis.clusters.auth = 0
;redis.clusters.cache_slots = 0
;redis.clusters.persistent = 0
;redis.clusters.read_timeout = 0
;redis.clusters.seeds = ''
;redis.clusters.timeout = 0
;redis.pconnect.pooling_enabled = 1
;redis.pconnect.connection_limit = 0
;redis.pconnect.echo_check_liveness = 1
;redis.pconnect.pool_pattern => ''
;redis.session.lock_expire = 0
;redis.session.lock_retries = 10
;redis.session.lock_wait_time = 2000
;redis.session.locking_enabled = 0

https://developer.redis.com/develop/php/

MediaWiki Object/Main/Session Cache with Redis[edit]

mw:Redis#Setup

MediaWiki Job Queue with Redis[edit]

mw:Redis#Job queue