MySql

MySQL master master replication

PDF

MySQL master-master replication (or multi master replication) offers a high availability failover solution. Other then in a master-slave replication setup you can write to all member master servers. Every master server is also a slave at the same time. Although all master server can write I would suggest to use only one active master server for writes and the other master be a passive master for reads and become active if the other server fails. With some monitoring scripts the passive master can become active within a fraction of a second.

 

DNS lookups slows down MySql

PDF
Access to a MySql database is granted based on username in combination with the hostname and a password. MySql will first try to lookup the hostname in the cache, if not found it tries to resolve the hostname. DNS resolution might become a performance issue. MySql will do a double reverse-DNS lookup, it will first lookup the hostname which belongs to the incoming ip-address, then it will lookup the ip-address belonging to the hostname and matches the incoming ip-address with the found ip-address by the DNS resolution. This all might work well, but it all relies on a good DNS infrastructure. Now what if the DNS server can not be reached? or the reverse DNS mappings do not match? In that case users might not be able to connect to the MySql server. To prevent this you should edit your MySql configuration and set skip_name_resolve in /etc/my.cnf If you already have your MySql server running you should convert the hostnames in the users table before restarting the mysqld daemon. Run the query:
SELECT user, host FROM mysql.user WHERE host RLIKE '[a-z]' AND host <> 'localhost';
to find the users and hostnames to be changed to ip-addresses. After changing the hostname into ipaddresses your can safely restart your MySql server
/etc/rc.d/mysqld restart
 

How to set-up MySql replication

PDF

There are a number of different methods for setting up replication, and the exact method that you use will depend on how you are setting up replication, and whether you already have data within your master database.

Create a user for replication

The slaves need to connect to the master using an account granted ‘REPLICATION SLAVE’. As the username and password is stored in a plain-text file it is advisable to create a user that only has privilages for the replication.

Tags:
 

How to recover from a lost MySql root password

PDF

If you somehow lost the MySql root password it is possible to recover in just a few steps.

First stop the running MySql daemon process:

Tags:
 

Search






You are here: Home Howtos and FAQs MySql