What is the best and easiest to implement replication in MySQL?

I would like to implement a simple replication between two MySQL database server (a master and a slave). What is the easiest way to do this?

Tags: , , , ,

One Response to “What is the best and easiest to implement replication in MySQL?”

  1. jobaji00 says:

    PREPARATION OF THE MASTER SERVER
    1. Select a master server. Can be any of them.
    2. Ensure that all existing databases to replicate the slaves! The easiest way is to copy the database directory in the MySQL data directory intact along his slave, and then recursively chown to "MySQL: MySQL." Remember, the binary structure of the file system to load, so that you can not do this between MySQL servers on different operating systems. In this case, you probably want to use mysqldump.
    3. Create / etc / ml. CNF if you have one:
    [mysqld]
    socket = / tmp / mysql. sock [enter your route MySQL. sock here]
    server-id = 1
    log-bin = mysql-bin
    binlog-do-db = # ariefcarey the database entry to be replicated
    binlog-ignore-db = MySQL 1 # input the database that should be ignored for the replication
    binlog-ignore-db = mysql2 # input the database that should be ignored for the replication
    4. Let your slave server to replicate the issue the following SQL command (substituting the IP of your favorite slave and password):
    > slave MySQL Replication Grant *. * A 'replicate' @ '192. 168. 1. IDENTIFIED BY Somepass 1'' ';
    5. Stop and restart the MySQL daemon and check that everything is functional.
    [edit] PREPARATION OF THE SLAVE
    1. Create / etc / ml. CNF if you have one:
    [mysqld]
    socket = / tmp / mysql. sock [enter your route MySQL. sock here]
    server-id = 2 [must be different from the teacher]
    master-host = 192. 168. 1. 1
    master-user = replicate
    master-password = somepass
    2. Stop and restart MySQL slave.
    3. Run the following SQL command to verify the status
    mysql> show slave G;
    Sure that the following two fields show the following:
    Slave_IO_Running: Yes
    Slave_SQL_Running: Yes
    If not, try running the following command:
    > mysql start slave;
    This manual process begins slaves. Note that only the tables have been updated and inscriptions of slaves after the trial has begun is sent from the master to the slave – not a differential reproduction.
    [edit] Test
    Just to update some data on the master, and the consultation on the register of slaves. The upgrade should be instantaneous.
    Try to create a table in the master database server MySQL:
    > Mysql replicateddb use;
    Database changed
    Example4 CREATE TABLE (id INT NOT NULL, PRIMARY KEY (id), name varchar (30), age INT);
    Query OK, 0 rows affected (0. 04 sec)
    And check the database on the slave to ensure that the newly created table in the master has been replicated successfully.