This is a read-only copy of the MariaDB Knowledgebase generated on 2024-12-24. For the latest, interactive version please visit https://mariadb.com/kb/.

启动从服务

START SLAVE ["connection_name"] [thread_type [, thread_type] ... ]
START SLAVE ["connection_name"] [SQL_THREAD] UNTIL                
    MASTER_LOG_FILE = 'log_name', MASTER_LOG_POS = log_pos
START SLAVE ["connection_name"] [SQL_THREAD] UNTIL
    RELAY_LOG_FILE = 'log_name', RELAY_LOG_POS = log_pos
START ALL SLAVES [thread_type [, thread_type]]
thread_type: IO_THREAD | SQL_THREAD

没有指定线程类型的START SLAVE 操作,会同时开启来个线程。I/O 线程会从主服务中读取事件,并记录到日志。接着SQL线程会读取日志,然后执行相关操作。 START SLAVE 需要超级权限。

如果START SLAVE 成功拉起 slave 线程,那就不会报异常。但是,也有可能成功开启了,然后,不一会又停机了(比如说没有管理好与主机的连接,或者读取 binary log 失败,或者其他的问题导致的)。START SLAVE 不会提示这些信息的。你必须自己检查slave执行中记录下的错误日志,或者用 SHOW SLAVE STATUS命令查看相关状态。

MariaDB starting with 10.0

START ALL SLAVES 会开启之前没有启动的所有slaves。 当然也会给所有开启的slaves一个 note 。你可以用命令SHOW WARNINGS 查看所有的note

See also

  • CHANGE MASTER TO 用来创建或者改变连接。
  • STOP SLAVE 用来停止正在运行的连接。
  • RESET SLAVE用来重新设置连接参数或者用来永久的删除与主机的连接。
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.