MySQL for the Internet of Things

(Steven Felgate) #1
Chapter 7 ■ high availability iOt SOlutiOnS

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql> CHANGE MASTER TO MASTER_HOST='10.0.1.17', MASTER_PORT=3306, MASTER_LOG_FILE=
'mysql-bin.000001', MASTER_LOG_POS=245, MASTER_USER='rpl', MASTER_PASSWORD='secret';
Query OK, 0 rows affected (0.22 sec)


This example uses the IP address of the Raspberry Pi, the port number (3306 is the default), the log file
and position from the SHOW MASTER STATUS command, and the username and password for the replication
user. If you typed the command correctly, it should return without errors. If there are errors or warnings, use
the SHOW WARNINGS command to read the warnings and correct any problems.
The next step is to start the slave processes. This command is simply START SLAVE. It normally does not
report any errors; you must use SHOW SLAVE STATUS to see them. Listing 7-5 shows both of these commands
in action.


■Tip For wide results, use the \G option to see the columns as rows (called vertical format).


Listing 7-5. Starting the Slave


mysql> start slave;
Query OK, 0 rows affected (0.00 sec)
mysql> show slave status \G
1. row
Slave_IO_State: Waiting for master to send event
Master_Host: 10.0.1.17
Master_User: rpl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000001
Read_Master_Log_Pos: 107
Relay_Log_File: clone-relay-bin.000003
Relay_Log_Pos: 4
Relay_Master_Log_File: mysql-bin.000001
Slave_IO_Running: Yes
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: 107
Relay_Log_Space: 555

Free download pdf