dongxia8656 2015-06-19 16:30
浏览 83

使用Redis Cluster作为会话处理程序时,它是否可能具有高可用性?

We are trying to use Redis Cluster for storing session data using last version of phpredis, 2.2.5, downloaded from github repository the 19 Juin of 2015, configuring redis as sessions handler in php.ini configuraiton file.

We have 6 instances, three as masters and three as slaves and we have tested that storing and reading session data works.

However if we shutdown any master the following error is shown by our application:

Fatal error: Uncaught exception 'RedisException' with message 'Connection closed' in /users/ets01/lib/php/DEIN/class.PSASession.php:64 Stack trace: #0 /users/ets01/lib/php/DEIN/class.PSASession.php(64): session_start() #1 /users/ets01/lib/php/DEIN/class.PSAPage.php(102): PSASession->__construct() #2 /users/ets01/web/inc/class.APP2Page.php(11): PSAPage->__construct('b', 11) #3 /users/ets01/web/html/index.php(11): APP2Page->__construct() #4 {main} thrown in /users/ets01/lib/php/DEIN/class.PSASession.php on line 64

Fatal error: Uncaught exception 'RedisException' with message 'Connection closed' in [no active file]:0 Stack trace: #0 {main} thrown in [no active file] on line 0

Connection is closed, and cluster does not works as we would like to, we would like that connection is redone to another instance.

Does phpredis driver manage connections to the cluster? Does it provides automatically the chance of getting the value from another cluster instance?

  • 写回答

1条回答 默认 最新

  • douba4933 2015-07-01 14:54
    关注

    We resolved the problems :-)

    At the moment of creating the cluster we have to use the server IP instead of 127.0.0.1

    redis-trib.rb create --replicas 1 10.68.10.201:7001 10.68.10.201:7002 10.68.10.201:7003 10.68.10.201:7004 10.68.10.201:7005 10.68.10.201:7006
    

    Now setting and getting values in the cluster from a PHP script works.

    Also, for using it as session handler we had to use 5.6 version of, for previous versions we have a "segmentation fault" error.

    评论

报告相同问题?

悬赏问题

  • ¥15 高价求中通快递查询接口
  • ¥15 解决一个加好友限制问题 或者有好的方案
  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?