简体   繁体   English

分享php会话

[英]share php session

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. 我正在尝试使用GlusterFS在所有服务器上的多个服务器之间共享php会话php / apache级别,尽管该会话可在所有服务器上访问,但一旦我碰到另一个服务器,该会话就不会转移。 I get logged off. 我注销了。

Generally, when people want to use load-balancing, and they want one user balanced to several servers, they store sessions : 通常,当人们想要使用负载平衡,并且希望一个用户平衡到多个服务器时,他们存储会话:

  • 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). 或使用诸如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. 我不了解GlusterFS (实际上我从未听说过) ,但是我已经看到了存储在数据库和内存缓存中的会话,并且它们工作得很好。

Would one of those solutions not be OK for you ? 这些解决方案之一适合您吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM