Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Binlogging on server not active when setting up Master Slave replication on one machine

I am trying to set up Master Slave Replication on my local machine using this tutorial.

I am close to the end but when I try to run mysqldump using the --master-data=2 I get an error

mysqldump: Error: Binlogging on server not active

All the solutions I've come across have said to add log_bin = /var/log/mysql/mysql-bin.log to my.cnf which I have done and it doesn't seem to solve the issue.

This is my my.cnf file:

[client]
port            = 3306
socket          = /var/run/mysqld/mysqld.sock

[mysqld_safe]
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
nice            = 0

[mysqld_multi]
mysqld      = /usr/bin/mysqld_safe
mysqladmin  = /usr/bin/mysqladmin
user        = multi_admin
password    = multipass

[mysqld2]
user            = mysql
pid-file        = /var/run/mysqld/mysqld_slave.pid
socket          = /var/run/mysqld/mysqld_slave.sock
port            = 3307
basedir         = /usr
datadir         = /var/lib/mysql_slave
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
explicit_defaults_for_timestamp
server-id   = 2
relay-log   = /var/log/mysql_slave/relay-bin
relay-log-index = /var/log/mysql_slave/relay-bin.index
master-info-file = /var/log/mysql_slave/master.info
relay-log-info-file = /var/log/mysql_slave/relay-log.info
read_only   = 1

[mysqld1]
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3305
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
explicit_defaults_for_timestamp
server-id   = 1
log_bin     = /var/log/mysql/mysql-bin.log
innodb_flush_log_at_trx_commit = 1
sync_binlog = 1
binlog-format = ROW

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 0.0.0.0

log-error       = /var/log/mysql/error.log

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.

!includedir /etc/mysql/conf.d/
like image 694
Chris Starling Avatar asked Jul 20 '17 09:07

Chris Starling


1 Answers

May I suggest that you abandon mysql_multi and go with the Docker solution. This lets you have separate my.cnf files, which may be part of the problem.

There may even be a pair of Docker images already set up for Master and Slave. I'm pretty sure there is for Galera clustering.

I presume you are setting up M-S on a single server just for experimentation? Doing so for Production is virtually useless.

like image 70
Rick James Avatar answered Nov 15 '22 01:11

Rick James