ip地点不能写为%. 由于主从备份中,当前建设的用户,是给从库Slave会见主库Master行使的.用户必需有指定的会见解点.不能是通用地点.

1.3.1.3.3 查察用户
- use mysql;
- select host, name from user;
1.3.1.3.4 查察Master信息
- show master status;
1.3.2 Slave[从库]设置
1.3.2.1 修改Slave设置文件
- /etc/my.cnf
1.3.2.1.1 server_id
独一标识, 本情形中设置为 : 2
1.3.2.1.2 log_bin
可以行使默认设置, 也可以注释.
1.3.2.2 可选: 修改uuid
主从模式要求多个MySQL物理名称不能沟通. 即按装MySQL进程中Linux自动天生的物理符号. 独一物理符号定名为uuid. 生涯位置是MySQL数据库的数据存放位置. 默以为/var/lib/mysql目次中. 文件名是auto.cnf.
修改auto.cnf文件中的uuid数据. 随意修改,不提议改变数据长度.提议改变数据内容.
- /var/lib/mysql/auto.cnf
1.3.2.3 重启MySQL处事
- service mysqld restart
1.3.2.4 设置Slave
1.3.2.4.1 会见mysql
- mysql -uusername -ppassword
1.3.2.4.2 遏制Slave成果
- stop slave
1.3.2.4.3 设置主库信息
必要修改的数据是依据Master信息修改的. ip是Master地址物理机IP. 用户名和暗码是Master提供的Slave会见用户名和暗码. 日记文件是在Master中查察的主库信息提供的.在Master中行使呼吁show master status查察日记文件名称.
- change master to master_host=’ip’, master_user=’username’, master_password=’password’, master_log_file=’log_file_name’;
- change master to master_host='192.168.199.212', master_user='slave', master_password='slave', master_log_file='master_log.000001';
1.3.2.4.4 启动Slave成果
- start slave;
1.3.2.4.5 查察Slave设置
- show slave status G;
- mysql> show slave status G;
- *************************** 1. row ***************************
- Slave_IO_State: Waiting for master to send event
- Master_Host: 192.168.120.139
- Master_User: slave
- Master_Port: 3306
- Connect_Retry: 60
- Master_Log_File: master-log.000001
- Read_Master_Log_Pos: 427
- Relay_Log_File: mysqld-relay-bin.000002
- Relay_Log_Pos: 591
- Relay_Master_Log_File: master-log.000001
- 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: 427
- Relay_Log_Space: 765
- 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 最后一次错误的IO哀求编号
- Last_IO_Error:
- Last_SQL_Errno: 0 最后一次错误的执行SQL呼吁编号.
- Last_SQL_Error:
- Replicate_Ignore_Server_Ids:
- Master_Server_Id: 1
- Master_UUID: 9ee988ac-8751-11e7-8a95-000c2953ac06
- Master_Info_File: /var/lib/mysql/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)
1.3.3 测试主从
1.4 主从模式下的逻辑图

2 MyCat读写疏散设置 (编辑:湖南网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|