시스템이 MariaDB를 제대로 종료하지 않습니까?

시스템이 MariaDB를 제대로 종료하지 않습니까?

CentOS 7에서 LAMP 스택을 실행하고 있습니다. SCL을 활성화했지만 PHP와 Apache만 이를 사용하고 있습니다. 테스트 머신에서 MariaDB를 성공적으로 컷오버할 수 없었기 때문에 프로덕션에서는 컷오버를 시도한 적이 없습니다.

최근에 더 심각한 데이터베이스 충돌이 발생했습니다. 충돌과 손상은 만성적인 문제이지만 이번에는 위키가 오프라인 상태가 되었습니다. 우리는 위키 테이블과 MariaDB 데이터베이스를 복구했고 문제가 해결되었다고 생각했습니다(다음 번까지). 그러나 재부팅 후 로그 파일에서 다음을 발견했습니다.

InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
InnoDB: Database was not shut down normally! 

The log sequence number in ibdata files does not match매우 일반적인 문제이며 논의되었습니다.광고 구역질난다. 그러나 완전한 종료/재부팅 시 이러한 현상이 발생해서는 안 됩니다. (수정 부탁드립니다).

실험으로 나는 sudo su -다음을 수행했습니다 shutdown -r now. 그런 다음 로그에 다음이 공개되었습니다.

# tail /var/log/mariadb/mariadb.log
180901 23:01:26 Percona XtraDB (http://www.percona.com) 5.5.59-MariaDB-38.11 started; log sequence number 1478830786
180901 23:01:26 [Note] Plugin 'FEEDBACK' is disabled.
180901 23:01:26 [Note] Server socket created on IP: '0.0.0.0'.
180901 23:01:26 [Note] Event Scheduler: Loaded 0 events
180901 23:01:26 [Note] /usr/libexec/mysqld: ready for connections.
Version: '5.5.60-MariaDB'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MariaDB Server
180901 23:01:30 [ERROR] mysqld: Table './my_wiki/wikicryptopp_objectcache' is marked as crashed and should be repaired
180901 23:01:30 [Warning] Checking table:   './my_wiki/wikicryptopp_objectcache'
180901 23:05:01 [ERROR] mysqld: Table './my_wiki/wikicryptopp_module_deps' is marked as crashed and should be repaired
180901 23:05:01 [Warning] Checking table:   './my_wiki/wikicryptopp_module_deps'

systemd가 데이터베이스를 제대로 종료하지 않는 것 같습니다. (수정 부탁드립니다).

CentOS 및 Systemd 버그 추적기를 검색했지만 관련 문제를 찾지 못했습니다. 다른 사람이 문제를 경험했고 문제를 해결하는 단계를 제공할 수 있기를 바랍니다.

MariaDB 종료 문제를 어떻게 해결합니까?


이것은 종료 중에 무슨 일이 일어나고 있는지 알아낼 때까지 얻은 것입니다. 나는 체계화된 사람이 아니기 때문에 이것이 맞는지 (아마도 아닐 수도 있음) 모르겠습니다.

[root@ftpit ~]# find /etc -name mariadb.service
/etc/systemd/system/multi-user.target.wants/mariadb.service
[root@ftpit ~]# find /etc -name mysql.service
[root@ftpit ~]# find /opt/rh -name mariadb.service
[root@ftpit ~]# find /opt/rh -name mysql.service

그런 다음:

# cat /etc/systemd/system/multi-user.target.wants/mariadb.service
# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades.  If you want to customize, the
# best way is to create a file "/etc/systemd/system/mariadb.service",
# containing
#       .include /lib/systemd/system/mariadb.service
#       ...make your changes here...
# or create a file "/etc/systemd/system/mariadb.service.d/foo.conf",
# which doesn't need to include ".include" call and which will be parsed
# after the file mariadb.service itself is parsed.
#
# For more info about custom unit files, see systemd.unit(5) or
# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F

# For example, if you want to increase mariadb's open-files-limit to 10000,
# you need to increase systemd's LimitNOFILE setting, so create a file named
# "/etc/systemd/system/mariadb.service.d/limits.conf" containing:
#       [Service]
#       LimitNOFILE=10000

# Note: /usr/lib/... is recommended in the .include line though /lib/...
# still works.
# Don't forget to reload systemd daemon after you change unit configuration:
# root> systemctl --system daemon-reload

[Unit]
Description=MariaDB database server
After=syslog.target
After=network.target

[Service]
Type=simple
User=mysql
Group=mysql

ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n
# Note: we set --basedir to prevent probes that might trigger SELinux alarms,
# per bug #547485
ExecStart=/usr/bin/mysqld_safe --basedir=/usr
ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID

# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300

# Place temp files in a secure directory, not /tmp
PrivateTmp=true

[Install]
WantedBy=multi-user.target

답변1

"ibdata 파일의 로그 시퀀스 번호가 일치하지 않습니다."는 일반적으로 발생하지 않습니다. 이는 시스템 문제가 아닐 가능성이 높습니다. 전체 mysqldump를 가져와 이를 깨끗한 인스턴스로 복원하고 innodb 불일치를 해결하도록 하겠습니다.

참고: systemctl show mariadb.servicesystemd 구성을 표시하는 더 좋은 방법입니다.

관련 정보