# How to delete relay-bin files

**URL:** https://forums.percona.com/t/how-to-delete-relay-bin-files/11444
**Category:** MySQL & MariaDB
**Created:** [July 19, 2021, 6:45pm UTC](https://forums.percona.com/t/how-to-delete-relay-bin-files/11444 "2021-07-19T18:45:08Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![amereddy](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@amereddy](https://forums.percona.com/u/amereddy)
#### Post date: [July 19, 2021, 6:45pm UTC](https://forums.percona.com/t/how-to-delete-relay-bin-files/11444/1 "2021-07-19T18:45:08Z")

</div>

I need to delete/purge relay-bin files from mysql server. We don’t have any space left. We are not sure if we can delete the old relay-bin files or not. Looking for adivse on what is the best approach to delete/purge the files that has filled up the server space.  
Here are the mysql db details

innodb\_version: 5.5.33-rel31.1  
protocol\_version: 10  
slave\_type\_conversions:  
version: 5.5.33-31.1-log  
version\_comment: Percona Server (GPL), Release rel31.1, Revision 566  
version\_compile\_machine: x86\_64  
version\_compile\_os: Linux

Regards  
Anil

---

<div class="post-metadata">

### Author: ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)
#### Post date: [July 19, 2021, 8:49pm UTC](https://forums.percona.com/t/how-to-delete-relay-bin-files/11444/2 "2021-07-19T20:49:14Z")

</div>

@amereddy relay\_logs are automatically purged after they have been processed by the SQL\_thread. How is your replication lag? You can use STOP SLAVE; RESET SLAVE; START SLAVE; to delete the relay logs. Any needed logs will be re-downloaded from the master.

---

<div class="post-metadata">

### Author: ![amereddy](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@amereddy](https://forums.percona.com/u/amereddy)
#### Post date: [July 22, 2021, 4:37pm UTC](https://forums.percona.com/t/how-to-delete-relay-bin-files/11444/3 "2021-07-22T16:37:05Z")

</div>

Thanks Matt. I have master(mysb02) and slave(mysdb04). The slave is down as it is 100% full and we could not add anymore space to /var mount. I can’t even start mysql service to execute the commands you have suggested. Is there anything else that I can do ?

Regards  
Anil

---

<div class="post-metadata">

### Author: ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)
#### Post date: [July 22, 2021, 6:22pm UTC](https://forums.percona.com/t/how-to-delete-relay-bin-files/11444/4 "2021-07-22T18:22:27Z")

</div>

At that point you can just remove the relay logs manually. When you start mysql, slave status will be invalid, but you can just restart it.

---

<div class="post-metadata">

### Author: ![amereddy](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@amereddy](https://forums.percona.com/u/amereddy)
#### Post date: [July 22, 2021, 6:28pm UTC](https://forums.percona.com/t/how-to-delete-relay-bin-files/11444/5 "2021-07-22T18:28:43Z")

</div>

Thansk Matt. Is there is particular sequence I need to remove the relay logs ? I can safely start deleting the oldest one and go from there right ?

Regards  
Anil

---

<div class="post-metadata">

### Author: ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)
#### Post date: [July 22, 2021, 6:39pm UTC](https://forums.percona.com/t/how-to-delete-relay-bin-files/11444/6 "2021-07-22T18:39:58Z")

</div>

Just delete them all. When you get mysql back up, just stop slave; start slave; and it should re-download any missing relay logs.

---

<div class="post-metadata">

### Author: ![amereddy](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@amereddy](https://forums.percona.com/u/amereddy)
#### Post date: [July 22, 2021, 7:31pm UTC](https://forums.percona.com/t/how-to-delete-relay-bin-files/11444/7 "2021-07-22T19:31:24Z")

</div>

Thanks Matt. that cleaned up the log files. Another question, I see is that

Slave\_IO\_State: waiting from master to send event  
slave\_io\_running: yes  
slave\_sql\_running: no

Not sure if I need to set anything or wait

Regards  
Anil

---

<div class="post-metadata">

### Author: ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)
#### Post date: [July 22, 2021, 8:30pm UTC](https://forums.percona.com/t/how-to-delete-relay-bin-files/11444/8 "2021-07-22T20:30:42Z")

</div>

you need to `stop slave; reset slave; start slave;`

---

<div class="post-metadata">

### Author: ![amereddy](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@amereddy](https://forums.percona.com/u/amereddy)
#### Post date: [July 22, 2021, 8:53pm UTC](https://forums.percona.com/t/how-to-delete-relay-bin-files/11444/9 "2021-07-22T20:53:30Z")

</div>

Matt, Those are the commands I ran from your earlier suggestion.  
Regards  
Anil

---

<div class="post-metadata">

### Author: ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)
#### Post date: [July 22, 2021, 9:12pm UTC](https://forums.percona.com/t/how-to-delete-relay-bin-files/11444/10 "2021-07-22T21:12:01Z")

</div>

> [@amereddy](#):
>
> slave\_sql\_running: no

If you have this, then replication is not working and you need to see what the error is.
