Changeset 11
- Timestamp:
- 08/03/07 01:55:56 (1 year ago)
- Files:
-
- mysqltuner.pl (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
mysqltuner.pl
r10 r11 137 137 my $mysqllogin; 138 138 sub setup_mysql_login { 139 if ( - f"/etc/psa/.psa.shadow" ) {139 if ( -r "/etc/psa/.psa.shadow" ) { 140 140 # It's a Plesk box, use the available credentials 141 141 $mysqllogin = "-u admin -p`cat /etc/psa/.psa.shadow`"; 142 142 my $loginstatus = `mysqladmin ping $mysqllogin 2>&1`; 143 143 if ($loginstatus =~ /mysqld is alive/) { 144 goodprint "Successfully logged into MySQL using Plesk's credentials.\n";144 # Login was successful, but we won't say anything to save space 145 145 return 1; 146 146 } else { … … 160 160 # Login was successful, but we won't say anything to save space 161 161 } else { 162 #badprint "Successfully authenticated with no password - SECURITY RISK!\n";163 162 badprint "Successfully authenticated with no password - SECURITY RISK!\n"; 164 163 } … … 176 175 my $loginstatus = `mysqladmin ping $mysqllogin 2>&1`; 177 176 if ($loginstatus =~ /mysqld is alive/) { 178 print "\n".$good." Successfully logged into MySQL using provided credentials.\n"; 177 # Login was successful, but we won't say anything to save space 178 print "\n"; 179 179 return 1; 180 180 } else { … … 289 289 # 290 290 # PER-THREAD BUFFERS: 291 # binlog_cache_size - only if log_bin is 'ON' (default 32K)292 my $binlog_cache_size = ($myvar{'log_bin'} =~ /ON/) ? $myvar{'binlog_cache_size'} : 0 ;293 291 # join_buffer_size - helps joins that don't use indexes (default 128M) 294 292 my $join_buffer_size = $myvar{'join_buffer_size'}; … … 303 301 # 304 302 # PER-THREAD BUFFER CALCULATIONS: 305 my $thread_buffers = $read_buffer_size + $read_rnd_buffer_size + $sort_buffer_size + $thread_stack + $join_buffer_size + $binlog_cache_size;303 my $thread_buffers = $read_buffer_size + $read_rnd_buffer_size + $sort_buffer_size + $thread_stack + $join_buffer_size; 306 304 my $total_thread_buffers = $thread_buffers * $myvar{'max_connections'}; 307 305 my $max_thread_buffers = $thread_buffers * $mystat{'Max_used_connections'}; … … 349 347 ") of physical memory (".hr_bytes($physical_memory).")\n"; 350 348 $exptext = "Your current memory settings are reasonable as they do not exceed the maximum amount of memory on ". 351 "your server. If you find that this script suggests increasing buffers in later tests, you have additional memory ".349 "your server. If you find that this script suggests increasing buffers in later tests, you may not have additional memory ". 352 350 "available for the expansion of those buffers."; 353 351 } … … 408 406 "(".$mystat{'Max_used_connections'}."/".$myvar{'max_connections'}.")". 409 407 " - Increase the max_connections variable\n"; 408 $exptext = "Your historical connection usage is too high relative to your set maximum. The max_connections variable should be increased."; 410 409 } elsif ($connpct < 10) { 411 410 badprint "$connpct% of connections have been used ". 412 411 "(".$mystat{'Max_used_connections'}."/".$myvar{'max_connections'}.")". 413 412 " - Reduce max_connections\n"; 413 $exptext = "Your historical connection usage is voo low relative to your set maximum. MySQL is wasting resources by allowing". 414 " so many concurrent connections."; 414 415 } else { 415 416 goodprint "$connpct% of connections have been used ". 416 417 "(".$mystat{'Max_used_connections'}."/".$myvar{'max_connections'}.")\n"; 418 $exptext = "These settings are appropriate for your historical usage."; 417 419 } 418 420 # If the back_log is less than 50, there's a chance that connections will be forcefully rejected … … 422 424 goodprint "Your listen queue back_log is set to a reasonable level (".$myvar{'back_log'}.")\n"; 423 425 } 426 explainprint "You can currently handle ".($myvar{'max_connections'}+$myvar{'back_log'})." total connections, which includes ". 427 $myvar{'max_connections'}." active connections with ".$myvar{'back_log'}." more in queue. ".$exptext; 424 428 } 425 429