Get the most out of your Centmin Mod LEMP stack
Become a Member

Security Load Balancing 2

Discussion in 'System Administration' started by jacknguyen, May 29, 2024.

  1. jacknguyen

    jacknguyen Member

    39
    6
    8
    Jun 3, 2022
    Ratings:
    +9
    Local Time:
    6:14 PM
    1.5
    10
    Hi everyone, currently I have an idea about using 2 VPS to host a WordPress website. One VPS located in CA will be used to store the source code and images, and the other VPS located in FR will be used to store the database. Both will have Centmin Mod installed.
    I'm not sure if this setup is reasonable or not?

     
  2. eva2000

    eva2000 Administrator Staff Member

    52,787
    12,080
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,607
    Local Time:
    8:14 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    For real high availability you need more than 2 servers.

    Important note - you'd need all know-how knowledge of how to install, configure, manage and troubleshoot all the moving pieces of software and setups outlined below. Otherwise any downtime or issues due to your lack of knowledge would effectively cancel out any benefits of such a high availability configuration.

    A typical setup minimum setup would be load balanced web servers with load balancer failover and mysql load balanced backends either using mysql master/slave replication or mysql/mariadb galera cluster and then distributed storage via something like GlusterFS with/without NFS or lsyncd/csync and finally a dedicated memcached/redis server(s) for any caching used.

    web end
    • 3x web server backends
    • 2x web load balancers with failover (keepalived/pacemaker etc) talking to those 3x web server backends
    distributed storage
    • GlusterFS with/without NFS or lsyncd/csync or even a mix for specific types of files/directories with 3-5 servers
    mysql end using mysql master/slave replication
    • 2x mysql load balancers talking to the mysql master/slave replication with failover (keepalived/pacemaker etc)
    • 1x mysql master
    • 2x mysql slave
    or mysql end using mysql/mariadb galera cluster
    • 2x mysql load balancers talking to the mysql master/slave replication with failover
    • 3x mariadb/mysql galera cluster
    Then for memcached/redis need memcache/redis server
    • 1x redis/memcached server
    • or best to choose redis in redis master/slave/sentinel based high availability setup which consists of 1x redis master + 1 redis slave + 3x redis sentinel with quorum of 2. Sentinels handle redis master failure/failover to redis slave
    Then
    • For web load balancers either nginx or haproxy
    • For mysql load balancers either haproxy, proxysql or mariadb maxscale
    So that is a total of between 14 to 20 servers you'd need. If you want real high availability, you'd also want a 2nd set of some of these servers in standby configuration too or as a staging set, so you can test changes on the 2nd test set before live production deployment.

    You'd need to use dedicated servers for this not VPS unless you have VPS which are not on same VPS host node and have private secure LAN network communication between all VPS servers with at least 1Gbps network connectivity.

    Also posted at Load Balancing | Centmin Mod Community asked same question and is pretty much still the same answer.

    Google has alot of guides for haproxy and glusterfs/nfs and nginx as a load balancer !

    Centmin Mod is provide as is, so short of scripted related bugs or issues, any further optimisation to the web stack components - nginx, php-fpm, mariadb mysql, csf firewall etc or web app specific configurations are left to the Centmin Mod user to deal with. So I do not provide any free support for such.

    However, Centmin Mod users are free to help each other out and ask questions or give answers on this community forum. My hopes are that this community forum evolves so that more veteran long time Centmin Mod users help new Centmin Mod users out :)

    Centmin Mod's Nginx has all the nginx modules it requires for you to configure nginx reverse proxy, nginx based load balancing and proxy caching (with exception of the shared file system you'd need i.e. NFS, GlusterFS and any mysql database cluster/replication). You just have to configure it yourself :)

    For nginx reverse proxy & load balancing read the documentation, tutorial and guides below
     
  3. jacknguyen

    jacknguyen Member

    39
    6
    8
    Jun 3, 2022
    Ratings:
    +9
    Local Time:
    6:14 PM
    1.5
    10
    Thank you so much, bro @eva2000 . I am researching all the steps and knowledge you mentioned above, it's amazing.