Mysql expire_logs_days max_binlog_size
At first, we need to consider the complexity needed for our setup. This tutorial focuses on smaller setups. It needs only two virtual or physical machines to achieve fault tolerance. Both servers keep each other up to date, a change on one server is replicated to the other and vice-versa.
We use Debian Jessie on both servers. This tutorial should mysql expire_logs_days max_binlog_size on other distributions as well though, provided the MySQL version is compatible. At first, we need mysql expire_logs_days max_binlog_size install the necessary packages: This needs to be done on both servers.
If the installation was successful, we configure both servers as follows. The mysql expire_logs_days max_binlog_size id entry is pretty self explanatory. The log-bin entry makes the server write a binary log, containing all transactions executed. The size and expiration date of those log files is limited to MB and 10 days.
The ignore entries make sure, we are not replicating the mysql core database, that contains users and other server mysql expire_logs_days max_binlog_size. We ask the server to create row-replication binary logs.
We can choose between row, statement and mixed replication modes but the MySQL documentation claims row mode to be the safest. It does however cause higher network traffic between both nodes. More information can be found here: The increment values make sure, one mysql expire_logs_days max_binlog_size only uses odd, the other only uses even auto-increment values, so as not to create conflicts.
Now we need to restart the server process on both servers. If you are trying to replicate an existing server with production databases, we first need to write-protect the whole server. We can do that by logging into the MySQL console on the server, using the following commands:. For the initial synchronisation, we mysql expire_logs_days max_binlog_size dump the content of the server by running mysqldump: After copying the dump to the other server, you can install it via mysql -u root -p.
Now both servers contain exactly the same data. Next we create the replication users on both servers:. You don't need to pick two different passwords for the replication mysql expire_logs_days max_binlog_size, if you only have a small setup. It should however be as long as possible, to hinder attackers replicating all our databases. At first, we start the replication on the second server, using the following commands:.
The second command lists information about the slave process. The most mysql expire_logs_days max_binlog_size lines are the following:. If the last entry is not null, wait for mysql expire_logs_days max_binlog_size synchronisation to finish.
The replication process created a binlog on the second server, containing the replication statements. When we start the replication on the first server, we want to skip these statements. That means we need to get the index of the last binary log entry. We can find it in the slave info list from before. Look out for the following lines:. These values might differ for your setup. We need to supply both values to the change master command on the first server. To achieve that, we need to run the following commands on server Use the values you read out before for the log file and log position.
Both servers should now replicate all databases. If you blocked the first server in the beginning, reverse that by issuing the following commands:. Check if everything works as expected by creating different databases on each server. If they show up on both servers, mysql expire_logs_days max_binlog_size works fine.
We have achieved active-active replication of our MySQL server. His main areas of expertise are software engineering and hardware virtualisation.
He's in charge of our web cluster setup and our development toolchain. Your email address will not be published. For the mysql expire_logs_days max_binlog_size of this tutorial, we mysql expire_logs_days max_binlog_size be using the following host configuration: Leave a Reply Cancel reply Your email address will not mysql expire_logs_days max_binlog_size published.