国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
CentOS6.5搭建MySQL5.1主從復(fù)制
  • 環(huán)境:
1
2
3
4
5
6
7
mysql> select version();
+------------+
| version()  |
+------------+
| 5.1.73-log |
+------------+
1 row in set (0.00 sec)

  

1
2
[root@10-4-14-168 ~]# cat /etc/redhat-release
CentOS release 6.5 (Final)

  

1:已經(jīng)事先購(gòu)買了兩臺(tái)云主機(jī)

10.4.14.168      101.69.178.208 [聯(lián)通] Master

10.4.5.9         101.69.178.219 [聯(lián)通] Slave 

2:分別安裝MySQL

 

 
#yum install mysql-server –enablerepo=remi
 
#yum install mysql-devel

 

3:查看MySQL安裝情況

 [root@10-4-14-168 ~]#  rpm -qa | grep mysql*

mysql-5.1.73-3.el6_5.x86_64
mysql-libs-5.1.73-3.el6_5.x86_64
mysql-server-5.1.73-3.el6_5.x86_64
mysql-devel-5.1.73-3.el6_5.x86_64

 

4:?jiǎn)?dòng)MySQL

 

service mysqld start

 

 

5:登陸MySQL并且修改密碼并且刪除空用戶

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
mysql> UPDATE mysql.user SET password = PASSWORD('ge0513.mysql')
    -> WHERE user = 'root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3  Changed: 3  Warnings: 0
mysql> SELECT user,host,password FROM mysql.user;
+------+-------------+-------------------------------------------+
| user | host        | password                                  |
+------+-------------+-------------------------------------------+
| root | localhost   | *7AE39BE5035D5C32361400FF7DEDD757AA76896A |
| root | 10-4-14-168 | *7AE39BE5035D5C32361400FF7DEDD757AA76896A |
| root | 127.0.0.1   | *7AE39BE5035D5C32361400FF7DEDD757AA76896A |
|      | localhost   |                                           |
|      | 10-4-14-168 |                                           |
+------+-------------+-------------------------------------------+
5 rows in set (0.00 sec)
mysql> DROP user ''@localhost;
Query OK, 0 rows affected (0.00 sec)
mysql> DROP user ''@'10-4-14-168';
Query OK, 0 rows affected (0.00 sec)

 

6 :主庫(kù)需改配置文件,在/etc/my.cnf中添加

1
2
3
4
port = 3306
log_bin = /var/lib/mysql/mysql-binlog
server-id = 1 //只要主從不一樣就行
binlog_do_db = test//要做同步的數(shù)據(jù)庫(kù)名字,可以是多個(gè)數(shù)據(jù)庫(kù),之間用分號(hào)分割。

  從庫(kù)的配置文件中添加

1
2
3
4
5
6
7
server-id = 2
master-host = 10.4.14.168
master-user = gechong
master-password = gechong
master-port = 3306
master-connect-retry = 5
replicate-do-db = test

  分別重啟服務(wù),登陸數(shù)據(jù)庫(kù)。

 

7:主庫(kù)上創(chuàng)建復(fù)制用戶

1
GRANT REPLICATION SLAVE,REPLICATION CLIENT ON *.* TO gechong@'%' IDENTIFIED BY 'gechong';

8:在主庫(kù)上執(zhí)行

1
2
3
4
5
6
7
mysql> show master status;
+---------------+----------+--------------+------------------+
| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+---------------+----------+--------------+------------------+
| binlog.000003 |      412 |              |                  |
+---------------+----------+--------------+------------------+
1 row in set (0.00 sec)

從庫(kù)上執(zhí)行

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
mysql> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 10.4.14.168
                  Master_User: gechong
                  Master_Port: 3306
                Connect_Retry: 5
              Master_Log_File: mysql-binlog.000001
          Read_Master_Log_Pos: 325
               Relay_Log_File: mysqld-relay-bin.000002
                Relay_Log_Pos: 473
        Relay_Master_Log_File: mysql-binlog.000001
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: test
          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: 325
              Relay_Log_Space: 629
              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:
1 row in set (0.00 sec)

 

可以看到:Slave_IO_Running | Slave_SQL_Running兩個(gè)值都是YES,說明配置成功了??梢栽谥鲙?kù)的test庫(kù)里執(zhí)行DML或者DDL驗(yàn)證下。

 

 

 

如果同步不成功:

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
1:停掉從庫(kù)
mysql> slave stop
2:主庫(kù)上找到日志和位置
mysql> show master status;
3:手動(dòng)同步
mysql> change master to
> master_host='master_ip',
> master_user='gechong',
> master_password='gechong',
> master_port=3306,
> master_log_file='mysql-bin.000020',
> master_log_pos=135617781;
1 row in set (0.00 sec)
4:?jiǎn)?dòng)從庫(kù)
mysql> slave start;
1 row in set (0.00 sec)

 

  

 

 

如果有異常需要跳過:

1
2
3
>slave stop;
>SET GLOBAL sql_slave_skip_counter = 1;
>slave start;

  

主從搭建一般步驟:

求知若渴, 虛心若愚……
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
centos下MySQL主從同步配置
MySQL5.6 數(shù)據(jù)庫(kù)主從(Master/Slave)同步安裝與配置詳解
基于 CentOS Mysql 安裝與主從同步配置詳解
mysql 主從同步配置
mysqld_multi方式配置Mysql數(shù)據(jù)庫(kù)主從復(fù)制
MySQL配置主主及主從備份
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長(zhǎng)圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服