×
Create a new article
Write your page title here:
We currently have 3,189 articles on s23. Type your article name above or create one of the articles listed here!



    s23
    3,189Articles

    Mysql-master-slave-replication: Difference between revisions

    Content added Content deleted
    imported>Hundfred
    No edit summary
    imported>Hundfred
    No edit summary
    Line 29: Line 29:
    master-connect-retry=60 #in seconds
    master-connect-retry=60 #in seconds
    </pre>
    </pre>

    then we start the master, and check with the "show master status" command, which bin-log
    file is acutally used:
    <pre>
    mysql> show master status;
    +--------------------+----------+--------------+------------------+
    | File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
    +--------------------+----------+--------------+------------------+
    | KURS006-bin.000006 | 106 | testdbsm | mysql |
    +--------------------+----------+--------------+------------------+
    1 row in set (0.00 sec)

    mysql>
    <pre>

    Revision as of 07:55, 24 June 2009

    mysql-master-slave-replication

    1)on the master and the slave a new "replication" user has to be added

    mysql> create user repuser@kurs007 identified by 'xxxxx';
    Query OK, 0 rows affected (0.00 sec)
    

    2) set some rights

    mysql> create user repuser@kurs007 identified by 'xxxxx';
    Query OK, 0 rows affected (0.00 sec)
    

    now we have to edit the my.ini on the master and the slave

    master:

    server_id=1
    

    (there are loads of options, it is also possible to encrypt the connection with ssl.)

    slave:

    server-id=2
    master-host=<ip_address or fqdn>
    master-port=3306
    master-user=repuer #username
    master-passwort=xxxxx #can be given here, or later, if mysqld is started
    master-connect-retry=60 #in seconds
    

    then we start the master, and check with the "show master status" command, which bin-log file is acutally used:

    mysql> show master status;
    +--------------------+----------+--------------+------------------+
    | File               | Position | Binlog_Do_DB | Binlog_Ignore_DB |
    +--------------------+----------+--------------+------------------+
    | KURS006-bin.000006 |      106 | testdbsm     | mysql            |
    +--------------------+----------+--------------+------------------+
    1 row in set (0.00 sec)
    
    mysql>
    
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.