I recall when setting up a ssl proxy (which is the config file I am using below) this could be broken all together :/
This weekend I'll try and test this out.
Below is a short, high level, off the top of my head, tutorial for load balancing setup
(Off the top of my head means completely and totally untested)
Assumptions:
- You have multiple pms instances running at different ip addresses with the same setup, preferences.xml file, and content database.
- It is very important that the content databases are the same. How to achieve this is beyond the scope of this tutorial.
- One of these will need to serve as the 'master' and will be mapped to plex.tv
- All of the other servers will run as 'slaves' and should not be mapped to plex.tv
- Have at least two 'slaves' (three servers total)
Design:
- The 'master' server will run rtt and pms (in this tut they will not run at the same time, but they could)
- The 'master' server should have nat configured so that PMS can be mapped to plex.tv
- The 'master' server does not need to have the same content database but does not need to actually have access to the data
Super Advanced Design:
- If you really really know what your are doing, rtt and pms don't need to be on the same server or local ip, but do need to have the same internet accessible ip.
The master pms also needs to have the SAME ip as the rtt instance. (i.e be on the same computer).
****The next part can be done in more than one way but I will only explain one to save time***
**important** Do not launch RTT (apache/nginx) yet.
Launch PMS if it is not already running.
Map it to plex.tv if it is not already.
Share this server to all of the users if it is not already.
Quit PMS (do not unmap or log our prior to this)
Installing and configuring RTT is the step that deserves it's own very long explanation and tutorial.
For now, I will give a high level explanation:
First, you will need to download/fork RTT and customize it such that when requests come in,
they are mapped to one of the slaves by the x-client-identifier (will be referred to as 'client') header. (This map will need to be saved locally in a db of some sort)
For example: look the client up in the db. If it exists already, pull its current slave.
If it doesn't exist, add a mapping to a 'random' slave and save it in the db.
Then, set the $destserver variable to this slave's ip; RTT will handle the rest.
All of these changes should be REPLACE line 13 in this sample config file. (This is also the config you should use)
Note that none of the parameters under RTT Client mode need to be changed.
Also note that because you are not setting the $nameduseronly parameter to true you can ignore the $lbuuidkvp array.
Also also note that contrary to the prior 2 notes ( :P ) in "production" you should in fact set $nameduseronly=TRUE and populate the $lbuuidkvp usernames (machine identifiers aren't necessary).
Lastly, run rtt on the master server. If everything is working properly, than pms should work like "normal".
Tail the log file to see if things are being load balanced.