【问题标题】:Wordpress database shutdownsWordPress 数据库关闭
【发布时间】:2017-01-04 19:29:40
【问题描述】:

我的一个网站遇到了问题。当我加载我的网站“数据库连接失败”时,每隔一段时间就会出现一个错误。 我正在使用 Amazon Linux 服务器 t2.micro 实例。 请有人可以帮助我绝望。我不知道问题出在哪里,而且我对这些东西还很陌生,所以我不想在不知道的情况下进行任何更改,而且我会丢失数据。 谢谢 我的mysql日志文件:

170103 18:00:02  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 2104460177
170103 18:00:02  InnoDB: Starting an apply batch of log records to the       database...
InnoDB: Progress in percents: 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
170103 18:00:02  InnoDB: Waiting for the background threads to start
170103 18:00:03 InnoDB: 5.5.52 started; log sequence number 2104460177
170103 18:00:03 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
170103 18:00:03 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
170103 18:00:03 [Note] Server socket created on IP: '0.0.0.0'.
170103 18:00:04 [Note] Event Scheduler: Loaded 0 events
170103 18:00:04 [Note] /usr/libexec/mysql55/mysqld: ready for connections.
Version: '5.5.52'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL   Community Server (GPL)
170104 09:09:11 mysqld_safe Number of processes running now: 0
170104 09:09:11 mysqld_safe mysqld restarted
170104 09:27:17 mysqld_safe Starting mysqld daemon with databases from  /var/lib/mysql
170104  9:27:17 [Note] /usr/libexec/mysql55/mysqld (mysqld 5.5.52) starting  as process 11744 ...
170104  9:27:17 [Note] Plugin 'FEDERATED' is disabled.
170104  9:27:17 InnoDB: The InnoDB memory heap is disabled
170104  9:27:17 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170104  9:27:17 InnoDB: Compressed tables use zlib 1.2.8
170104  9:27:17 InnoDB: Using Linux native AIO
170104  9:27:17 InnoDB: Initializing buffer pool, size = 128.0M
170104  9:27:17 InnoDB: Completed initialization of buffer pool
170104  9:27:17 InnoDB: highest supported file format is Barracuda.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
170104  9:27:17  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...
170104  9:27:17  InnoDB: Waiting for the background threads to start
170104  9:27:18 InnoDB: 5.5.52 started; log sequence number 2123585383
170104  9:27:18 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
170104  9:27:18 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
170104  9:27:18 [Note] Server socket created on IP: '0.0.0.0'.
170104  9:27:18 [Note] Event Scheduler: Loaded 0 events
170104  9:27:18 [Note] /usr/libexec/mysql55/mysqld: ready for connections.
Version: '5.5.52'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL  Community Server (GPL)

【问题讨论】:

  • 基本上从我在亚马逊实例屏幕截图中可以看到,它关闭了 mysql,因为它内存不足。有没有办法在不改变服务器内存的情况下限制这一点?
  • 现在我已经创建了一个 2GB 的交换空间,看看它是否有所作为。自从我做了 2 小时后,它似乎还不错。问题是加载主页时大约需要 200-300MB 内存
  • 所以?你希望在这里找到什么?您的网站需要 300 MB?没有人可以根据给定的信息来判断。

标签: mysql wordpress amazon-ec2


【解决方案1】:

您的 MySQL 似乎没有足够的 RAM。

假设你有一个人(mysql),他带着一包石头(mysql中的数据)从a点到b点过一座桥。 到您向包裹中添加更多石头(更多数据)的时候。 而且也许街上还有更多的人(更多的 mysql 实例,因为您的网站上有更多的访问者)。

然后想象一座所有这些人都必须通过的桥,它有一个重量限制 (RAM)。

所以只有少数人可以过桥,而其他人则被告知要么等待,要么(如果等待的人太多)带着他们的包裹去地狱。

您可以删除一些数据,也可以限制用户数量,或者您可以尝试优化软件包。

您真的需要携带所有数据还是有办法更快地生成数据?

对于第二个选项,请阅读 mysql 索引。

【讨论】:

    猜你喜欢
    • 2013-11-06
    • 2010-11-02
    • 2021-11-06
    • 2011-10-22
    • 2016-04-15
    • 1970-01-01
    • 2013-01-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多