无意中发现我的网站有时候访问是全部空白,httpd是启动起来了。但是在连接mysql的时候,却提示找不到/var/mysql/mysql.sock。
这个文件确实不在了,而通过netstat -ntlp 发现mysql还在监听。只有到mysqld的错误日志里看看是什么问题了。
110413 23:28:46 mysqld_safe mysqld from pid file /usr/local/mysql/data/localhost.localdomain.pid ended
110413 23:28:47 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
110413 23:28:47 InnoDB: The InnoDB memory heap is disabled
110413 23:28:47 InnoDB: Mutexes and rw_locks use InnoDB’s own implementation
110413 23:28:47 InnoDB: Compressed tables use zlib 1.2.1.2
110413 23:28:47 InnoDB: Initializing buffer pool, size = 128.0M
110413 23:28:47 InnoDB: Completed initialization of buffer pool
110413 23:28:47 InnoDB: highest supported file format is Barracuda.
110413 23:28:47 InnoDB: Waiting for the background threads to start
110413 23:28:48 InnoDB: 1.1.6 started; log sequence number 1595675
110413 23:28:48 [Note] Event Scheduler: Loaded 0 events
110413 23:28:48 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: ‘5.5.11’ socket: ‘/var/mysql/mysql.sock’ port: 3306 Source distribution
110414 01:01:32 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
110414 1:01:32 InnoDB: The InnoDB memory heap is disabled
110414 1:01:32 InnoDB: Mutexes and rw_locks use InnoDB’s own implementation
110414 1:01:32 InnoDB: Compressed tables use zlib 1.2.1.2
110414 1:01:32 InnoDB: Initializing buffer pool, size = 128.0M
110414 1:01:32 InnoDB: Completed initialization of buffer pool
InnoDB: Unable to lock ./ibdata1, error: 11
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
刚开始一切正常,到了1点1份的时候,mysql怎么又启动了?接着到了InnoDB的时候错误提示,网上说出现这个错误是因为磁盘空间不足?我查看了一下,还有900G呢?怎么会不足呢?
接着就开始怀疑配置文件的问题。自己编译的mysql的配置文件比默认的多很多选项,其中也有InnoDB的配置。
/etc/my.cnf 是从编译mysql时,从其源代码中的support-files目录下拷贝的。这个目录下有my-huge.cnf my-innodb-heavy-4G.cnf my-large.cnf my-medium.cnf my-small.cnf 几个配置的例子。我记得当时是拷贝的my-medium.cnf ,是不是对应着中型的系统?果然,my-medium.cnf 一开始就有介绍:
# Example MySQL config file for medium systems.
#
# This is for a system with little memory (32M – 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
服务器有4G内存,我就拷贝了my-huge.cnf到 /etc/my.cnf 测试一段时间。
经过一下午的测试,mysql没有再down掉。下面的任务就是解决php支持gd库的问题了。要不然我的缩略图插件就不能用了。
2011-04-15补充:
今天下午突然发现mysql又down掉了,心理真不是个滋味。一直都找不出原因来。一直到现在还是在网上慢慢寻找。
1:清除二进制的日志。 参考这篇文章:http://www.rockia.net/2010/09/blog-stopped-for-one-whole-day-due-to-mysql-bin-log
这个些日志文件有两个作用:数据恢复和在主从服务器上提高复制的可靠性。
备份数据,我一般都是导出保存。所以一般都用不到。如何清除?
1:登录到mysql,执行 reset master; 这样只剩下连个文件了mysql-bin.000001 mysql-bin.index
2:修改配置文件。注释掉log-bin=mysql-bin
随机文章:
Tags: mysql