V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
qcloud
V2EX  ›  问与答

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

  •  
  •   qcloud · 2016-06-05 18:28:36 +08:00 · 968 次点击
    这是一个创建于 3097 天前的主题,其中的信息可能已经有所发展或是发生改变。
    两台数据库服务器,在搞主主同步,主服务器已经配置完毕,启动正常,但是从服务器就是启动失败,大家看看我这个从服务器配置有问题吗?
    https://ooo.0o0.ooo/2016/06/05/575400af39eb5.png
    报错日志
    https://ooo.0o0.ooo/2016/06/05/575402713de42.png
    2 条回复    2016-06-05 18:50:49 +08:00
    notgod
        1
    notgod  
       2016-06-05 18:49:34 +08:00
    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  
       2016-06-05 18:50:49 +08:00   ❤️ 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
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3132 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 13:28 · PVG 21:28 · LAX 05:28 · JFK 08:28
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.