首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Mysql binlog文件名不断更改,防止复制。

Mysql binlog文件名不断更改,防止复制。
EN

Database Administration用户
提问于 2017-01-09 21:00:24
回答 2查看 1.6K关注 0票数 0

首先,一些版本: Centos 6,MySQL5.1是我目前一直在使用的版本。

因此-问题是,当我使用以下任何一种方法进行复制时:

答:从手册上看,甲骨文网站上无法找到,但纳米比亚的一些大学却对此进行了镜像:http://download.nust.na/pub6/mysql/doc/refman/5.1/en/replication.html

B:通过Percona的工具,首选的方法,因为它不会导致一秒钟的停机,这是不可能的代价:https://www.percona.com/doc/percona-xtrabackup/2.3/howtos/setting_向上_replication.html

在奴隶上,我得到一个错误,告诉我在主服务器上找不到binlog。检查存储绑定日志的路径时,文件名最终会与启动转储或innobackupex时不同。我的mysql配置在主服务器上如下所示:

代码语言:javascript
复制
# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
thread_cache_size = 60

symbolic-links=0
innodb_buffer_pool_size=6000M
#query_cache_size = 2500M
table_cache = 800M
open_files_limit = 20000
key_buffer_size=500M
log-slow-queries = /var/log/mysql_slow_query.log
long_query_time = 6
# general_log = 1
max_connections = 500
innodb_thread_concurrency = 18
join_buffer_size = 10M
#log = /var/log/mysql_queries.log
log_bin = /var/lib/mysql_dump/bin/bin
skip-name-resolve

# Replication
server-id = 1
innodb_flush_log_at_trx_commit= 1
sync_binlog= 1
max_allowed_packet=1024M

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

在奴隶身上:

代码语言:javascript
复制
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

server-id=2

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

这些查询的结果也是:

代码语言:javascript
复制
mysql> select @@expire_logs_days;
+--------------------+
| @@expire_logs_days |
+--------------------+
|                  0 |
+--------------------+
1 row in set (0.00 sec)

mysql> select @@log_bin;
+-----------+
| @@log_bin |
+-----------+
|         1 |
+-----------+
1 row in set (0.00 sec)

这就是大师的地位:

代码语言:javascript
复制
mysql> SHOW MASTER STATUS;
+------------+----------+--------------+------------------+
| File       | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------+----------+--------------+------------------+
| bin.023469 | 44272212 |              |                  |
+------------+----------+--------------+------------------+
1 row in set (0.00 sec)

在奴隶身上:

代码语言:javascript
复制
mysql> SHOW SLAVE STATUS\G
*************************** 1. row ***************************
           Slave_IO_State: 
              Master_Host: [redacted for the public :) ]
              Master_User: repl0
              Master_Port: 3306
            Connect_Retry: 60
          Master_Log_File: bin.023468
      Read_Master_Log_Pos: 15943086
           Relay_Log_File: mysqld-relay-bin.000002
            Relay_Log_Pos: 4
    Relay_Master_Log_File: bin.023468
         Slave_IO_Running: No
        Slave_SQL_Running: Yes
          Replicate_Do_DB: 
      Replicate_Ignore_DB: 
       Replicate_Do_Table: 
   Replicate_Ignore_Table: 
  Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
               Last_Errno: 0
               Last_Error: 
             Skip_Counter: 0
      Exec_Master_Log_Pos: 106
          Relay_Log_Space: 106
          Until_Condition: None
           Until_Log_File: 
            Until_Log_Pos: 0
       Master_SSL_Allowed: No
       Master_SSL_CA_File: 
       Master_SSL_CA_Path: 
          Master_SSL_Cert: 
        Master_SSL_Cipher: 
        Master_SSL_Key: 
    Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
            Last_IO_Errno: 1236
            Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file'
           Last_SQL_Errno: 0
           Last_SQL_Error: 

然后这个:

代码语言:javascript
复制
$ cat /var/lib/mysql/xtrabackup_binlog_info
bin.023468      15943086

这在很大程度上是同一个问题,当我这样做Oracle的方式-只是有一个不同的文件名比当我做转储。

那么

EN

回答 2

Database Administration用户

回答已采纳

发布于 2017-01-30 06:03:36

这是一个错误的mysql完整备份,使用以下标志运行:

代码语言:javascript
复制
--flush-logs and --delete-master-logs 

禁用此功能解决了问题。

票数 0
EN

Database Administration用户

发布于 2017-01-10 21:47:33

有几个问题,虽然可能没有解决你的问题:

  • sync_binlog的价值是什么?主人坠毁了吗?“关闭”和“是”通常导致“非法位置”。
  • 定义绑定日志名称的参数的设置是什么?
  • 复制在某些时候起作用吗?
  • 在不同的服务器上,server-id值是否不同?
  • 这是一个令人费解的组合: 23468个二进制日志,而Pos却是数百万。当一切顺利时,一个二进制日志最多填满100 is (或1GB),然后启动一个新的。有了这些数字,就会有很多结核病。
  • 您运行复制多长时间了?几年?
  • 旧的二进制日志的大小有什么模式吗?
票数 1
EN
页面原文内容由Database Administration提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://dba.stackexchange.com/questions/160464

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档