使用Woorank时,Wordpress项目出现问题。

整个站点运行良好,但是将URL提交给Woorank时,它显示“连接数据库错误”。然后,如果我尝试从浏览器正常访问,也会遇到相同的错误。直到我重新启动mysql(service mysql restart)或用管理员用户重新加载主页(此站点再次正常运行)时,这种情况才会发生。

我以为应该是WP问题,所以我禁用了所有插件,更改了主题,.htaccess指令,选中了wp-config.php,...,但是仍然出现错误。

该项目位于VPS中,还有其他几个不受此问题影响的项目。
我最近安装了Nginx作为代理,但是以前也存在这个问题。

我想这个问题是由于一次连接很多而引起的,因为如果不使用Woorank,我将无法重现它。

提交Woorank表单后,mysql记录日志:

140811 17:50:54 [Warning] Using unique option prefix myisam-recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
140811 17:50:54 [Note] Plugin 'FEDERATED' is disabled.
140811 17:50:54 InnoDB: The InnoDB memory heap is disabled
140811 17:50:54 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140811 17:50:54 InnoDB: Compressed tables use zlib 1.2.3.4
140811 17:50:54 InnoDB: Initializing buffer pool, size = 128.0M
140811 17:50:54 InnoDB: Completed initialization of buffer pool
140811 17:50:54 InnoDB: highest supported file format is Barracuda.
InnoDB: Log scan progressed past the checkpoint lsn 938907976
140811 17:50:54  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 938908419
140811 17:50:54  InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
InnoDB: Apply batch completed
140811 17:50:54  InnoDB: Waiting for the background threads to start
140811 17:50:55 InnoDB: 5.5.38 started; log sequence number 938908419
140811 17:50:55 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
140811 17:50:55 [Note]   - '127.0.0.1' resolves to '127.0.0.1';
140811 17:50:55 [Note] Server socket created on IP: '127.0.0.1'.
140811 17:50:55 [Note] Event Scheduler: Loaded 0 events
140811 17:50:55 [Note] /usr/sbin/mysqld: ready for connections.


Apache2的日志:

[Mon Aug 11 17:50:25.136960 2014] [:error] [pid 11656] [client 127.0.0.1:46584] Error Lost connection to MySQL server during query de la base de datos de WordPress para la consulta select val from bio_wfConfig where name='liveTrafficEnabled' realizada por require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), call_user_func_array, wordfence::initAction, wfConfig::liveTrafficEnabled, wfConfig::get, wfConfig::loadFromDiskCache, wfDB->querySingle
[Mon Aug 11 17:50:25.141243 2014] [:error] [pid 11173] [client 127.0.0.1:46589] Error Lost connection to MySQL server during query de la base de datos de WordPress para la consulta SELECT t.*, tt.* FROM bio_terms AS t INNER JOIN bio_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = 'category' AND t.slug = 'biomedicina' LIMIT 1 realizada por require('wp-blog-header.php'), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts, get_term_by
[Mon Aug 11 17:50:25.191699 2014] [:error] [pid 11644] [client 127.0.0.1:46578] Error Lost connection to MySQL server during query de la base de datos de WordPress para la consulta \n\t\tSELECT ID, post_name, post_parent, post_type\n\t\tFROM bio_posts\n\t\tWHERE post_name IN ('news')\n\t\tAND post_type IN ('page','attachment')\n\t realizada por require('wp-blog-header.php'), wp, WP->main, WP->parse_request, get_page_by_path
[Mon Aug 11 17:50:25.195749 2014] [:error] [pid 11652] [client 127.0.0.1:46582] Error Lost connection to MySQL server during query de la base de datos de WordPress para la consulta SELECT option_value FROM bio_options WHERE option_name = 'jetpack_portfolio' LIMIT 1 realizada por require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), call_user_func_array, Jetpack_Portfolio::init, Jetpack_Portfolio->__construct, get_option
[Mon Aug 11 17:50:25.201487 2014] [:error] [pid 11668] [client 127.0.0.1:46587] Error Lost connection to MySQL server during query de la base de datos de WordPress para la consulta select val from bio_wfConfig where name='liveTrafficEnabled' realizada por require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), call_user_func_array, wordfence::initAction, wfConfig::liveTrafficEnabled, wfConfig::get, wfConfig::loadFromDiskCache, wfDB->querySingle
[Mon Aug 11 17:50:25.212494 2014] [:error] [pid 11148] [client 127.0.0.1:46594] Error Lost connection to MySQL server during query de la base de datos de WordPress para la consulta select val from bio_wfConfig where name='liveTrafficEnabled' realizada por require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), call_user_func_array, wordfence::initAction, wfConfig::liveTrafficEnabled, wfConfig::get, wfConfig::loadFromDiskCache, wfDB->querySingle
[Mon Aug 11 17:50:25.214185 2014] [:error] [pid 11110] [client 127.0.0.1:46586] Error Lost connection to MySQL server during query de la base de datos de WordPress para la consulta SELECT option_value FROM bio_options WHERE option_name = 'wpseo_flush_rewrite' LIMIT 1 realizada por require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), call_user_func_array, WPSEO_Rewrite->flush, get_option
[Mon Aug 11 17:50:25.982309 2014] [:error] [pid 11638] [client 127.0.0.1:46618] Error Lost connection to MySQL server during query de la base de datos de WordPress para la consulta SELECT option_value FROM bio_options WHERE option_name = 'embed_autourls' LIMIT 1 realizada por require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('plugins_loaded'), call_user_func_array, Jetpack::load_modules, require('/plugins/jetpack/modules/shortcodes.php'), jetpack_load_shortcodes, include('/plugins/jetpack/modules/shortcodes/youtube.php'), get_option
[Mon Aug 11 17:50:25.928911 2014] [:error] [pid 11226] [client 127.0.0.1:46620] Error Lost connection to MySQL server during query de la base de datos de WordPress para la consulta SELECT option_value FROM wp_options WHERE option_name = 'akismet_comment_nonce' LIMIT 1 realizada por require('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), include_once('/plugins/akismet/akismet.php'), get_option, W3_Db->query, W3_DbCache->query, W3_DbCallUnderlying->query, W3_Db->query, W3_DbProcessor->query, W3_Db->default_query
[Mon Aug 11 17:50:35.154185 2014] [:error] [pid 11173] [client 127.0.0.1:46589] PHP Fatal error:  Unknown: Cannot use output buffering in output buffering display handlers in Unknown on line 0
[Mon Aug 11 17:50:35.410068 2014] [:error] [pid 11644] [client 127.0.0.1:46578] PHP Fatal error:  Unknown: Cannot use output buffering in output buffering display handlers in Unknown on line 0


有任何想法吗?

最佳答案

您有两个主要选择...

1)您可以花费无数小时来检查WordPress根据您的主题和所使用的所有插件创建的查询,然后对其进行优化,直到问题不再发生(根据您的托管环境而定,是否可行)。

- 要么 -

2)安装类似WP Super Cache(https://wordpress.org/plugins/wp-super-cache/)的东西,这样就不会对数据库造成太大的破坏。从根本上说,它是一个全页缓存,它将消除您承受的压力类型的数据库访问。如果您不愿意的话,即使在不扫描时也可以轻松停用它。从Woorank运行扫描之前,请确保预加载缓存。

09-11 18:43