2015-06-19 25 views
0

我們正在嘗試使用Redis Cluster來存儲會話數據,使用最新版本的phpredis 2.2.5,從2015年9月19日的github存儲庫下載,在php.ini配置文件中將redis配置爲會話處理程序。將Redis Cluster用作會話處理程序時,Redis Cluster可能具有高可用性嗎?

我們有6個實例,三個作爲主人,三個作爲奴隸,我們測試了存儲和讀取會話數據的工作原理。

但是,如果我們停止是由我們的應用程序顯示以下錯誤任何主:

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 

連接關閉,集羣做,因爲我們想,我們想這方面是重做不工作另一個例子。

phpredis驅動程序是否管理與集羣的連接?它是否自動提供從另一個集羣實例獲取值的機會?

回答

0

我們解決了:-)

問題創建集羣的時刻,我們必須使用的,而不是127.0.0.1的服務器IP

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 

現在設置和獲取集羣中的值一個PHP腳本的作品。

此外,爲使用它作爲會話處理程序,我們必須使用5.6版本,對於以前的版本,我們有「分段錯誤」錯誤。

相關問題