Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/235.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP Memcached会话副本问题_Php_Session_Memcached - Fatal编程技术网

PHP Memcached会话副本问题

PHP Memcached会话副本问题,php,session,memcached,Php,Session,Memcached,我已经设置了两个Memcached服务器用作PHP会话存储,但是尽管尝试了各种设置,我还是无法在两个服务器中都显示会话密钥 我的php.ini如下所示: session.save_handler = memcached session.save_path = "192.168.134.38:11211,192.168.134.234:11211" My memcached.ini是以下内容的变体: extension=memcached.so memcached.sess_consistent

我已经设置了两个Memcached服务器用作PHP会话存储,但是尽管尝试了各种设置,我还是无法在两个服务器中都显示会话密钥

我的php.ini如下所示:

session.save_handler = memcached
session.save_path = "192.168.134.38:11211,192.168.134.234:11211"
My memcached.ini是以下内容的变体:

extension=memcached.so
memcached.sess_consistent_hash=1
memcached.sess_number_of_replicas=1
memcached.sess_binary=1
如果我使用-vv运行memcached,我可以看到密钥正在写入第一台服务器:

<30 new auto-negotiating client connection
30: Client using the binary protocol
<30 Read binary protocol data:
<30    0x80 0x0c 0x00 0x28
<30    0x00 0x00 0x00 0x00
<30    0x00 0x00 0x00 0x28
<30    0x00 0x00 0x00 0x00
<30    0x00 0x00 0x00 0x00
<30    0x00 0x00 0x00 0x00
<30 GET memc.sess.key.9bn8cdu9c1j7ko1tmflgr433k1
>30 Writing bin response:
>30   0x81 0x0c 0x00 0x28
>30   0x04 0x00 0x00 0x00
>30   0x00 0x00 0x03 0xc6
>30   0x00 0x00 0x00 0x00
>30   0x00 0x00 0x00 0x00
>30   0x00 0x00 0x00 0x00
<30 Read binary protocol data:
<30    0x80 0x01 0x00 0x28
<30    0x08 0x00 0x00 0x00
<30    0x00 0x00 0x03 0xcb
<30    0x00 0x00 0x00 0x00
<30    0x00 0x00 0x00 0x00
<30    0x00 0x00 0x00 0x00
<30 SET memc.sess.key.9bn8cdu9c1j7ko1tmflgr433k1 Value len is 923
>30 Writing bin response:
>30   0x81 0x01 0x00 0x00
>30   0x00 0x00 0x00 0x00
>30   0x00 0x00 0x00 0x00
>30   0x00 0x00 0x00 0x00
>30   0x00 0x00 0x00 0x00
>30   0x00 0x00 0x00 0x05
<30 Read binary protocol data:
<30    0x80 0x07 0x00 0x00
<30    0x00 0x00 0x00 0x00
<30    0x00 0x00 0x00 0x00
<30    0x00 0x00 0x00 0x00
<30    0x00 0x00 0x00 0x00
<30    0x00 0x00 0x00 0x00
>30 Writing bin response:
>30   0x81 0x07 0x00 0x00
>30   0x00 0x00 0x00 0x00
>30   0x00 0x00 0x00 0x00
>30   0x00 0x00 0x00 0x00
>30   0x00 0x00 0x00 0x00
>30   0x00 0x00 0x00 0x00
<30 connection closed.
服务器2:

stats cachedump 12 100
ITEM memc.sess.key.ehd1nsm6icc2qsotbkcp8i9sd7 [874 b; 1406287898 s]
ITEM memc.sess.key.d3p0id333ggbd0004n4rcc4890 [875 b; 1406287868 s]
ITEM memc.sess.key.7hek9e2aakgqv9sm2bcq5fbfb3 [922 b; 1406287842 s]

事实证明,与Ubuntu 14.04(2.1.0)捆绑的memcached版本不支持
sess\u number\u of\u replications
选项。我们安装了PECL的最新版本,解决了这个问题

stats cachedump 12 100
ITEM memc.sess.key.80iie5lhm36mddkekdk488q923 [922 b; 1406287763 s]
stats cachedump 12 100
ITEM memc.sess.key.ehd1nsm6icc2qsotbkcp8i9sd7 [874 b; 1406287898 s]
ITEM memc.sess.key.d3p0id333ggbd0004n4rcc4890 [875 b; 1406287868 s]
ITEM memc.sess.key.7hek9e2aakgqv9sm2bcq5fbfb3 [922 b; 1406287842 s]