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 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大