PHP session handling on Amazon EC2 with Elastic Load Balancer
All the problem has occurred since I have adapted Load Balance on my EC2 instance.
I have decided to access and manage session on an independent instance which is not managed by Load Balance at all. While my web server (using Apache and PHP5) is using Elastic Load Balancer.
I have tried to implement Memcached and after that I have erased Memcached and tried to implement MongoSession.
But I have realized that the common problem is that I cannot connect to either Memcached and Mongosession correctly. Somehow I checked that barely(?) my Auto Scaling inst开发者_StackOverflowance can access to the independent instance. MongoDB actually creates some session values. But cannot access it successfully after creating and extremely slows down my whole site.
Besides choosing between memcached and mongosession problem, how can I implement
session handling with another instance(server)?
My Problem has solved with session implement with MongoSession and Memcached
I have set those two on separate Instance which is using as DB server.
That server is not load balanced.
Session handling is very stable and even faster than before (I was using PHP default file session handler)
I've just tried a NFS mount to a session-dedicated EC2 instance :
http://hunterford.me/amazon-ec2-and-nfs/
also in French, with more explanations :
http://sylvaingrotte.free.fr/tuto/mount-instance-ec2-nfs.php
Works fine but : If you put auto-scaling on, the instances won't be recognized because of the etc/exports (you must declare the url of the instance before using it)
I've tried it successfully with four static instances mounted on a session-dedicated one for more than a week.
Hope it will help!
精彩评论