sharing sessions across servers

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Meghna

    sharing sessions across servers

    Hi,

    I was wondering if some one would be able to help me with this. I am
    trying to share a session across two servers and I seem to be
    experiencing some problems. I was wondering if anybody has already
    tried something like this before and hence be able to provide some
    guidance in this regard. Any suggestions, pointers or redirections to
    useful links is welcome.

    Thanks in advance for your help,
    Meghna
  • CountScubula

    #2
    Re: sharing sessions across servers

    > Hi,[color=blue]
    >
    > I was wondering if some one would be able to help me with this. I am
    > trying to share a session across two servers and I seem to be
    > experiencing some problems. I was wondering if anybody has already
    > tried something like this before and hence be able to provide some
    > guidance in this regard. Any suggestions, pointers or redirections to
    > useful links is welcome.
    >
    > Thanks in advance for your help,
    > Meghna[/color]


    This is where I have tho most fun, working on sites that scale, mostly
    across several servers. Some poeple would say use a back end database, and
    some form of cookies. Well, this is good, probably a better way.

    But, here are my quick solutions.

    Either get a 3rd server, that sits behind both front end servers, and both
    servers pull user data from it,
    by maping a shared directory between the back end server and the two
    servers,

    server 1 and 2, have a directy, like this
    /www/yourdomain/directory/_userdata

    but it is actualy a directy on the 3rd server called something like this
    /www/shared/_userdata

    or

    have one of the two servers store the data, then map a shared directory
    between the two servers,
    server 1 has a directory called
    /www/yourdomain/directory/_userdata

    and server 2 has a directory called
    /www/yourdomain/directory/_userdata
    but this directory is actualy a directory on server 1


    now, after you have all that,

    save a uniq filename as a cookie to the user, along with user id etc,
    validation cookies, etc..

    then when you need the psuedo session information, just load it off a file
    with a simple

    include("/www/yourdomain/directory/_userdata/filename")


    if you go to http://gzen.myhq.info/snippetview.php?v=var-to-file.php I have
    an example of how to save an array to file and read it back, its only a few
    lines

    --
    Mike Bradley
    http://gzen.myhq.info -- free online php tools



    Comment

    Working...