Showing posts with label MySQL. Show all posts
Showing posts with label MySQL. Show all posts

Tuesday 10 November 2020

MySQL : Troubleshooting Replication

If you have followed the instructions to make a replica (If not have a visit at this quick post), and your replication setup is not working, than the first thing to do is check MySQL error log. (if you dont know where it is? Just check my.cnf for the location of that file). Most of time, you will get the actual error from the log if not than you can try below things.

 

  • Check master server and verify that binlog is enable or not and position is rotating or not by using “show master status” command.
  • Master and slave server both must have unique server_id.
  • Run “show slave status” command on slave server and check below values first.Slave_IO_Running:Slave_SQL_Running: Last_errno: 0 Last_error:
  • If “Slave_IO_Running” is “YES” than slave is able to connect master and getting log entries from master but if it’s “NO” that means slave is not able to connect to master so check the values of Master_Host, Master_User, Master_Pass that it is right or not. Also check the connectivity between master and slave for mysql as well as network side.
  • If “Slave_SQL_Running” is “YES” than no issue with sql thread butit its “NO” than you should get error on “Last_error”.
  • Most of time, you will get the query related error in “Last_error” section.
  • If the slave was running previously but stopped suddenly than the reason usually is that some statement that succeeded on the master failed on the slave.
  • If a statement that succeeded on the master but refuses to run on the slave, try to do the below things. Because it‘s not feasible to do a full database resynchronization from the masterby copying a new snapshot/backup from the master.
  • Sometimes, its happening when table changes are done in master server but somehow its not replicated on slave so slave will refuse to run the statement and give error. In this situation, we have synchronize the changes and start replication with simple “Start Slave” command.
  • Sometimes, we are getting some error which can be solve by running that statement manually. At that time we can just stop slave completely, skip the statement with “ set global sql_slave_skip_counter=1” command, start the slave.

Tuesday 27 October 2020

Mysql Database Installation and Administration

MySQL is an excellent open-source relational database management system. In 2010, MySQL was forked into MariaDB after its purchase by Oracle. MariaDb is a community driven and developed, relational database management system (RDBMS). It continues to be a free and open-source software licensed under the GNU General Public License.

Wednesday 14 October 2020

MySQL : Cache

 

Following caches are generally available in MySQL.

 

Thursday 17 September 2020

MySQL : Flush Tables

  “FLUSH TABLES” is generally used for closing all tables by force in MySQL. Its really interesting that how mysql do this. Most of time we are doing this because someone adds new tables outside of MySQL.

MySQL : Setup Master and Slave replica (Same server)

 

MySQL replication is a core process for maintaining multiple copies of data – and replication is a very important aspect in database administration.

This setup provides redundancy and fault tolerance such that in the event of a failure in the Master node, the databases can still be recovered in the Slave node.