How to use redis in mediawiki

来自linux中国网wiki
跳到导航 跳到搜索

pre install

安装我就不讲了

configure

//In your LocalSettings.php file, set:

/** @see RedisBagOStuff for a full explanation of these options. **/
$wgObjectCaches['redis'] = array(
    'class'                => 'RedisBagOStuff',
    'servers'              => array( '127.0.0.1:6379' ),
    'connectTimeout'    => 1,
    //'persistent'        => false,
    //'persistent'        => true,
    //'password'          => 'secret',
     //'automaticFailOver' => true,
);

//#You'll now be able to acquire a Redis object cache object via wfGetCache( 'redis' ). If you'd like to use Redis as the default cache for various data, you may set any of the following configuration options:

$wgMainCacheType = 'redis';
$wgSessionCacheType = 'redis';  // same as WMF prod

// Not widely tested:
$wgMessageCacheType = 'redis';
$wgParserCacheType = 'redis';
$wgLanguageConverterCacheType = 'redis';

//Job queue[edit]
 $wgJobTypeConf['default'] = array(
 	'class'          => 'JobQueueRedis',
 	'redisServer'    => '127.0.0.1:6379',
 	'redisConfig'    => array(),
 	'claimTTL'       => 3600
 );
//From that moment, jobs will be delivered to the Redis instance run the specified server.


# vim includes/libs/redis/RedisConnectionPool.php

		var_dump($result);
			if ( !$result ) {
				echo  "redis server not run ";
				$logger->error(
					'Could not connect to server "{redis_server}"',
					[ 'redis_server' => $server ]
				);

注意  记得要把默认的apc 关闭 
## Shared memory settings
#$wgMainCacheType = CACHE_ACCEL;
谢谢松哥 download回来  就知道了是那个  然后关掉redis echo 个东西就知道有没有开 哈哈 
 

参考

#官方安装文档  
 https://www.mediawiki.org/wiki/Redis
 https://www.mediawiki.org/wiki/Manual:Performance_tuning#Main_cache
 https://doc.wikimedia.org/mediawiki-core/master/php/RedisConnRef_8php_source.html
 https://www.mediawiki.org/wiki/Memcached