mysql의 이상을 한 번 기록합니다

7191 단어 wordpress
텐센트 클라우드 1G1 코어의 클라우드 서버를 구성합니다.
서비스 mysqld start는 도무지 일어나지 않습니다.
그리고 mysql 시작 명령/usr/sbin/mysqld --user=mysql 수동으로 실행
표준 출력은 다음과 같습니다.
[root@VM_0_8_centos lib]# /usr/sbin/mysqld --user=mysql
2019-08-20 21:16:36 0 [Note] /usr/sbin/mysqld (mysqld 5.6.42) starting as process 19322 ...
2019-08-20 21:16:36 19322 [Note] Plugin 'FEDERATED' is disabled.
2019-08-20 21:16:36 19322 [Note] InnoDB: Using atomics to ref count buffer pool pages
2019-08-20 21:16:36 19322 [Note] InnoDB: The InnoDB memory heap is disabled
2019-08-20 21:16:36 19322 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-08-20 21:16:36 19322 [Note] InnoDB: Memory barrier is not used
2019-08-20 21:16:36 19322 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-08-20 21:16:36 19322 [Note] InnoDB: Using Linux native AIO
2019-08-20 21:16:36 19322 [Note] InnoDB: Using CPU crc32 instructions
2019-08-20 21:16:36 19322 [Note] InnoDB: Initializing buffer pool, size = 50.0M
2019-08-20 21:16:36 19322 [Note] InnoDB: Completed initialization of buffer pool
2019-08-20 21:16:36 19322 [Note] InnoDB: Highest supported file format is Barracuda.
2019-08-20 21:16:36 19322 [Note] InnoDB: The log sequence numbers 103542583 and 103542583 in ibdata files do not match the log sequence number 103543430 in the ib_logfiles!
2019-08-20 21:16:36 19322 [Note] InnoDB: Database was not shutdown normally!
2019-08-20 21:16:36 19322 [Note] InnoDB: Starting crash recovery.
2019-08-20 21:16:36 19322 [Note] InnoDB: Reading tablespace information from the .ibd files...
2019-08-20 21:16:36 19322 [Note] InnoDB: Restoring possible half-written data pages
2019-08-20 21:16:36 19322 [Note] InnoDB: from the doublewrite buffer...
2019-08-20 21:16:37 19322 [Note] InnoDB: 128 rollback segment(s) are active.
2019-08-20 21:16:37 19322 [Note] InnoDB: Waiting for purge to start
2019-08-20 21:16:37 19322 [Note] InnoDB: 5.6.42 started; log sequence number 103543430
2019-08-20 21:16:37 19322 [Note] Server hostname (bind-address): '*'; port: 3306
2019-08-20 21:16:37 19322 [Note] IPv6 is available.
2019-08-20 21:16:37 19322 [Note]   - '::' resolves to '::';
2019-08-20 21:16:37 19322 [Note] Server socket created on IP: '::'.
2019-08-20 21:16:37 19322 [Note] Event Scheduler: Loaded 0 events
2019-08-20 21:16:37 19322 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.6.42'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)

halt 여기 있습니다. 아무 일도 없습니다. 하지만 제 wordpress 웹 인터페이스를 요청하면'이미 죽였습니다'가 하나 더 늘어납니다.
[root@VM_0_8_centos lib]# /usr/sbin/mysqld --user=mysql
2019-08-20 21:16:36 0 [Note] /usr/sbin/mysqld (mysqld 5.6.42) starting as process 19322 ...
2019-08-20 21:16:36 19322 [Note] Plugin 'FEDERATED' is disabled.
2019-08-20 21:16:36 19322 [Note] InnoDB: Using atomics to ref count buffer pool pages
2019-08-20 21:16:36 19322 [Note] InnoDB: The InnoDB memory heap is disabled
2019-08-20 21:16:36 19322 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-08-20 21:16:36 19322 [Note] InnoDB: Memory barrier is not used
2019-08-20 21:16:36 19322 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-08-20 21:16:36 19322 [Note] InnoDB: Using Linux native AIO
2019-08-20 21:16:36 19322 [Note] InnoDB: Using CPU crc32 instructions
2019-08-20 21:16:36 19322 [Note] InnoDB: Initializing buffer pool, size = 50.0M
2019-08-20 21:16:36 19322 [Note] InnoDB: Completed initialization of buffer pool
2019-08-20 21:16:36 19322 [Note] InnoDB: Highest supported file format is Barracuda.
2019-08-20 21:16:36 19322 [Note] InnoDB: The log sequence numbers 103542583 and 103542583 in ibdata files do not match the log sequence number 103543430 in the ib_logfiles!
2019-08-20 21:16:36 19322 [Note] InnoDB: Database was not shutdown normally!
2019-08-20 21:16:36 19322 [Note] InnoDB: Starting crash recovery.
2019-08-20 21:16:36 19322 [Note] InnoDB: Reading tablespace information from the .ibd files...
2019-08-20 21:16:36 19322 [Note] InnoDB: Restoring possible half-written data pages
2019-08-20 21:16:36 19322 [Note] InnoDB: from the doublewrite buffer...
2019-08-20 21:16:37 19322 [Note] InnoDB: 128 rollback segment(s) are active.
2019-08-20 21:16:37 19322 [Note] InnoDB: Waiting for purge to start
2019-08-20 21:16:37 19322 [Note] InnoDB: 5.6.42 started; log sequence number 103543430
2019-08-20 21:16:37 19322 [Note] Server hostname (bind-address): '*'; port: 3306
2019-08-20 21:16:37 19322 [Note] IPv6 is available.
2019-08-20 21:16:37 19322 [Note]   - '::' resolves to '::';
2019-08-20 21:16:37 19322 [Note] Server socket created on IP: '::'.
2019-08-20 21:16:37 19322 [Note] Event Scheduler: Loaded 0 events
2019-08-20 21:16:37 19322 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.6.42'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)
   

왜 이러지?처음엔 그것 때문인 줄 알았는데
2019-08-20 21:16:36 19322 [Note] InnoDB: The log sequence numbers 103542583 and 103542583 in ibdata files do not match the log sequence number 103543430 in the ib_logfiles!

ibdata랑 ib 때문인 줄 알았어요.logfiles의 lsn 번호가 일치하지 않아 발생한 문제입니다. 나중에 인보이스 엔지니어가 mysql 서비스를 사용할 수 없다고 말했습니다.
그리고 이 글의 맨 아래를 찾아보세요./var/log/messages에 무엇이 있는지 보십시오.
[root@VM_0_8_centos scripts]# tailf /var/log/messages

Aug 20 21:16:47 VM_0_8_centos kernel: [19283]     0 19283    40493      173      38        0             0 top
Aug 20 21:16:47 VM_0_8_centos kernel: [19322]    27 19322   315195   112859     274        0             0 mysqld
Aug 20 21:16:47 VM_0_8_centos kernel: [19349]     0 19349    30342      332      65        0             0 sshd
Aug 20 21:16:47 VM_0_8_centos kernel: [19365]     0 19365    28286       95      11        0             0 sh
Aug 20 21:16:47 VM_0_8_centos kernel: Out of memory: Kill process 19322 (mysqld) score 445 or sacrifice child
Aug 20 21:16:47 VM_0_8_centos kernel: Killed process 19322 (mysqld) total-vm:1260780kB, anon-rss:451436kB, file-rss:0kB, shmem-rss:0kB
Aug 20 21:17:02 VM_0_8_centos systemd: Started Session 11858 of user root.
Aug 20 21:17:02 VM_0_8_centos systemd: Starting Session 11858 of user root.
Aug 20 21:18:01 VM_0_8_centos systemd: Started Session 11859 of user root.
Aug 20 21:18:01 VM_0_8_centos systemd: Starting Session 11859 of user root.

out of memory와 mysqld가 한 줄 있는 것을 보았는데 메모리가 부족한가???
그래서 나는 php의 프로세스 수에 대한 매개 변수를 다음과 같이 낮추었다.
pm.max_children = 10   #   50

pm.start_servers = 5

pm.min_spare_servers = 5

pm.max_spare_servers = 10  #   35

그리고 세 개의 창을 열어 각각 모니터링한다.
모니터링 시스템 로그 파일:tailf/var/log/messages
하나의 모니터링 시스템 메모리 변화:watch-n 1 "free-h"
mysql 서비스 시작:/usr/sbin/mysqld --user=mysql
과연 wordpress 페이지를 다시 요청하면 mysql도 죽이지 않을 것입니다.
문제가 해결되었지만 메모리가 너무 작아 100M이 넘는 용량을 사용할 수 있습니다.

              total        used        free	 shared  buff/cache   available
Mem:           991M        657M         75M         35M        258M        130M
Swap:            0B          0B          0B

설비를 업그레이드하는 것이 좋겠다.

좋은 웹페이지 즐겨찾기