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_Errno: 144
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.
cd /var/lib/mysql/DB1/
myisamchk table_32
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
[...]
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
[...]
No comments yet.
AWS Android Ansible Apache Apple Atlassian BSD Backup Bash Bluecoat CMS Chef Cloud Coding Consul Containers CouchDB DB DNS Database Databases Docker ELK Elasticsearch Filebeat FreeBSD Galera Git GlusterFS Grafana Graphics HAProxy HTML Hacks Hardware Icinga Influx Internet Java KVM Kibana Kodi Kubernetes LVM LXC Linux Logstash Mac Macintosh Mail MariaDB Minio MongoDB Monitoring Multimedia MySQL NFS Nagios Network Nginx OSSEC OTRS Office PGSQL PHP Perl Personal PostgreSQL Postgres PowerDNS Proxmox Proxy Python Rancher Rant Redis Roundcube SSL Samba Seafile Security Shell SmartOS Solaris Surveillance Systemd TLS Tomcat Ubuntu Unix VMWare VMware Varnish Virtualization Windows Wireless Wordpress Wyse ZFS Zoneminder