scottl31

Q: Hosting too many sites on Yosemite Server?

On our yosemite server we are hosting about 17 low traffic wordpress sites which use MySql.

 

Lately I've been noticing "Error Establishing Database Connection" when logging in to some site back ends or just accessing the sites. Most of the time, just hitting refresh works. but this seems intermittent.

 

Also, I notice that the green lights next to some web sites in server app are  off. If I reboot the server, they all come back on.

 

So my question is, is this too many sites to host? Anything else I need to do?

 

Any help appreciated,

 

Thanks,

Scott

Mac mini, OS X Server

Posted on Jan 2, 2016 11:44 AM

Close

Q: Hosting too many sites on Yosemite Server?

  • All replies
  • Helpful answers

first Previous Page 3 of 3
  • by pterobyte,

    pterobyte pterobyte Feb 24, 2016 3:23 AM in response to scottl31
    Level 6 (11,101 points)
    Servers Enterprise
    Feb 24, 2016 3:23 AM in response to scottl31

    The necessary steps for troubleshooting your problem were pretty much covered by the other posters chiming in.

     

    In addition to that, do not give any importance to the green lights in Server.app. You might as well be looking at a random light show as they are hit and miss and are not a reliable indicator whether your websites are OK or not.

     

    If your sites are really low traffic, then the culprit is unlikely to be Apache, but more likely to be MySQL. Whether OS X Server is a good web server or not is often more a philosophical rather than a technical question. It is a fine server and can handle the most common situations and amounts of traffic. If you have very specific needs, or require to always have the latest version of Apache and PHP together with a large and changing amount of extensions, then you might indeed be better off using a VPS with a UNIX flavour of your choice. From your descriptions, this doesn't seem to be the case.

     

    So, in case you haven't done so, get rid of Sophos (at least for testing purposes) and then start looking at how MySQL is holding up. You may want to tune the settings in my.cnf for higher traffic (see the MySQL included samples) and see if it helps.

  • by scottl31,

    scottl31 scottl31 Feb 24, 2016 12:40 PM in response to pterobyte
    Level 1 (13 points)
    Servers Enterprise
    Feb 24, 2016 12:40 PM in response to pterobyte

    Yes, I pretty much did what was recommended. But the problem persists. I had found some crashed tables in some databases and thought fixing them would do it but no. I backed up the server and installed the latest mysql and couldn't get anything to connect to it. So I restored. So just rebooting the server fixes everything for a while as a temporary fix.

     

    So I'm sure it's a mysql fail because I have the following errors:

     

    bash-3.2# sudo /usr/local/mysql/support-files/mysql.server restart

    ERROR! MySQL server PID file could not be found!

     

    Starting MySQL

    ERROR! The server quit without updating PID file (/usr/local/mysql/data/example.com.pid).

     

    2016-02-20 18:26:59 18279 [ERROR] InnoDB: Unable to lock ./ibdata1, error: 35

    2016-02-20 18:26:59 18279 [Note] InnoDB: Check that you do not already have another mysqld process using the same InnoDB data or log files.

     

    160127 06:52:32 mysqld_safe A mysqld process already exists

    160127 06:52:42 mysqld_safe A mysqld process already exists

     

    And in activity monitor there is only one such process.

     

    In your mention of "MySQL included samples" do you mean the things inside mycnf that are commented out?

     

    Also some strange Apache items:

     

    Ive had this error about half dozen times over the last four weeks and the server sites slow to a crawl:

    [Tue Feb 23 19:51:19.224849 2016] [mpm_prefork:error] [pid 528] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting

     

    And I found that setting to be 256, but wasn't sure what to increase it to.

     

    The other thing is that the log files in apache2 keeps changing permissions by themselves so that clicking on them in console says "you don't have permission to view". So I select the logs/apache2 directory and hit "apply to enclosed items". But then I have to do this again after couple days.

     

    I'm thinking of just exporting all users, email, websites and reset the server to it's freshly installed state. If I do that, think it would be better to go to El capitan?

     

    As always, any light anyone can shed in these is appreciated. Thanks!

  • by MrHoffman,

    MrHoffman MrHoffman Feb 24, 2016 1:56 PM in response to scottl31
    Level 6 (15,612 points)
    Mac OS X
    Feb 24, 2016 1:56 PM in response to scottl31

    You're either going to be learning more about MySQL and related tools and to start digging into why there are MySQL errors and performance issues and related, as well as a more general look at DNS and other local network considerations, or whether you want to get somebody that can access this configuration and troubleshooting it.   Or work with somebody else to host these sites on your behalf.

     

    FWIW, once the protections have been properly established, log files do not change protections by themselves, either.   Which implies there's something (else) going on, here.    But if the protections and ownerships are tangled up, that can certainly cause all manner of issues and errors.

     

    Your mail server DNS is mismatched.  That can cause issues with spam detection on other hosts, and DNS issues can also cause the local server to get confused about its own identity.

  • by scottl31,

    scottl31 scottl31 Feb 24, 2016 2:26 PM in response to MrHoffman
    Level 1 (13 points)
    Servers Enterprise
    Feb 24, 2016 2:26 PM in response to MrHoffman

    Regarding the permissions, although I learned at the beginning of OS X to repair permissions regularly, I never do that on the servers because of all the manual permission and ownership settings needed for at least the web space.

     

    As for the DNS, I'm not sure what you mean about the mismatch. I had to even go through our SP to make sure it was correct. and I run:

     

    bash-3.2# sudo changeip -checkhostname

    dirserv:success = "success"

     

    Isn't this correct?

  • by MrHoffman,

    MrHoffman MrHoffman Feb 24, 2016 2:51 PM in response to scottl31
    Level 6 (15,612 points)
    Mac OS X
    Feb 24, 2016 2:51 PM in response to scottl31

    Repairing permissions isn't particularly relevant to what OS X Server and Apache wants, particularly when folks are moving files in and out of the server directories.  Those files do need correct protections for web server access.   It's sometimes necessary to reset the settings for a content management system or site-specific requirements, and have a script specific to the local configuration, but — for instance — I'd definitely not expect the logs to get "odd" protections (presumably) when they're rotated.

     

    Your MX record translates to a domain name for the mail server, that domain name then translates to an IP address, and that IP address reverses to a different domain name.

     

    $# get the MX

    $ dig +short MX example.com

    mail.example.net

    $# get the IP

    $ dig +short mail.example.net

    192.0.2.15

    $# reverse-translate to check the name
    $ dig +short -x 192.0.2.15

    example.net

    $ # forward and reverse should match.  in your case, they don't.

  • by scottl31,

    scottl31 scottl31 Feb 24, 2016 3:24 PM in response to MrHoffman
    Level 1 (13 points)
    Servers Enterprise
    Feb 24, 2016 3:24 PM in response to MrHoffman

    I just used example.com to replace my actual domain. I ran the test like you gave with the actual domain and I changed it to example.com.

     

    bash-3.2# dig +short MX example.com

    10 mail.example.com.

    bash-3.2# dig +short mail.example.com

    173.XXX.XXX.XX

    bash-3.2# dig +short -x 173.XXX.XXX.XX

    example.com.

    bash-3.2#

  • by MrHoffman,

    MrHoffman MrHoffman Feb 24, 2016 3:51 PM in response to scottl31
    Level 6 (15,612 points)
    Mac OS X
    Feb 24, 2016 3:51 PM in response to scottl31

    That test was run from here — your domain was exposed up-thread — and those tests can be run without accessing your server.   (That's how I knew your MX was incorrect, after all.)

     

    This particular configuration issue does not effect Apache, but might point to other issues with the configuration.

     

    That you're running as root is unnecessary here, too.

  • by scottl31,

    scottl31 scottl31 Feb 24, 2016 4:58 PM in response to MrHoffman
    Level 1 (13 points)
    Servers Enterprise
    Feb 24, 2016 4:58 PM in response to MrHoffman

    I usually leave the terminal in root so I don't have to continually enter the password while working or testing solutions.

     

    I'm puzzled as to why I'd get what appears to be correct DNS when your test didn't.

     

    But I think I'm more concerned about the errors etc. I mentioned above.

  • by MrHoffman,

    MrHoffman MrHoffman Feb 24, 2016 5:51 PM in response to scottl31
    Level 6 (15,612 points)
    Mac OS X
    Feb 24, 2016 5:51 PM in response to scottl31

    If DNS is hosed — your test just showed it's mismatched, too — then the rest of the stack including the web server and other components are quite possibly also problematic.   SMTP mail servers require an A or AAAA record, which means that forward and reverse translations match, and the ones here do not.

first Previous Page 3 of 3