GCE Wordpress keeps showing "Error establishing database connection"

504 views
Skip to first unread message

Jude Osborn

unread,
Nov 22, 2016, 4:45:29 PM11/22/16
to gce-discussion
I have had a GCE instance with Wordpress running just fine for several months now. Suddenly I am seeing "Error establishing database connection". Nothing at all has changed with the configuration. It's just mysteriously happening.

Restarting the instance fixes the problem temporarily, but the error returns after a day or so. This leads me to believe I'm hitting a resource problem. From what I can tell CPU and disk space are fine. I'm not sure how to check memory usage, though. Nor do I see any way to allocate more memory. 

I'm not very experienced with GCE. Can anyone recommend how to investigate this problem?

Faizan (Google Cloud Support)

unread,
Nov 22, 2016, 7:44:19 PM11/22/16
to gce-discussion
Hello Jude, 

To debug this issue you can start by looking at instance serial console output. If your instance was running out of memory you will see OOM(our of memory) errors in the console output. You can also check the logs on your VM (e.g /var/log/messages CentOS /var/log/syslog Debian) to see if you can find useful debugging information. To increase the memory you can stop the instance and edit the memory or CPU parameters. You can refer to this link for the steps.

You can also collect useful monitoring information for your GCE instance through Stackdriver Monitoring.

I hope that helps.

Faizan

Jude Osborn

unread,
Nov 22, 2016, 8:10:32 PM11/22/16
to Faizan (Google Cloud Support), gce-discussion
Really helpful information. Thanks, Faizan.

--
© 2016 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
 
Email preferences: You received this email because you signed up for the Google Compute Engine Discussion Google Group (gce-dis...@googlegroups.com) to participate in discussions with other members of the Google Compute Engine community and the Google Compute Engine Team.
---
You received this message because you are subscribed to a topic in the Google Groups "gce-discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gce-discussion/7W0KX9Wxk_I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gce-discussio...@googlegroups.com.
To post to this group, send email to gce-dis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gce-discussion/be38c0ac-c141-4714-b098-ae1d365743e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Petros Iliadis

unread,
Feb 9, 2017, 12:05:24 PM2/9/17
to gce-discussion, fai...@google.com
Hi there! 
I think i have the same problem. did you find the solution?
Thanks in advance!

Jude Osborn

unread,
Feb 9, 2017, 2:40:26 PM2/9/17
to Petros Iliadis, gce-discussion, fai...@google.com

No, I haven't yet, though honestly I haven't had a chance to spend a lot of time on it yet.


--
© 2017 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043

 
Email preferences: You received this email because you signed up for the Google Compute Engine Discussion Google Group (gce-dis...@googlegroups.com) to participate in discussions with other members of the Google Compute Engine community and the Google Compute Engine Team.
---
You received this message because you are subscribed to a topic in the Google Groups "gce-discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gce-discussion/7W0KX9Wxk_I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gce-discussio...@googlegroups.com.
To post to this group, send email to gce-dis...@googlegroups.com.

Petros Iliadis

unread,
Feb 10, 2017, 10:06:18 PM2/10/17
to gce-discussion, petrosk...@gmail.com, fai...@google.com
Thanks for the reply anyway!
I upgraded the machine type and it seemed to solved this issue!
If you find something take a minute to post it!
cheers and thanks again!

Junaid Rana

unread,
Jul 18, 2017, 5:46:57 AM7/18/17
to gce-discussion, fai...@google.com
Hi There,
I am facing the same problem, how did you manage. Did you find the solution
Thanks

Jude Osborn

unread,
Jul 18, 2017, 10:48:11 PM7/18/17
to Junaid Rana, gce-discussion, fai...@google.com
In the end we had to go with something besides Wordpress (for other reasons), so I never ended up pursuing this issue. Sorry about that.

--
© 2017 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043

 
Email preferences: You received this email because you signed up for the Google Compute Engine Discussion Google Group (gce-dis...@googlegroups.com) to participate in discussions with other members of the Google Compute Engine community and the Google Compute Engine Team.
---
You received this message because you are subscribed to a topic in the Google Groups "gce-discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gce-discussion/7W0KX9Wxk_I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gce-discussio...@googlegroups.com.
To post to this group, send email to gce-dis...@googlegroups.com.

Thomas Johnston

unread,
Sep 27, 2018, 3:04:44 AM9/27/18
to gce-discussion
Petros,

I'm having a similar issue. I've downgraded to a f1-micro (1 vCPU, 0.6 GB memory) to keep our fees lower but it sounds like I may need to upgrade back to a small.

Can you tell me what specs you had before you upgraded and what you had after?

Justin Reiners

unread,
Sep 27, 2018, 8:54:29 AM9/27/18
to trjoh...@gmail.com, gce-discussion
the .6G is only about 600MB of RAM, you need a tad larger instance to run Linux, MySQL, and all those WordPress plugins reliably, I'm sure the out of memory killer is either taking out MySQL due to memory constraints, or MySQL won't start.






--
© 2018 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043

 
Email preferences: You received this email because you signed up for the Google Compute Engine Discussion Google Group (gce-dis...@googlegroups.com) to participate in discussions with other members of the Google Compute Engine community and the Google Compute Engine Team.
---
You received this message because you are subscribed to the Google Groups "gce-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gce-discussio...@googlegroups.com.

To post to this group, send email to gce-dis...@googlegroups.com.

Thomas Johnston

unread,
Sep 27, 2018, 2:06:54 PM9/27/18
to jus...@hotlinesinc.com, gce-dis...@googlegroups.com
That's definitely the case Justin. 

I skimmed through /var/log/syslog last night and oomkiller is taking out MySQL. I've upgraded to a small instance with 1.7GB memory and things have been fine for the last 12 hours. If I start seeing oomkiller in the logs again, I'll try bumping it up again.

Although I wouldn't be surprised if the team goes overboard with plugins and I'd like to keep our hosting costs down.

Do you have any tips or good references for tuning memory usage?

Justin Reiners

unread,
Sep 27, 2018, 3:24:21 PM9/27/18
to trjoh...@gmail.com, gce-discussion
There are a couple things you can do to keep SQL memory use down.

Disable performance schema if enabled in your config, and try these changes to your my.cnf. https://stackoverflow.com/questions/10676753/reducing-memory-consumption-of-mysql-on-ubuntuaws-micro-instance.

Justin Reiners

unread,
Sep 27, 2018, 3:25:26 PM9/27/18
to trjoh...@gmail.com, gce-discussion
I have about 10 sites running on a 2cpux2GB DO instance on my personal accounts, all sharing one SQL server, all WordPress without issues. How large are your tables?

Thomas Johnston

unread,
Oct 1, 2018, 1:56:26 AM10/1/18
to gce-discussion
My site is not large and the same can be said about the tables. You can find it here: https://www.animallabs.co/

That's a really good point about sharing a SQL server for multiple installs. In the mean time, I've upgraded to a small VM (default setting for the wordpress auto-installer). I've also setup monitoring on the CE via stackdriver to keep tabs on CPU usage and uptime.

This is a great resource and I'll peek at tuning our MySQL install. We also don't need a whole lot of server features so I started looking into statically building the site and dumping it into a bucket.

Lucas G

unread,
Aug 11, 2019, 12:09:17 PM8/11/19
to gce-discussion

I have the same problem

Alexandre Duval-Cid

unread,
Aug 13, 2019, 12:32:22 PM8/13/19
to gce-discussion
Hello Lucas,

I would suggest looking at your serial console logs. There you can find very useful information regarding the performance of your VM.
In this case the issue seems to be caused by a lack of memory. Maybe assigning more memory to your VM would solve your issue.

you can learn to do this here [1].

[1] https://cloud.google.com/compute/docs/instances/changing-machine-type-of-stopped-instance

On Sunday, August 11, 2019 at 12:09:17 PM UTC-4, Lucas G wrote:

I have the same problem

Lucas G

unread,
Aug 13, 2019, 1:03:06 PM8/13/19
to gce-discussion
I stopped the engine, waited a few minutes and started it. That fixed the issue - and now I decided to move my site/domain to another Wordpress hosting service

Justin Reiners

unread,
Aug 13, 2019, 1:07:37 PM8/13/19
to Lucas G, gce-discussion
Lucas,

Just fix it where it is first, more than likely it probably isn't Google's fault. I run well over 100 machines on Google Compute Engine, for a multi-million dollar company and we NEVER have downtime we haven't caused.

Check logs and see why or you might just have this issue follow you to the next web host.

On Tue, Aug 13, 2019 at 12:03 PM Lucas G <lucas...@gmail.com> wrote:
I stopped the engine, waited a few minutes and started it. That fixed the issue - and now I decided to move my site/domain to another Wordpress hosting service

--
© 2018 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043

Email preferences: You received this email because you signed up for the Google Compute Engine Discussion Google Group (gce-dis...@googlegroups.com) to participate in discussions with other members of the Google Compute Engine community and the Google Compute Engine Team.
---
You received this message because you are subscribed to the Google Groups "gce-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gce-discussio...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages