This example is based on Phpredis 2.2.8, supports cluster processing, php5.3 and above.
1, Page modification:
Ini_set (' Session.save_handler ', ' rediscluster ');
Ini_set (' Session.save_path ', ' Seed[]=192.168.100.1:7000&seed[]=192.168.100.1:7001&timeout=3&read_ Timeout=3 ');
2, modify the php.ini
; Session.save_handler = Files
; Session.save_path = "/var/lib/php/session"
Note the above two lines, add the following two lines:
Session.save_handler = Rediscluster
Session.save_path = "Seed[]=192.168.100.1:7000&seed[]=192.168.100.1:7001&timeout=3&read_timeout=3"
3, PHP-FPM configuration, modify FPM configuration file www.conf (this profile name is not necessarily this, according to the actual situation modified)
;p Hp_value[session.save_handler] = files
;p Hp_value[session.save_path] =/var/lib/php/session
Note the above two lines and add the following:
Php_value[session.save_handler] = Rediscluster
Php_value[session.save_path] = "Seed[]=192.168.100.1:7000&seed[]=192.168.100.1:7001&timeout=3&read_ Timeout=3 "
Restart PHP-FPM after modification
Website address: Https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#readme
How to configure a PHP session to use a Redis cluster