MySql (local-Online) replication



  • I am trying to apply MySql replication between a local server (Master) and an online server (Slave) and need your help.

    ** All names (username – password – server name) are just an example and not the real ones.

    I have a Local server (Local-1) and I have configured it as (Master) like this:

    (my.ini)
    # The MySQL server
    [mysqld]
    server-id=2962083
    log_bin=mysql-bin
    log_error=mysql-bin.err
    binlog_do_db=test1
    

    then I created a New User (User1) with all privileges.

    Now to try replication I have used a second local server (Local-2) as a test server and configured it to be a slave server for replication:

    (my.ini)
    # The MySQL server
    [mysqld]
    master_info_repository=TABLE
    relay_log_info_repository=TABLE
    

    then used shell to apply:

    CHANGE MASTER ‘TEST1’ TO MASTER_HOST=’Local-1’, MASTER_USER=’User1’, MASTER_ PASSWORD=’Password1’;
    

    And after running slave everything worked properly and I have got my databases synced.

    Now I am trying to do the same with the online server, but in case to build a connection with my local server (Server-1) I need a Dynamic DNS because I have no fixed IP.

    I have registered on noip.com and got the DUC and given my (Local-1) server a name (testpc.ddns.net). After that I did the following with my online server:

    (my.ini)
    # The MySQL server
    [mysqld]
    master_info_repository=TABLE
    relay_log_info_repository=TABLE
    

    then used shell to apply:

    CHANGE MASTER ‘TEST1’ TO MASTER_HOST=’ testpc.ddns.net, MASTER_USER=’User1’, MASTER_ PASSWORD=’Password1’;
    

    But it could not connect giving me: Slave_IO_State Connecting to master all the time.

    I have tried the following;

    • Turned off the firewall on Server-1.
    • Opened port 3306 for the incoming and outgoing on Server-1.
    • Enabled port forwarding on my router as the following: Service Name: MySQL Server Protocol: Both External Port: 3306 Internal Port: Internal IP Address: 192.168.1.50 (Server-1 IP address)
    • Tried (mysql-server.ithopehoms.ddns.net) instead of (ithopehoms.ddns.net) on the online server.
    • Tried (IP) instead of (ithopehoms.ddns.net) on the online server.


  • 1.cat network dns

    2.ping

    ping ip/hostname must ok

    3.need check error log




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2