qcloud
V2EX  ›  问与答

有熟悉 myqsl 的朋友吗,麻烦给看下这个配置有问题吗?

  •  
  •   qcloud · Jun 5, 2016 · 1314 views
    This topic created in 3665 days ago, the information mentioned may be changed or developed.
    两台数据库服务器,在搞主主同步,主服务器已经配置完毕,启动正常,但是从服务器就是启动失败,大家看看我这个从服务器配置有问题吗?
    https://ooo.0o0.ooo/2016/06/05/575400af39eb5.png
    报错日志
    https://ooo.0o0.ooo/2016/06/05/575402713de42.png
    2 replies    2016-06-05 18:50:49 +08:00
    notgod
        1
    notgod  
       Jun 5, 2016
    mysqld: unknown variable ‘ master-host=

    Are you trying to setup on replication on mysql5.5+ ? ok. then that ’ s the issue.

    The following options are removed in MySQL 5.5. If you attempt to start mysqld with any of these options in MySQL 5.5, the server aborts with an unknown variable error.

    – master-host
    – master-user
    – master-password
    – master-port

    Solution, comment the master- related variables.
    Do following,
    On Master:
    mysql>GRANT REPLICATION SLAVE ON *.* TO ‘ slave_user ’@’%’ IDENTIFIED BY ‘‘; (Replace with a real password!)
    mysql>FLUSH PRIVILEGES;
    mysql>FLUSH TABLES WITH READ LOCK;
    mysql>SHOW MASTER STATUS;
    # get the DB dump.
    mysql>UNLOCK TABLES;

    On Slave:
    # import the DB dump
    mysql>stop slave;
    mysql>CHANGE MASTER TO MASTER_HOST=’ prod_master ’, MASTER_USER=’ slave_user ’, MASTER_PASSWORD=’‘, MASTER_LOG_FILE=’ mysql-bin.0xx ‘, MASTER_LOG_POS=33421;
    mysql>start slave;

    Ref: http://dev.mysql.com/doc/refman/5.5/en/replication-options-slave.html
    notgod
        2
    notgod  
       Jun 5, 2016   ❤️ 1
    由於 mysql 5.5 開始不支援 my.cnf 裡 master-host 等的設定
    所以不能把 master 的參數設定到裡頭
    只能透過 sql 指令的方式建立 replication 連結
    不然會看到下面錯誤訊息


    Installing MariaDB/MySQL system tables in '/home/mysql/data' ...
    130208 7:08:31 [ERROR] /usr/local/mysql/bin/mysqld: unknown variable 'master-host=192.168.100.1'
    130208 7:08:31 [ERROR] Aborting


    以下是針對 slave 的操作步驟:

    install mysql
    start mysql
    restore db
    SQL : slave stop
    SQL : change master to master_host='192.168.100.1', master_port=3306, master_user='repl', master_password='xxxxxxx';
    SQL : slave start
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   845 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 21:07 · PVG 05:07 · LAX 14:07 · JFK 17:07
    ♥ Do have faith in what you're doing.