mysql自动shutdown,查看mysql的日志发现如下内容:
160504 15:39:11 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.5.46-log) starting as process 82685 ...
160504 15:39:11 [Warning] Changed limits: max_open_files: 1024 max_connections: 214 table_cache: 256
160504 15:39:11 InnoDB: The InnoDB memory heap is disabled
160504 15:39:11 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160504 15:39:11 InnoDB: Compressed tables use zlib 1.2.3
160504 15:39:11 InnoDB: Initializing buffer pool, size = 128.0M
160504 15:39:11 InnoDB: Completed initialization of buffer pool
160504 15:39:11 InnoDB: highest supported file format is Barracuda.
160504 15:39:11 InnoDB: Waiting for the background threads to start
160504 15:39:12 InnoDB: 5.5.46 started; log sequence number 6304611743
160504 15:39:12 [Note] Recovering after a crash using /diskb/mysql_log/mysql-bin
160504 15:39:12 [Note] Starting crash recovery...
160504 15:39:12 [Note] Crash recovery finished.
160504 15:39:12 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
160504 15:39:12 [Note] - '0.0.0.0' resolves to '0.0.0.0';
160504 15:39:12 [Note] Server socket created on IP: '0.0.0.0'.
160504 15:39:12 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000011' at position 125966650, relay log '/diskb/mysql_log/relay-bin.000004' position: 125966796
160504 15:39:12 [Note] Slave I/O thread: connected to master '
[email protected]:3306',replication started in log 'mysql-bin.000011' at position 126049089
160504 15:39:12 [Note] Event Scheduler: Loaded 0 events
160504 15:39:12 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.5.46-log' socket: '/tmp/mysql.sock' port: 3306 Source distribution
160504 15:39:12 mysqld_safe Number of processes running now: 0
160504 15:39:12 mysqld_safe mysqld restarted
160504 15:39:12 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.5.46-log) starting as process 82847 ...
160504 15:39:12 [Warning] Changed limits: max_open_files: 1024 max_connections: 214 table_cache: 256
160504 15:39:12 InnoDB: The InnoDB memory heap is disabled
160504 15:39:12 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160504 15:39:12 InnoDB: Compressed tables use zlib 1.2.3
160504 15:39:12 InnoDB: Initializing buffer pool, size = 128.0M
160504 15:39:12 InnoDB: Completed initialization of buffer pool
160504 15:39:12 InnoDB: highest supported file format is Barracuda.
160504 15:39:12 InnoDB: Waiting for the background threads to start
160504 15:39:13 InnoDB: 5.5.46 started; log sequence number 6304611743
160504 15:39:13 [Note] Recovering after a crash using /diskb/mysql_log/mysql-bin
160504 15:39:13 [Note] Starting crash recovery...
160504 15:39:13 [Note] Crash recovery finished.
160504 15:39:13 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
160504 15:39:13 [Note] - '0.0.0.0' resolves to '0.0.0.0';
160504 15:39:13 [Note] Server socket created on IP: '0.0.0.0'.
160504 15:39:13 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000011' at position 125966650, relay log '/diskb/mysql_log/relay-bin.000004' position: 125966796
160504 15:39:13 [Note] Slave I/O thread: connected to master '
[email protected]:3306',replication started in log 'mysql-bin.000011' at position 126049089
160504 15:39:13 [Note] Event Scheduler: Loaded 0 events
160504 15:39:13 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.5.46-log' socket: '/tmp/mysql.sock' port: 3306 Source distribution
160504 15:39:14 mysqld_safe Number of processes running now: 0
160504 15:39:14 mysqld_safe mysqld restarted
这个是从库,总是重启,从这个警告猜测是打开文件数量限制问题
[Warning] Changed limits: max_open_files: 1024 max_connections: 214 table_cache: 256
设置
vi /etc/security/limits.conf
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
vi /etc/security/limits.d/90-nproc.conf
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
需要重启服务器,如果你出现类似的问题,建议下重启下服务器,估计就可以解决问题。
再次查看日志正常了
160504 15:45:54 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
160504 15:45:54 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.5.46-log) starting as process 3210 ...
160504 15:45:54 InnoDB: The InnoDB memory heap is disabled
160504 15:45:54 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160504 15:45:54 InnoDB: Compressed tables use zlib 1.2.3
160504 15:45:54 InnoDB: Initializing buffer pool, size = 128.0M
160504 15:45:54 InnoDB: Completed initialization of buffer pool
160504 15:45:54 InnoDB: highest supported file format is Barracuda.
160504 15:45:54 InnoDB: Waiting for the background threads to start
160504 15:45:55 InnoDB: 5.5.46 started; log sequence number 6304611743
160504 15:45:55 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
160504 15:45:55 [Note] - '0.0.0.0' resolves to '0.0.0.0';
160504 15:45:55 [Note] Server socket created on IP: '0.0.0.0'.
160504 15:45:56 [Note] Slave SQL thread initialized, starting replication in log 'mysql-bin.000011' at position 125966650, relay log '/diskb/mysql_log/relay-bin.000004' position: 125966796
160504 15:45:56 [Note] Slave I/O thread: connected to master '
[email protected]:3306',replication started in log 'mysql-bin.000011' at position 126049089
160504 15:45:56 [Note] Event Scheduler: Loaded 0 events
160504 15:45:56 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.5.46-log' socket: '/tmp/mysql.sock' port: 3306 Source distribution