我在AWS上运行了一个开发服务器,它运行得非常好,没有任何问题。最近,mysql服务器周期性地开始不工作。然后我输入
service mysqld restart,这将产生错误消息。
MySQL Daemon failed to start.现在,如果我停止这个实例,然后启动它,然后从命令行重新启动服务器,一切都会正常工作(这让我很烦恼地被迫重新编辑我的区域文件,因为ip地址改变了,但我已经读到重新启动不会消除ip地址)。但是有什么线索可以解释为什么这不管用吗?
下面是var/log/mysqld.log中的几行代码,我不能对这些行作正面或反面的解释。
130613 23:12:21 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
130613 23:12:21 [Note] Plugin 'FEDERATED' is disabled.
130613 23:12:21 InnoDB: The InnoDB memory heap is disabled
130613 23:12:21 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130613 23:12:21 InnoDB: Compressed tables use zlib 1.2.5
130613 23:12:21 InnoDB: Using Linux native AIO
130613 23:12:21 InnoDB: Initializing buffer pool, size = 128.0M
130613 23:12:21 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
130613 23:12:21 InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
130613 23:12:22 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
130613 23:12:23 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: 127 rollback segment(s) active.
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
130613 23:12:24 InnoDB: Waiting for the background threads to start
130613 23:12:25 InnoDB: 5.5.31 started; log sequence number 0
130613 23:12:25 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
130613 23:12:25 [Note] - '0.0.0.0' resolves to '0.0.0.0';
130613 23:12:25 [Note] Server socket created on IP: '0.0.0.0'.
130613 23:12:25 [Note] Event Scheduler: Loaded 0 events
130613 23:12:25 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.31' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
130614 6:08:52 [Note] /usr/libexec/mysqld: Normal shutdown
130614 6:08:53 [Note] Event Scheduler: Purging the queue. 0 events我在stackexchange上的其他文章中看到,有时这可能是由于磁盘大小的限制。df -h
Filesystem Size Used Avail Use% Mounted on
/dev/xvda1 7.9G 1.7G 6.2G 22% /
tmpfs 298M 0 298M 0% /dev/shm有人知道我还应该找什么吗?
发布于 2014-08-05 10:39:25
首先,您必须备份数据库:
cp -r /var/lib/mysql /tmp/mysql_backup然后,从/var/lib/mysql中删除该文件。
rm -rf ibdata1现在重新启动mysql服务器。
/etc/init.d/mysqld start发布于 2014-08-05 13:01:39
如果您使用的是微实例或小实例,运行网站的mysql数据库可能会给VM内存带来相当大的负载,最终会导致mysql服务器不断崩溃。
考虑使用RDS,它可能会更昂贵,或者至少使用ec2 t2.media来省钱,但仍然运行良好。
对于IP,您必须分配您的实例弹性IP,它将留在您的实例,直到您摆脱它,您将不需要支付的IP,只要您使用它。
发布于 2016-01-04 14:13:06
如果使用的是t2.微实例,则mysql实例将被杀死,该实例只有1GB的内存。如果您执行ps -ef \ grep,您可以看到正在运行的apache实例数。当mysql内存不足时,大量apache实例将迫使服务器关闭mysql。
https://serverfault.com/questions/589212
复制相似问题