a亚洲精品_精品国产91乱码一区二区三区_亚洲精品在线免费观看视频_欧美日韩亚洲国产综合_久久久久久久久久久成人_在线区

首頁 > 數據庫 > 文庫 > 正文

數據庫集群的主從復制模型完整達成

2024-09-07 22:12:58
字體:
來源:轉載
供稿:網友
  主從配置過程:
  參看:
      https://mariadb.com/kb/en/library/setting-up-replication/
      https://dev.mysql.com/doc/refman/5.5/en/replication-configuration.html
  主服務器192.168.27.7配置:
 
  [root@master ~]$vim /etc/my.cnf
  [mysqld]
  datadir=/var/lib/mysql
  socket=/var/lib/mysql/mysql.sock
  # Disabling symbolic-links is recommended to prevent assorted security risks
  symbolic-links=0
  innodb_file_per_table
  log_bin
  server-id=1
 
  MariaDB [(none)]> grant replication slave on *.* to repluser@'192.168.27.%' identified by 'centos';
  Query OK, 0 rows affected (0.00 sec)
  從服務器192.168.27.17服務配置:
 
  從服務器上的配置:
  [mysqld]
  datadir=/var/lib/mysql
  socket=/var/lib/mysql/mysql.sock
  # Disabling symbolic-links is recommended to prevent assorted security risks
  symbolic-links=0
  # Settings user and group are ignored when systemd is used.
  innodb_file_per_table
  server_id=2
 
  注意:默認的server_id是0;
  MariaDB [(none)]> show variables like 'server_id';
  +---------------+-------+
  | Variable_name | Value |
  +---------------+-------+
  | server_id     | 0     |
  +---------------+-------+
  1 row in set (0.01 sec)
 
 
  查看幫助:
  MariaDB [(none)]> help change master to;
  CHANGE MASTER TO
    MASTER_HOST='master2.mycompany.com',
    MASTER_USER='replication',
    MASTER_PASSWORD='bigs3cret',
    MASTER_PORT=3306,
    MASTER_LOG_FILE='master2-bin.001',
    MASTER_LOG_POS=4,
    MASTER_CONNECT_RETRY=10;
 
 
  MariaDB [(none)]> CHANGE MASTER TO
      ->   MASTER_HOST='192.168.27.7',
      ->   MASTER_USER='repluser',
      ->   MASTER_PASSWORD='centos',
      ->   MASTER_PORT=3306,
      ->   MASTER_LOG_FILE='mariadb-bin.000001',
      ->   MASTER_LOG_POS=245,
      ->   MASTER_CONNECT_RETRY=10;
  Query OK, 0 rows affected (0.02 sec)
 
 
 
 
  MariaDB [(none)]> show slave status/G
  *************************** 1. row ***************************
                 Slave_IO_State:
                    Master_Host: 192.168.27.7
                    Master_User: repluser
                    Master_Port: 3306
                  Connect_Retry: 10
                Master_Log_File: mariadb-bin.000001
            Read_Master_Log_Pos: 245
                 Relay_Log_File: mariadb-relay-bin.000001
                  Relay_Log_Pos: 4
          Relay_Master_Log_File: mariadb-bin.000001
               Slave_IO_Running: No     線程未啟動;
              Slave_SQL_Running: No     線程未啟動;
                Replicate_Do_DB:
            Replicate_Ignore_DB:
             Replicate_Do_Table:
         Replicate_Ignore_Table:
        Replicate_Wild_Do_Table:
    Replicate_Wild_Ignore_Table:
 
  MariaDB [(none)]> show slave status/G
  *************************** 1. row ***************************
                 Slave_IO_State: Waiting for master to send event
                    Master_Host: 192.168.27.7
                    Master_User: repluser
                    Master_Port: 3306
                  Connect_Retry: 60
                Master_Log_File: mariadb-bin.000002
            Read_Master_Log_Pos: 245     讀取的日志的位置;
                 Relay_Log_File: mariadb-relay-bin.000005
                  Relay_Log_Pos: 531
          Relay_Master_Log_File: mariadb-bin.000002
               Slave_IO_Running: Yes
              Slave_SQL_Running: Yes
                Replicate_Do_DB:
            Replicate_Ignore_DB:
             Replicate_Do_Table:
         Replicate_Ignore_Table:
        Replicate_Wild_Do_Table:
    Replicate_Wild_Ignore_Table:
                     Last_Errno: 0
                     Last_Error:
                   Skip_Counter: 0
            Exec_Master_Log_Pos: 245  執行的日志的位置;
                Relay_Log_Space: 1113
                Until_Condition: None
                 Until_Log_File:
                  Until_Log_Pos: 0
             Master_SSL_Allowed: No
             Master_SSL_CA_File:
             Master_SSL_CA_Path:
                Master_SSL_Cert:
              Master_SSL_Cipher:
                 Master_SSL_Key:
          Seconds_Behind_Master: 0     落后的時間差;
  Master_SSL_Verify_Server_Cert: No
                  Last_IO_Errno: 0
                  Last_IO_Error:
                 Last_SQL_Errno: 0
                 Last_SQL_Error:
    Replicate_Ignore_Server_Ids:
               Master_Server_Id: 1
  1 row in set (0.00 sec)

(編輯:武林網)

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 国产一区不卡 | 成人一区在线观看 | 亚洲人成人一区二区在线观看 | 亚洲一区二区三区免费在线观看 | 亚洲欧洲一区二区 | 在线看一级片 | 日韩午夜av | av成人在线观看 | 国产日产久久欧美精品一区 | 亚洲不卡 | 国产乱人伦av在线a 日韩电影中文字幕 | 日韩色在线 | 国产一区二区播放 | 日韩三级在线免费 | 超碰av人人 | 成人一区二区三区视频 | 夜夜操天天操 | 免费黄色福利网站 | 九九九久久国产免费 | 精品视频免费在线 | 国产不卡在线播放 | 欧美日韩色综合 | 99精品国产高清一区二区麻豆 | 国产精品久久久久久久久久免费 | 久久精品免费观看视频 | 成人xxx| 欧美精品久久久久久久亚洲调教 | 午夜精品影院 | 蜜桃视频成人m3u8 | 午夜精品久久久久久99热软件 | 国产情侣一区二区三区 | 在线精品观看 | 午夜不卡一区二区 | 国产免费自拍 | 中文字幕在线观看第一页 | 四虎电影网 | 欧美精品久久久久久久久 | www.色综合| 成人午夜激情 | 国产中文字幕在线观看 | 国产精品久久久久久亚洲调教 |