【问题标题】:Mariadb master slave replication : Empty Set / Not using Binary logsMariadb 主从复制:空集/不使用二进制日志
【发布时间】:2021-05-12 05:41:02
【问题描述】:

我正在尝试在 CentOS7 下的 2 个 MariaDB 数据库版本 5.5.68 之间设置主从复制。

第一步是直截了当:

  1. 修改my.cnf.conf,在[mysqld]下添加如下几行
server_id=1
log-basename=master
log-bin
binlog-format=mixte
  1. 重启 mariadb
systemctl restart mariadb
  1. 登录 mariaDB,为复制创建一个新用户并授予他权限。
mysql -u root -p
MariaDB [(none)]> STOP SLAVE;
MariaDB [(none)]> GRANT REPLICATION SLAVE ON *.* TO 'replication_user'@'%' IDENTIFIED BY 'password';
MariaDB [(none)]> FLUSH PRIVILEGES;
  1. 锁定数据库并记住位置编号。 MariaDB [(none)]> 带读锁的刷新表; MariaDB [(none)]> 显示主状态;

问题: 在那个阶段,我应该得到一个带有位置编号的表格,但我收到一条消息:

MariaDB [(none)]> SHOW MASTER STATUS;
Empty set (0.00 sec)

经过几次故障排除后,我发现它可能与缺少的二进制日志记录有关。 以下命令和结果证实了这一点。

MariaDB [(none)]> SHOW BINARY LOGS;
ERROR 1381 (HY000): You are not using binary logging

我尝试了几种配置(更改 my.cnf.conf 以提供 log-bin 路径,bin-log-format 从 mixte 更改为 row)以激活二进制日志记录,但一切都失败了。

我被困住了。

【问题讨论】:

    标签: mariadb master slave binary-log


    【解决方案1】:

    解决了!

    我使用了 /etc/my.cnf.d/server.cnf 下的 [mysqld] 部分 但是没注意我的 /etc/my.cnf 文件丢失了。

    so... "my.cnf.d/*.cnf" 文件的内容根本没有被使用 解决方案是:

    重新创建/etc/my.cnf文件

    [mysqld]
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    # Disabling symbolic-links is recommended to prevent assorted security risks
    symbolic-links=0
    # Settings user and group are ignored when systemd is used.
    # If you need to run mysqld under a different user or group,
    # customize your systemd unit file for mariadb according to the
    # instructions in http://fedoraproject.org/wiki/Systemd
    
    [mysqld_safe]
    log-error=/var/log/mariadb/mariadb.log
    pid-file=/var/run/mariadb/mariadb.pid
    
    #
    # include all files from the config directory
    #
    !includedir /etc/my.cnf.d
    

    然后重启mariadb服务

    systemctl restart mariadb
    

    【讨论】:

      猜你喜欢
      • 2015-06-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-23
      • 2020-05-13
      • 2020-10-12
      相关资源
      最近更新 更多