如何配置mysql 从库自动删除localhost-relay-bin 日志文件

骷髅 发布于 2013/08/12 12:10
阅读 4K+
收藏 2

最近配置了 mysql 主从, 这两天发现  relay-bin  日志大量增加,导致硬盘容量急剧缩小,

 请问有说明办法解决,并可以让mysql 自动删除  relay-bin  日志,

麻烦说明下, 如何删除 下面这些文件

-rw-rw---- 1 mysql mysql        570 Aug 12 13:18 localhost-relay-bin.002535
-rw-rw---- 1 mysql mysql        203 Aug 12 13:18 localhost-relay-bin.002536
-rw-rw---- 1 mysql mysql 1073741894 Aug 12 13:28 localhost-relay-bin.002537
-rw-rw---- 1 mysql mysql       1690 Aug 12 13:28 localhost-relay-bin.002538
-rw-rw---- 1 mysql mysql        203 Aug 12 13:28 localhost-relay-bin.002539
-rw-rw---- 1 mysql mysql 1073741960 Aug 12 13:38 localhost-relay-bin.002540
-rw-rw---- 1 mysql mysql        570 Aug 12 13:38 localhost-relay-bin.002541
-rw-rw---- 1 mysql mysql        203 Aug 12 13:38 localhost-relay-bin.002542
-rw-rw---- 1 mysql mysql 1073741892 Aug 12 13:47 localhost-relay-bin.002543
-rw-rw---- 1 mysql mysql        570 Aug 12 13:47 localhost-relay-bin.002544
-rw-rw---- 1 mysql mysql        203 Aug 12 13:47 localhost-relay-bin.002545
-rw-rw---- 1 mysql mysql 1073741932 Aug 12 13:57 localhost-relay-bin.002546
-rw-rw---- 1 mysql mysql       1032 Aug 12 13:57 localhost-relay-bin.002547
-rw-rw---- 1 mysql mysql        203 Aug 12 13:57 localhost-relay-bin.002548
-rw-rw---- 1 mysql mysql 1073741984 Aug 12 14:07 localhost-relay-bin.002549
-rw-rw---- 1 mysql mysql        570 Aug 12 14:07 localhost-relay-bin.002550
-rw-rw---- 1 mysql mysql        203 Aug 12 14:07 localhost-relay-bin.002551
-rw-rw---- 1 mysql mysql 1073742047 Aug 12 14:17 localhost-relay-bin.002552
-rw-rw---- 1 mysql mysql        290 Aug 12 14:17 localhost-relay-bin.002553
-rw-rw---- 1 mysql mysql        203 Aug 12 14:17 localhost-relay-bin.002554
-rw-rw---- 1 mysql mysql 1073741937 Aug 12 14:26 localhost-relay-bin.002555
-rw-rw---- 1 mysql mysql       1410 Aug 12 14:26 localhost-relay-bin.002556
-rw-rw---- 1 mysql mysql        203 Aug 12 14:26 localhost-relay-bin.002557
-rw-rw---- 1 mysql mysql  397582508 Aug 12 14:30 localhost-relay-bin.002558

  mysql 配置文件如下 

[client]
port		= 3306
socket		= /tmp/mysql.sock


[mysqld]
port		= 3306
socket		= /tmp/mysql.sock
innodb_use_native_aio = 0
innodb_use_sys_malloc =0
innodb_buffer_pool_size = 3G
innodb_additional_mem_pool_size = 20M
innodb_log_file_size = 512M
innodb_log_buffer_size =16M
innodb_flush_log_at_trx_commit = 1
thread_stack    = 512K
skip-external-locking
key_buffer_size = 16M
back_log = 512
max_connections    = 1024
max_connect_errors = 100
max_allowed_packet = 64M
table_cache = 4096
max_heap_table_size = 128M
sort_buffer_size = 16M
join_buffer_size = 16M
thread_cache_size = 16
thread_concurrency = 8
query_cache_limit = 16M
query_cache_size  = 512M
binlog_cache_size = 4M
table_open_cache = 64
sort_buffer_size = 16M
net_buffer_length = 8K
read_buffer_size = 8M
read_rnd_buffer_size = 16M
myisam_sort_buffer_size = 64M


server-id = 2
replicate-wild-ignore-table=mysql.%
log-slave-updates
replicate-ignore-db = mysql
replicate-ignore-db = test
binlog-ignore-db = mysql
binlog-ignore-db = test
replicate-do-db = xx
binlog-do-db = xx
replicate-do-db = xx
binlog-do-db = xx
replicate-do-db = xx
binlog-do-db = xx
replicate-do-db = xx
binlog-do-db = xx
replicate-do-db = xx
binlog-do-db = xx

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash

[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 4M
write_buffer = 4M

[mysqlhotcopy]
interactive-timeout

[mysqld_safe]
open-files-limit  = 8192
加载中
0
orientalfashion
orientalfashion

我顶,好东西









unity3dhttp://www.unitymanual.com/

0
kenyon_君羊
kenyon_君羊
你的主从出现故障了,正常情况下主机传送过来的relay-log在从机同步完后会自动删除的。检查一下从机的状态先
返回顶部
顶部