zoukankan      html  css  js  c++  java
  • centos6.5 mysql5.6主从复制

    centos6.5   mysql5.6主从复制

    mysql  vi /etc/my.cnf

    [client]

    default-character-set = utf8

    port            = 3306

    socket          = /usr/local/mysql/mysql.sock

    [mysqld]

    server-id=1

    log-bin=mysqlmaster-bin.log

    sync_binlog=1

    replicate-wild-ignore-table=mysql.%,information_schema

    binlog-do-db=huochetoudalian

    port            = 3306

    socket          = /usr/local/mysql/mysql.sock

    skip-external-locking

    key_buffer_size = 16M

    max_allowed_packet = 1M

    table_open_cache = 64

    sort_buffer_size = 512K

    net_buffer_length = 8K

    read_buffer_size = 256K

    read_rnd_buffer_size = 512K

    myisam_sort_buffer_size = 8M

    datadir         = /home/mysql/mysqldb

    max_connections=1000

    innodb_data_file_path=ibdata1:200M:autoextend

    innodb_log_files_in_group=2

    innodb_log_file_size=1048576000

    mysql salt  vi /etc/my.cnf

    [client]

    default-character-set = utf8

    port            = 3306

    socket          = /usr/local/mysql/mysql.sock

    # Here follows entries for some specific programs

    # The MySQL server

    [mysqld]

    server-id       = 2

    replicate-wild-ignore-table=mysql.%,information_schema

    replicate-do-db=huochetoudalian

    read-only=1

    log-bin=mysqlslave-bin.log

    port            = 3306

    socket          = /usr/local/mysql/mysql.sock

    skip-external-locking

    key_buffer_size = 16M

    max_allowed_packet = 1M

    table_open_cache = 64

    sort_buffer_size = 512K

    net_buffer_length = 8K

    read_buffer_size = 256K

    read_rnd_buffer_size = 512K

    myisam_sort_buffer_size = 8M

    datadir         = /home/mysql/mysqldb

    max_connections=1000

    innodb_data_file_path=ibdata1:200M:autoextend

    innodb_log_files_in_group=2

    innodb_log_file_size=1048576000

    mysql  

    > change master to master_host='192.168.11.94',master_user='root',master_password='123456'

    >start slave;

    mysql> show slave statusG;

    *************************** 1. row ***************************

                   Slave_IO_State: Waiting for master to send event

                      Master_Host: 192.168.11.94

                      Master_User: root

                      Master_Port: 3306

                    Connect_Retry: 60

                  Master_Log_File: mysqlmaster-bin.000002

              Read_Master_Log_Pos: 1800

                   Relay_Log_File: mysqlslave-relay-bin.000009

                    Relay_Log_Pos: 289

            Relay_Master_Log_File: mysqlmaster-bin.000002

                 Slave_IO_Running: Yes

                Slave_SQL_Running: Yes

                  Replicate_Do_DB: huochetoudalian

              Replicate_Ignore_DB: 

               Replicate_Do_Table: 

           Replicate_Ignore_Table: 

          Replicate_Wild_Do_Table: 

      Replicate_Wild_Ignore_Table: mysql.%,information_schema

                       Last_Errno: 0

                       Last_Error: 

                     Skip_Counter: 0

              Exec_Master_Log_Pos: 1800

                  Relay_Log_Space: 467

                  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

                      Master_UUID: fa4dc89e-d063-11e4-9712-000c295aadd9

                 Master_Info_File: /home/mysql/mysqldb/master.info

                        SQL_Delay: 0

              SQL_Remaining_Delay: NULL

          Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it

               Master_Retry_Count: 86400

                      Master_Bind: 

          Last_IO_Error_Timestamp: 

         Last_SQL_Error_Timestamp: 

                   Master_SSL_Crl: 

               Master_SSL_Crlpath: 

               Retrieved_Gtid_Set: 

                Executed_Gtid_Set: 

                    Auto_Position: 0

    1 row in set (0.00 sec)

    ERROR: 

    No query specified

      mysql5.6  主从切换

    从变成主

    >reset master;

    >stop slave;

    >reset slave;

    把主mysql配置文件/etc/my.cnf复制到这台将要变为主的/etc/my.cnf

    service mysql start

    主变为从

    >reset master;

    >stop slave;

    >reset slave;

    把从mysql配置文件/etc/my.cnf复制到这台将要变为从的/etc/my.cnf

    service mysql start

    >change master to master_host='192.168.11.99',master_user='root',master_password='123456';

    >start slave;

  • 相关阅读:
    讨喜的隔离可变性(十三)角色的特性
    讨喜的隔离可变性(十三)角色的特性
    解锁不可见索引新特性,处理ORA-01555故障
    django url 正则匹配
    django 往session写信息
    django 判断用户是否登录
    django 管理session
    Python爬虫入门教程 1-100 CentOS环境安装
    django session管理
    案发现场:被注入的软件及 ORA-600 16703 灾难的恢复
  • 原文地址:https://www.cnblogs.com/zenghui940/p/4357512.html
Copyright © 2011-2022 走看看