Want more timely Centmin Mod News Updates?
Become a Member

Pre-Install question

Discussion in 'Install & Upgrades or Pre-Install Questions' started by denellum, Jan 14, 2017.

  1. denellum

    denellum Member

    88
    22
    8
    May 11, 2016
    Dallas
    Ratings:
    +32
    Local Time:
    6:22 PM
    1.13.8
    10.1.29
    first off, I've been using centminmod now for a few years. It's getting to the point however that on some of my sites I need a dedicated database server. Does centminmod support this?


    Maybe with 2 installs? Disable Nginx on one node and disable mariadb on the other?

    Let me know what you think if it's possible (and clean) to do this, thanks as always for this wonderful set of scripts :)
     
  2. SFLC

    SFLC Active Member

    223
    59
    28
    Dec 4, 2016
    The Canadas
    Ratings:
    +112
    Local Time:
    1:22 AM
    1
    10
    You could probably just setup your new server, copy over your databases, switch your sites to them and stop mysql on the original server (or don't even bother, your original servers mysql won't be used so it won't take many resources at that point).
     
  3. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    9:22 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    Centmin Mod supports this but it ain't automated, you'd have to do some manual leg work :)

    Getting Started Guide Step 4 and CSF Firewall page cover how to whitelist your web and db server's ip respectively to allow web and db servers to connect to each other for MySQL 3306 port. Then you need to setup new mysql user grants on db server to allow the web server's ip address to connect to db server's mysql server.

    Yes that's best way 2x Centmin Mod installs and stop/disable php-fpm, nginx and memcached servers on db instance. This also makes it easy if your web server is down, to just start up the stopped servers and just update domain dns to db server ip to have a working site again.
     
  4. denellum

    denellum Member

    88
    22
    8
    May 11, 2016
    Dallas
    Ratings:
    +32
    Local Time:
    6:22 PM
    1.13.8
    10.1.29
    Easy peasy! Or atleast i think so :) starting it up now!
     
  5. denellum

    denellum Member

    88
    22
    8
    May 11, 2016
    Dallas
    Ratings:
    +32
    Local Time:
    6:22 PM
    1.13.8
    10.1.29
    So I just want to follow up with this, After everything is installed and the applications on each server are disabled. I will just need to run "csf -a IP" of each... is there a way to set the port to the mariaDB port 3306?
     
  6. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    9:22 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
  7. denellum

    denellum Member

    88
    22
    8
    May 11, 2016
    Dallas
    Ratings:
    +32
    Local Time:
    6:22 PM
    1.13.8
    10.1.29
    Ah! So I know I'd need to do a tcp "in" rule on the "DB" side... would I need to also do an "out" rule as well on the "app" side?
     
  8. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    9:22 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    Yup web server (app) needs to be able to connect to remote server's port. Why I love CSF Firewall, fine grain control and security for your server(s) :)
     
  9. denellum

    denellum Member

    88
    22
    8
    May 11, 2016
    Dallas
    Ratings:
    +32
    Local Time:
    6:22 PM
    1.13.8
    10.1.29
    Hopefully last question...
    added this to the app server :
    tcp|out|d=3306|s=IP

    and this to the DB :
    tcp|in|d=3306|s=IP

    Restarted CSF :
    csf -r

    This SHOULD be all i need to do.. correct?
    PS Thank you so much for all this help:)
     
  10. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    9:22 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
  11. denellum

    denellum Member

    88
    22
    8
    May 11, 2016
    Dallas
    Ratings:
    +32
    Local Time:
    6:22 PM
    1.13.8
    10.1.29
    So i did just as the guy on that forum did, and im getting a MYSQL time out error. I noticed i added the TCP rules to /etc/csf.allow instead of /etc/csf/csf.allow so i made that change and reloaded the firewall... still a mysql time out error... rebooted... same error.
     
  12. denellum

    denellum Member

    88
    22
    8
    May 11, 2016
    Dallas
    Ratings:
    +32
    Local Time:
    6:22 PM
    1.13.8
    10.1.29
    now im trying a [root@app01 log]# telnet DB-IP 3306
    getting a time out :/
     
  13. denellum

    denellum Member

    88
    22
    8
    May 11, 2016
    Dallas
    Ratings:
    +32
    Local Time:
    6:22 PM
    1.13.8
    10.1.29
    Ugh nvm got it... i was being stupid.
    i was looking at # tcp/udp|in/out|s/d=port|s/d=ip
    without reading "s/d=ip : EITHER source OR destination IP address"
    so i was doing s/d instead of JUST s.

    Seriously thank you for all of the help. time to donate :)
    Enjoy a beer/coffee/something :p
     
    Last edited: Jan 17, 2017
  14. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    9:22 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    ah glad to see you managed to figure it out - learning is fun :D
     
  15. denellum

    denellum Member

    88
    22
    8
    May 11, 2016
    Dallas
    Ratings:
    +32
    Local Time:
    6:22 PM
    1.13.8
    10.1.29
    okay what am i doing wrong, i had to migrate to a KVM and now its borked...

    web tier :
    tcp|out|d=3306|d=DBIP
    DB tier :
    tcp|in|s=3306|s=WEBIP
     
  16. denellum

    denellum Member

    88
    22
    8
    May 11, 2016
    Dallas
    Ratings:
    +32
    Local Time:
    6:22 PM
    1.13.8
    10.1.29
    nvm ...
    tcp|in|d=3306|s=WEBIP
     
  17. denellum

    denellum Member

    88
    22
    8
    May 11, 2016
    Dallas
    Ratings:
    +32
    Local Time:
    6:22 PM
    1.13.8
    10.1.29
    Ugh, trying to do this again and im still getting an error and not quite sure what im doing wrong.. in the file : /etc/csf/csf.allow

    i added on the "app side"
    tcp|out|d=3306|d=DB_SERVER_IP


    and on the "database side"
    tcp|in|d=3306|s=APP_SERVER_IP

    and I'm getting :
    [07:58][root@APP public]# mysql -u root -p -h DB_SERVER_IP
    Enter password:
    ERROR 1130 (HY000): Host 'APP_SERVER_IP' is not allowed to connect to this MariaDB server

    Is there something im doing wrong?
     
  18. denellum

    denellum Member

    88
    22
    8
    May 11, 2016
    Dallas
    Ratings:
    +32
    Local Time:
    6:22 PM
    1.13.8
    10.1.29
    doh! forgot to edit
    Code:
     /usr/local/src/centminmod/addons/mysqladmin_shell.sh
    
    and edit the line
    Code:
    MYSQLHOSTNAME='APP_SERVER_IP'
    
     
  19. eva2000

    eva2000 Administrator Staff Member

    58,893
    12,490
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +19,122
    Local Time:
    9:22 AM
    Nginx 1.31.x
    MariaDB 10.x/11.4+/12.3+
    so working now ? :)
     
  20. denellum

    denellum Member

    88
    22
    8
    May 11, 2016
    Dallas
    Ratings:
    +32
    Local Time:
    6:22 PM
    1.13.8
    10.1.29
    Yep! Sometimes you have to set back and take a break lol.