MySQL for the Internet of Things

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

How do you fix this? That depends. If you really wanted the testme database replicated, you would have
to stop replication, fix the master, and then reconnect the slave. I won’t go into these steps, but I list them
here as an outline for you to experiment on your own:



  1. Stop the slave.

  2. Go to the master and drop the database.

  3. Get the new SHOW MASTER STATUS data.

  4. Reconnect the slave.

  5. Start the slave.


Got that? Good. If not, it is a good exercise to go back and try these steps on your own.
Once you get the master cleaned and replication restarted, go ahead and try to create a database on
the master and observe the result on the slave. Listing 7-6 shows the commands. Note that I used a different
database name in case you elected to not try the previous challenge.


Listing 7-6. Testing Replicaiton of New Database on the Slave


pi@raspberrypi /etc $ mysql -uroot -psecret
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 38
Server version: 5.5.28-1-log (Debian)


Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.


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


mysql> create database testme_again;
Query OK, 1 row affected (0.00 sec)


mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| testme |
| testme_again |
+--------------------+
4 rows in set (0.01 sec)


mysql>

Free download pdf