今天网站又宕机了, 上次是一个多月之前, 之前没当回事直接reboot了
这次仔细查了一下, 发现web服务器是正常工作的但是mariadb宕了
170720 08:08:08 mysqld_safe Number of processes running now: 0
170720 08:08:08 mysqld_safe mysqld restarted
170720 8:08:09 [Note] /usr/libexec/mysqld (mysqld 5.5.44-MariaDB) starting as process 24176 ...
170720 8:08:13 InnoDB: The InnoDB memory heap is disabled
170720 8:08:13 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170720 8:08:13 InnoDB: Compressed tables use zlib 1.2.7
170720 8:08:13 InnoDB: Using Linux native AIO
170720 8:08:15 InnoDB: Initializing buffer pool, size = 128.0M
170720 8:08:15 InnoDB: Completed initialization of buffer pool
170720 8:08: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!
170720 8:08: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...
170720 8:09:13 Percona XtraDB (http://www.percona.com) 5.5.43-MariaDB-37.2 started; log sequence number 13591519726
170720 8:09:56 [Note] Plugin 'FEEDBACK' is disabled.
170720 8:10:27 [Note] Server socket created on IP: '0.0.0.0'.
170720 8:10:32 [Note] Event Scheduler: Loaded 0 events
170720 8:10:33 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.44-MariaDB' socket: '/var/lib/mysql/mysql.sock' port: 3306 MariaDB Server
170720 08:12:52 mysqld_safe Number of processes running now: 0
170720 08:13:03 mysqld_safe mysqld restarted
170720 8:13:21 [Note] /usr/libexec/mysqld (mysqld 5.5.44-MariaDB) starting as process 24589 ...
170720 08:13:44 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended
说真的就这log也看不出什么具体信息, 然后做了两处改动
第一
加大一点buffer内存
修改 /etc/my.cnf
[mysqld]
innodb_buffer_pool_size=256m (默认是128m)
第二
设置一个自动重启
vi /etc/systemd/system/multi-user.target.wants/mariadb.service
[Service]
Restart=always
TimeoutSec=600s
顺便说一句, 如果你要修改sshd的restart属性需要使用on-failure
Restart=on-failure
RestartSec=42s