azlyjnor
By:
azlyjnor

Wordpress Wp-Login Keeps Asking For Re-Authentication (Sessions Expire Fast)

December 26, 2014 3.7k views
WordPress Load Balancing

Hello,

I am running one instance of Wordpress running on 2 VPS, load balanced via a separate HaProxy VPS. I'm using Layer 4 Roundrobin. In addition, I have 2 MySQL databases for Master and Slave connected via HyperDB.

The set-up is similar to this tutorial:

https://www.digitalocean.com/community/tutorials/how-to-optimize-wordpress-performance-with-mysql-replication-on-ubuntu-14-04

Image of Set-Up

All VPS are running on Ubuntu 14.04.

Wordpress is logging me out every few minutes of inactivity and in addition, I am receiving redirect loops at wp-login.php:

http://domain.com/wp-login.php?redirect_to=http://domain.com/wp-admin%2F&reauth=1

I have WP on debug and this are the errors that gets thrown:

Notice: Undefined variable: write in /storage-pool/domain.com/wp-content/db.php on line 557
Notice: Undefined variable: write in /storage-pool/domain.com/wp-content/db.php on line 592

Line 557: if ( !$use_master && !$write && !isset( $ignore_slave_lag )
Line 592: if ( !$use_master && !$write && !isset( $ignore_slave_lag )

Can anyone advise on how I can resolve this?

1 comment
  • I would wager it has something to do with the layer 4 load balancing. I believe wordpress uses _SESSION to store pertinent info on the individual server. With layer 4, will the request persistently seek out the same droplet, or will it grab whatever server is available from the load balancer? If it is the later, I would guess that it will boot your session every time it gets the server without the SESSION info written. [Please note: neither wordpress or load balancing is my strong suit]

Be the first one to answer this question.