Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Mon Mar 11, 2013 6:32 am 
Offline
Junior Member

Joined: Fri Dec 21, 2012 8:35 am
Posts: 31
how do you run mysqltuner.pl?

I ran:

wget mysqltuner.pl

and it said it saved it as index.html

perl mysqltuner.pl

does not run it for me.. that is what I picked up from another thread


Top
   
PostPosted: Mon Mar 11, 2013 6:33 am 
Offline
Senior Member

Joined: Fri Feb 17, 2012 8:20 pm
Posts: 365
cfauver wrote:
Nuvini wrote:
Can you manually login to mysql? use mysql -u <user> -p <enter>, then fill in password. You could then also execute show full processlist; to see if it's very busy.


Code:
mysql> show full processlist;
+-----+---------+-----------+------+---------+------+-------+-------------------                                     ----+
| Id  | User    | Host      | db   | Command | Time | State | Info                                                       |
+-----+---------+-----------+------+---------+------+-------+-------------------                                     ----+
| 166 | cfauver | localhost | NULL | Sleep   |   67 |       | NULL                                                       |
| 184 | root    | localhost | NULL | Query   |    0 | NULL  | show full processl                                     ist |
+-----+---------+-----------+------+---------+------+-------+-------------------                                     ----+


That looks alright, it should be able to connect. Does the error log from your webserver say anything about mysql?


Top
   
PostPosted: Mon Mar 11, 2013 6:45 am 
Offline
Junior Member

Joined: Fri Dec 21, 2012 8:35 am
Posts: 31
Code:
root@mail ~: tail -f /var/log/nginx/error.log
2013/03/10 09:24:17 [error] 10650#0: *9253 open() "/var/www/nginx-default/proxyheader.php" failed (2: No such file or directory), client: 58.218.199.250, server: localhost, request: "GET http://www.verysurf.com/proxyheader.php HTTP/1.1", host: "www.verysurf.com"
2013/03/10 11:23:51 [error] 10650#0: *15550 open() "/var/www/nginx-default/robots.txt" failed (2: No such file or directory), client: 198.20.70.114, server: localhost, request: "GET /robots.txt HTTP/1.1", host: "74.207.224.68"
2013/03/10 20:56:05 [error] 2105#0: *2008 open() "/var/www/nginx-default/aop0igj.php" failed (2: No such file or directory), client: 58.218.199.250, server: localhost, request: "GET http://216.245.211.138/aop0igj.php HTTP/1.1", host: "216.245.211.138"


same as before... is that the right log?


Top
   
PostPosted: Mon Mar 11, 2013 6:47 am 
Offline
Junior Member

Joined: Fri Dec 21, 2012 8:35 am
Posts: 31
Code:
root@mail ~: wget http://mysqltuner.com/mysqltuner.pl
--2013-03-11 06:46:41--  http://mysqltuner.com/mysqltuner.pl
Resolving mysqltuner.com... 2001:4801:7901:0:abc5:ba2c:0:1, 198.61.150.28
Connecting to mysqltuner.com|2001:4801:7901:0:abc5:ba2c:0:1|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://github.com/rackerhacker/MySQLTuner-perl [following]
--2013-03-11 06:46:41--  https://github.com/rackerhacker/MySQLTuner-perl
Resolving github.com... 207.97.227.239
Connecting to github.com|207.97.227.239|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 31540 (31K) [text/html]
Saving to: `mysqltuner.pl'

100%[======================================>] 31,540      --.-K/s   in 0.01s

2013-03-11 06:46:41 (2.18 MB/s) - `mysqltuner.pl' saved [31540/31540]

root@mail ~: chmod +x mysqltuner.pl
root@mail ~: ./mysqltuner.pl
./mysqltuner.pl: line 4: syntax error near unexpected token `newline'
./mysqltuner.pl: line 4: `<!DOCTYPE html>'
root@mail ~:


What am I doing wrong here??


Top
   
PostPosted: Mon Mar 11, 2013 6:50 am 
Offline
Senior Member

Joined: Tue Feb 19, 2008 10:55 am
Posts: 164
Nuvini wrote:

Is it really traffic though? The graphs were showing like, 300kbit max, that shouldn't cause these issues.


I didn't see the graphs, but having done so now, it looks more likely a db issue. however, the db issue is highlighting a problem of too high pm.max_children, and that's exacerbating the issue, and is the reason the server become unresponsive.


Top
   
PostPosted: Mon Mar 11, 2013 6:53 am 
Offline
Senior Member

Joined: Tue Feb 19, 2008 10:55 am
Posts: 164
cfauver wrote:
[/code]

What am I doing wrong here??


you're trying to execute html by the looks of it.

try

wget mysqltuner.pl

that's what I've always used. then chmod and the rest.
the first line should be #!/usr/bin/perl -w


Top
   
PostPosted: Mon Mar 11, 2013 6:53 am 
Offline
Senior Member

Joined: Fri Feb 17, 2012 8:20 pm
Posts: 365
cfauver wrote:
Code:
root@mail ~: wget http://mysqltuner.com/mysqltuner.pl
--2013-03-11 06:46:41--  http://mysqltuner.com/mysqltuner.pl
Resolving mysqltuner.com... 2001:4801:7901:0:abc5:ba2c:0:1, 198.61.150.28
Connecting to mysqltuner.com|2001:4801:7901:0:abc5:ba2c:0:1|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://github.com/rackerhacker/MySQLTuner-perl [following]
--2013-03-11 06:46:41--  https://github.com/rackerhacker/MySQLTuner-perl
Resolving github.com... 207.97.227.239
Connecting to github.com|207.97.227.239|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 31540 (31K) [text/html]
Saving to: `mysqltuner.pl'

100%[======================================>] 31,540      --.-K/s   in 0.01s

2013-03-11 06:46:41 (2.18 MB/s) - `mysqltuner.pl' saved [31540/31540]

root@mail ~: chmod +x mysqltuner.pl
root@mail ~: ./mysqltuner.pl
./mysqltuner.pl: line 4: syntax error near unexpected token `newline'
./mysqltuner.pl: line 4: `<!DOCTYPE html>'
root@mail ~:


What am I doing wrong here??


This redirects to github. So do apt-get install git && git clone git://github.com/rackerhacker/MySQLTuner-perl.git - that'll make a directory and place the files in there.


Top
   
PostPosted: Mon Mar 11, 2013 7:07 am 
Offline
Junior Member

Joined: Fri Dec 21, 2012 8:35 am
Posts: 31
Code:
root@mail ~: wget mysqltuner.pl
--2013-03-11 07:06:35--  http://mysqltuner.pl/
Resolving mysqltuner.pl... 2001:4801:7901:0:abc5:ba2c:0:1, 198.61.150.28
Connecting to mysqltuner.pl|2001:4801:7901:0:abc5:ba2c:0:1|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://raw.github.com/rackerhacker/MySQLTuner-perl/master/mysqltuner.pl [following]
--2013-03-11 07:06:35--  https://raw.github.com/rackerhacker/MySQLTuner-perl/master/mysqltuner.pl
Resolving raw.github.com... 199.27.74.133
Connecting to raw.github.com|199.27.74.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 41847 (41K) [text/plain]
Saving to: `index.html.3'

100%[======================================>] 41,847      --.-K/s   in 0.04s

2013-03-11 07:06:35 (1010 KB/s) - `index.html.3' saved [41847/41847]



Code:
root@mail ~: apt-get install git && git clone git://github.com/rackerhacker/MySQLTuner-perl.git
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package git is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package git has no installation candidate


Top
   
PostPosted: Mon Mar 11, 2013 7:12 am 
Offline
Senior Member

Joined: Tue Feb 19, 2008 10:55 am
Posts: 164
mv index.html.3 mysqltuner.pl
head mysqltuner.pl
(check first line, if ok, then)
chmod +x mysqltuner.pl
./mysqltuner.pl


Top
   
PostPosted: Mon Mar 11, 2013 7:15 am 
Offline
Junior Member

Joined: Fri Dec 21, 2012 8:35 am
Posts: 31
okay thanks, as you can see I'm very much still learning linux.. this is what it outputs

Code:
root@mail ~: ./mysqltuner.pl

 >>  MySQLTuner 1.2.0 - Major Hayden <major@mhtx.net>
 >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
 >>  Run with '--help' for additional options and output filtering
[OK] Logged in using credentials from debian maintenance account.

-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.1.67-0ubuntu0.10.04.1
[OK] Operating on 32-bit architecture with less than 2GB RAM

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 53M (Tables: 116)
[!!] InnoDB is enabled but isn't being used
[!!] Total fragmented tables: 14

-------- Security Recommendations  -------------------------------------------
[OK] All database users have passwords assigned

-------- Performance Metrics -------------------------------------------------
[--] Up for: 46m 39s (10K q [3.601 qps], 853 conn, TX: 32M, RX: 2M)
[--] Reads / Writes: 89% / 11%
[--] Total buffers: 58.0M global + 2.6M per thread (151 max threads)
[!!] Maximum possible memory usage: 454.4M (91% of installed RAM)
[OK] Slow queries: 0% (0/10K)
[OK] Highest usage of available connections: 3% (5/151)
[OK] Key buffer size / total MyISAM indexes: 16.0M/10.2M
[OK] Key buffer hit rate: 99.3% (75K cached / 546 reads)
[OK] Query cache efficiency: 33.0% (2K cached / 6K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 237 sorts)
[!!] Temporary tables created on disk: 46% (769 on disk / 1K total)
[OK] Thread cache hit rate: 99% (5 created / 853 connections)
[!!] Table cache hit rate: 7% (64 open / 891 opened)
[OK] Open file limit used: 12% (124/1K)
[OK] Table locks acquired immediately: 99% (3K immediate / 3K locks)

-------- Recommendations -----------------------------------------------------
General recommendations:
    Add skip-innodb to MySQL configuration to disable InnoDB
    Run OPTIMIZE TABLE to defragment tables for better performance
    MySQL started within last 24 hours - recommendations may be inaccurate
    Reduce your overall MySQL memory footprint for system stability
    Enable the slow query log to troubleshoot bad queries
    When making adjustments, make tmp_table_size/max_heap_table_size equal
    Reduce your SELECT DISTINCT queries without LIMIT clauses
    Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
  *** MySQL's maximum memory usage is dangerously high ***
  *** Add RAM before increasing MySQL buffer variables ***
    tmp_table_size (> 16M)
    max_heap_table_size (> 16M)
    table_cache (> 64)


Top
   
PostPosted: Mon Mar 11, 2013 7:23 am 
Offline
Senior Member

Joined: Tue Feb 19, 2008 10:55 am
Posts: 164
so first off
mysqlcheck -Ac --auto-repair
mysqlcheck -Aa --auto-repair
mysqlcheck -Ao --auto-repair

for the above three commands, you might need to add -u root -p

in my.cnf

max_connections = 20 # this should be higher than the max number of php processes
tmp_table_size = 32M
max_heap_table_size = 32M
table_cache = 512
log_slow_queries = /var/log/mysql/mysql-slow.log # this is for debian or ubuntu, centos might be different
long_query_time = 1

if the config option isn't specified, then add it under [mysqld]


Top
   
PostPosted: Mon Mar 11, 2013 8:04 am 
Offline
Junior Member

Joined: Fri Dec 21, 2012 8:35 am
Posts: 31
chesty wrote:
so first off
mysqlcheck -Ac --auto-repair
mysqlcheck -Aa --auto-repair
mysqlcheck -Ao --auto-repair

for the above three commands, you might need to add -u root -p


Okay I did this, it said it found errors in two of my databases and it says it repaired them. Now I believe WP-Autoblog was not the culprit. All my sites are serving except for 2 sites that I run a plugin called dsIDXPress (for real estate agents). Both of those sites are not serving and it was their 'options' table where all the errors were occurring.

Quote:
in my.cnf

max_connections = 20 # this should be higher than the max number of php processes
tmp_table_size = 32M
max_heap_table_size = 32M
table_cache = 512
log_slow_queries = /var/log/mysql/mysql-slow.log # this is for debian or ubuntu, centos might be different
long_query_time = 1

if the config option isn't specified, then add it under [mysqld]


I do not have a my.cnf file in my /etc folder, so do I just create a new one in nano and that has the values you gave me and then restart mysql? What do you mean "add it under mysqld?
Code:
service mysql retart

?

I wanted to try to deactivate this plugin from mysql query, but I think since I have 5 databases I have to tell it which one, I found this in another tutorial:

Code:
mysql> SELECT * FROM wp_options WHERE option_name = 'active_plugins';


I receive:

Code:
ERROR 1046 (3D000): No database selected


Top
   
PostPosted: Mon Mar 11, 2013 8:29 am 
Offline
Senior Member

Joined: Fri Feb 17, 2012 8:20 pm
Posts: 365
My.cnf: This is the config file of mysql. So it will probably be here: /etc/mysql/my.cnf
In this file there should be some text and at some point [mysqld] - Place the config just below [mysqld] (make sure there aren't any duplicate lines if you simply copy/paste, the lines may already be there with different values.

After that you must restart mysql, which you can do with the command: service mysql restart (or /etc/init.d/mysql restart)

The query you run: The error kinda says it, no database selected. First run the following: USE <DB NAME>; - after that you can run SELECT * FROM wp_options WHERE option_name = 'active_plugins';


Top
   
PostPosted: Mon Mar 11, 2013 8:30 am 
Offline
Senior Member

Joined: Tue Feb 19, 2008 10:55 am
Posts: 164
your my.cnf file is probably

/etc/mysql/my.cnf

it should already exist, but some of the options I specified might not exist in that file, so if they don't, add them under the line that says

[mysqld]

you shouldn't need to modify database tables directly, you should do it though the web page wp-admin for that site.
if the web site is down, then you'll need to look in your web servers errors.log to see what's up.


Top
   
PostPosted: Mon Mar 11, 2013 8:40 am 
Offline
Junior Member

Joined: Fri Dec 21, 2012 8:35 am
Posts: 31
THANK YOU NUVINI AND CHESTY! THANK YOU!

I am up and running.. weird I actually did change the active plugins to null but they are still active.. but I am all back up..

Now.. the question is why did my IO spike and is it going to happen again or was it as simple as changing some of those settings??


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group