我已经创build了一个脚本来清理InnoDB
存储引擎 。 一切工作正常,但是当innodb_log_file_size
设置为1GB
时创buildib_logfile0
和ib_logfile1
文件需要一段时间,这会导致/etc/init.d/mysql
超时并报告失败,尽pipe在后台MySQL
结束正常启动。
启动mysql
$ /etc/init.d/mysql start * Starting MariaDB database server mysqld [fail]
同时在日志中
$ tail -f /var/log/mysql.err 120426 11:19:55 InnoDB: Log file ./ib_logfile0 did not exist: new to be created InnoDB: Setting log file ./ib_logfile0 size to 1024 MB InnoDB: Database physically writes the file full: wait... InnoDB: Progress in MB: 100 200 300 400 500 600 700 800 900 1000 120426 11:20:07 InnoDB: Log file ./ib_logfile1 did not exist: new to be created InnoDB: Setting log file ./ib_logfile1 size to 1024 MB InnoDB: Database physically writes the file full: wait... InnoDB: Progress in MB: 100 200 300 400 500 600 700 800 900 1000 [...] 120426 11:20:24 [Note] /usr/sbin/mysqld: ready for connections. # Version: '5.5.23-MariaDB-mariadb1~oneiric-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
我正在寻找一种方法来防止启动脚本超时。 当我看看/etc/init.d/mysql
,我可以看到${MYSQLD_STARTUP_TIMEOUT}
variables,但不知道它在哪里设置。 我也一直在寻找这样的选项的文档 ,但无法find它。
Q1:我可以指定自定义启动超时作为/etc/init.d/mysql
的参数吗?
Q2:我可以修改哪些选项来更改configuration中的服务器启动超时?
我知道这是一个老问题,但我张贴的情况下,其他人正在寻找一个更好的/不同的答案。 我一直有类似的问题,但安装升级时。 我们需要很长时间才能开始,因为它是Galera集群的一部分,需要复制它在错过时错过的部分。
开始运行:
MYSQLD_STARTUP_TIMEOUT=900 /etc/init.d/mysql start
或者在带有service
的系统上,比如Ubuntu:
sudo MYSQLD_STARTUP_TIMEOUT=900 service mysql start
而在我的情况下,升级呼叫:
sudo MYSQLD_STARTUP_TIMEOUT=900 apt-get dist-upgrade
您可以在启动时使用以下选项:
# 900 is the default, 0 won't wait at all --service-startup-timeout=900
在你的初始化脚本或my.cnf中,它看起来像:
service_startup_timeout=900
更多文档位于http://dev.mysql.com/doc/refman/5.5/en/mysql-server.html
要计时启动脚本查看是否正在使用新的超时值,请联合使用Linux的time命令
# time /etc/init.d/mysql start
将报告的执行时间与超时值进行比较,看看是否在更改超时值时发生更改,如果不是,则选项不是按预期工作(可能是MariaDB不支持它),或者在configuration中声明不正确。