Git Product home page Git Product logo

plexloadbalancer's Introduction

Plex Load Balancer

NOTE: This is super super beta. I did have it running without issue for roughly a day but just recently I started running into issues with the slave complaining a lot about not being able to write to the database and seemingly crashing because of it.

This nginx configuration effectively load balances the Plex Transcoder across multiple machines.

Environment Configuration

The master Plex server has read/write access to the database. The slaves, on the other hand, do not. The master server is configured like any normal Plex server only the application data is hosted on an external share (could be local, but you'd have to mount it from the slaves to access it).

The slaves mount the external Plex application data as read only. The exact flags that I used are:

//nas/cache on /mnt/cache type cifs (ro,relatime,vers=1.0,cache=strict,domain=TOWER,uid=998,forceuid,gid=997,forcegid,addr=10.0.19.142,file_mode=0777,dir_mode=0777,nounix,serverino,rsize=61440,wsize=65536,actimeo=1)

Where uid and gid are the group and user id's of plex. You can determine that with:

sudo -u plex id

I believe that the only necessary mount flags would be:

ro, uid=998, gid=997, file_mode=0777, dir_mode=0777

Once the share is mounted, you have to symlink the appropriate files/folders to the slaves Plex application data directory. The symlinks are set up as follows:

ScreenShot

The Preferences.xml should be the same, but should be copied from the r/o directory. This allows you to modify configs on the slaves, but still maintain the same Plex "server ID" that is used by plex.tv

The reason we get so granular with the symlinks is because we don't want to symlink the "com.plexapp.plugins.library.db-shm" or "com.plexapp.plugins.library.db-shm" files. Those files are the temporary database files that need to be created by the local Plex instance. If Plex can't read or write to those files it will refuse to start. When Plex attempts to flush those files out to the main database, it throws errors in the log, but nothing mission critical as far as I can tell.

Note: This whole thing is setup behind a NAT. Plex thinks it's going to a single server when in reality it is being managed by nginx. I currently have everything come in as follows:

Internet --:32400--> Router --:80--> nginx --:32400--> appropriate Plex instance

Issues

There are still some weird issues with files not wanting to play. This is something I believe can be remedied by a more granular nginx config file. I'm not versed enough in nginx to really determine what needs to be load balanced. That's why I'm posting it up here :)

plexloadbalancer's People

Contributors

ehvanr avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.