9

最近,由于我们的一个 Memcached 节点死亡(我们使用 Memcachier 作为 Memcached 提供程序),我们的 PHP Web 应用程序在几分钟内变得不可用。

这是我们的user.ini配置(Herokuuser.ini用作定义配置的地方),它有效,但显然不支持故障转移:

session.save_handler=memcached
session.save_path=${MEMCACHIER_SERVERS} # I understand this is redundant, but I just kept it as-is because I didn't write the original user.ini
session.save_path="PERSISTENT=SFSESSID ${MEMCACHIER_SERVERS}"
session.gc_maxlifetime=1209600
session.gc_probability=1

memcached.sess_binary=1
memcached.sess_sasl_username=${MEMCACHIER_USERNAME}
memcached.sess_sasl_password=${MEMCACHIER_PASSWORD}

我们的新user.ini配置,旨在提供故障转移功能

session.save_handler=memcached
session.save_path="PERSISTENT=SFSESSID ${MEMCACHIER_SERVERS}"
session.gc_maxlifetime=1209600
session.gc_probability=1

memcached.sess_sasl_username=${MEMCACHIER_USERNAME}
memcached.sess_sasl_password=${MEMCACHIER_PASSWORD}
memcached.sess_binary=1
memcached.sess_number_of_replicas=1
# I also tried memcached.sess_consistent_hash=1, to no avail

MEMCACHIER_SERVERSenv var 看起来像这样123.45678.us-east-1.heroku.prod.memcachier.com:11211,123.45678.us-east-1.heroku.prod.memcachier.com:11211:我认为这意味着我们有 2 个节点。

我们在新配置中遇到的问题是超时,以及关于 PHP 会话函数 ( session_start(), session_write_close()) 的大量错误。

为什么会这样?

Remember, we're not using Memcached inside our PHP code at all, but only as our session storage engine.

I did try contacting Memcachier support, but the customer representative could only provide recommended PHP code (which we don't need).

4

1 回答 1

1

Since the bounty expired and the question will get closed soon, I'm gonna go ahead with @jdotjdot's suggestion and switch from Memcachier to MemcachedCloud addon.

于 2017-02-10T17:39:33.377 回答