Today I had to fix a MySQL replication, where the slave process suddenly stopped working.
The show slave status output showed the following error:
Last_SQL_Error: Error 'Table './DB1/table_32' is marked as crashed and last (automatic?) repair failed' on query. Default database: 'DB1'. Query: 'ALTER TABLE table_32 DISABLE KEYS'
On a "normal" MySQL server I'd repair the table with myisamchk, but would this also work on the Slave? Yes it does.
Checking MyISAM file: table_32
Data records: 0 Deleted blocks: 0
myisamchk: warning: Table is marked as crashed and last repair failed
- check file-size
myisamchk: warning: Size of indexfile is: 2189487104 Should be: 1024
- check record delete-chain
- check key delete-chain
- check index reference
- check data record references index: 1
MyISAM-table 'table_32' is usable but should be fixed
So that's pretty much the same result as also seen in the replication status error. The table can be repaired with the -r parameter:
myisamchk -r table_32
- recovering (with sort) MyISAM-table 'table_32'
Data records: 0
- Fixing index 1
- Fixing index 2
- Fixing index 3
- Fixing index 4
Data records: 36841845
Afterwards the slave process was started again:
mysql> START SLAVE;
And it worked again:
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
No comments yet.
AWS Android Ansible Apache Apple Atlassian BSD Backup Bash Bluecoat CMS Chef Cloud Coding Consul Container Containers CouchDB DB DNS Database Databases Docker ELK ElasticSearch Elasticsearch Filebeat FreeBSD GlusterFS Grafana Graphics HAProxy HTML Hacks Hardware Icinga Icingaweb2 InfluxDB Internet Java KVM Kibana Kubernetes LXC Linux Logstash Mac Macintosh Mail MariaDB Minio MongoDB Monitoring Multimedia MySQL NFS Nagios Network Nginx OSSEC OTRS PGSQL PHP Perl Personal PostgreSQL Postgres PowerDNS Proxmox Proxy Python Rancher SSL Security Shell SmartOS Solaris Surveillance SystemD TLS Tomcat Ubuntu Unix VMWare VMware Varnish Virtualization Windows Wireless Wordpress Wyse ZFS Zoneminder