1

I performed the configuration of a database replication (slave), performed it as MASTER MASTER, however, every time I restart as machines, I need to manually start the slave

I use the command:

START REPLICA USER = 'repl' PASSWORD = 'password';

I want to know if I can define that when starting the system, the slave will automatically connect with this username and password...

If someone can help me...

I'm using mysql 8

3 Answers 3

2

After you setup your replication, go see if you have skip-slave-start in your my.cnf.

grep -c "^skip-slave-start" /etc/my.cnf

If you get 1 as a return, simply comment it out

#skip-slave-start

You may want to leave skip-slave-start to avoid split-brain scenarios occurring.

If you do this, it is at your own risk

0

I managed to solve it, in the case when we are configuring the replica we use

CHANGE REPLICATION SOURCE TO 
    SOURCE_HOST = 'ipLocalMaquina1',  
    SOURCE_LOG_FILE = 'mysql-bin.00000x', 
    SOURCE_LOG_POS = 713, 
    SOURCE_SSL = 1; 

However, I forgot to set the username, password and port;

I performed the following procedures:

Stop the slave:

Stop the replica; 

Reset as slave settings:

reset replica; 

Configure the file again, but now like this:

CHANGE REPLICATION SOURCE TO 
    SOURCE_HOST = '10 .158.0.24 ', 
    SOURCE_USER =' repl ', 
    SOURCE_PORT = 3306, 
    SOURCE_PASSWORD =' xxxxx ',   
    SOURCE_LOG_FILE =' binlog.000003 ', 
    SOURCE_LOG_POS = 156_, 
    SOURCE_SSL=1;

Start the slave:

start replica; 
-1

enable this line in the my.cnf (or my.ini) file.

skip-slave-start = FALSE
2
  • Nice advice, but that option is off by default. It's better to look for skip-slave-start and remove it. Nov 17, 2021 at 19:12
  • I'm on ubuntu 20.04, the my.cnf file has nothing and the other files don't have this option, if you can help me Nov 17, 2021 at 19:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.