本文介绍了分享php会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近遇到了一个问题,我一直在努力解决它,但运气不佳.我正在尝试使用 GlusterFS 在所有服务器上的多个服务器 php/apache 级别上共享 php 会话,但是,尽管可以在所有服务器上访问该会话,但一旦我遇到不同的服务器,该会话就不会传输.我被注销了.

I recently ran in a problem and I've been trying to resolve it with out any luck. I'm, trying to share the php session across several servers php/apache level on all server using GlusterFS,however, although the session is accessible on all servers the session does not get transfer once I hit a different sever. I get logged off.

推荐答案

通常,当人们想要使用负载平衡,并且他们希望一个用户平衡到多个服务器时,他们会存储会话:

Generally, when people want to use load-balancing, and they want one user balanced to several servers, they store sessions :

  • 使用可从每个网络服务器访问的数据库
  • 或使用诸如 memcached 之类的东西——这是一个分布式缓存服务器(并且确实运行良好当您想要存储这种临时数据,并且您有多个服务器需要访问它时).
  • either using a database, which is accessible from every web-servers
  • or using something like memcached -- which is a distributed cache server (and really works well when you want to store that kind of temporary data, and you have several servers that need to access it).

我不知道 GlusterFS (我实际上从未听说过),但我见过存储在数据库和 memcached 中的会话,而且它们工作得很好.

I don't know about GlusterFS (I have actually never heard of it), but I've seen sessions stored in either database and memcached, and those work quite fine.

其中一种解决方案不适合您吗?

Would one of those solutions not be OK for you ?

这篇关于分享php会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 22:22