1 |
On Wed, Jul 20, 2011 at 3:30 PM, Grant <emailgrant@×××××.com> wrote: |
2 |
> I ran into an out of memory problem. The first mention of it in the |
3 |
> kernel log is "mysqld invoked oom-killer". I haven't run into this |
4 |
> before. I do have a swap partition but I don't activate it based on |
5 |
> something I read previously that I later found out was wrong so I |
6 |
> suppose I should activate it. Is fstab the way to do that? I have a |
7 |
> commented line in there for swap. |
8 |
|
9 |
Yes, just uncomment it and should be automatic. (you can use "swapon" |
10 |
to enable it without rebooting) |
11 |
|
12 |
> Can anyone tell how much swap this is: |
13 |
> |
14 |
> /dev/sda2 80325 1140614 530145 82 Linux swap / Solaris |
15 |
> |
16 |
> If it's something like 512MB, that may not have prevented me from |
17 |
> running out of memory since I have 4GB RAM. Is there any way to find |
18 |
> out if there was a memory leak or other problem that should be |
19 |
> investigated? |
20 |
|
21 |
That's 512MB. You can also create a swap file to supplement the swap |
22 |
partition if you don't want to or aren't able to repartition. |
23 |
|
24 |
I'd check the MySQL logs to see if it shows anything. Maybe check the |
25 |
settings with regard to memory upper limits (Google it, there's a lot |
26 |
of info about MySQL RAM management). |
27 |
|
28 |
If you're running any other servers that utilize MySQL like Apache or |
29 |
something, check its access logs to see if you had an abnormal number |
30 |
of connections. Bruteforce hacking or some kind of flooding/DOS attack |
31 |
might cause it to use more memory than it ordinarily would. |
32 |
|
33 |
A Basic "what's using up my memory?" technique is to log the output of |
34 |
"top" by using the -b command. Something like "top -b > toplog.txt". |
35 |
Then you can go back to the time when the OOM occurred and see what |
36 |
was using a lot of RAM at that time. |