日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql 5.7 双主配置_MySQL5.7.18 双主配置

發(fā)布時(shí)間:2024/9/19 数据库 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql 5.7 双主配置_MySQL5.7.18 双主配置 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

環(huán)境

RedHat6.5 64位

IP

MySQL5.7

9.1.8.155

/usr/local/mysql

9.1.8.154

/usr/local/mysql

9.1.8.155 配置

[root@zdhhadba ~]# cat /etc/my.cnf

[mysqld]

user = mysql

port = 3306

server_id = 1

socket=/data/mysql/mysql.sock

basedir =/usr/local/mysql #安裝目錄

datadir =/data/mysql #數(shù)據(jù)倉(cāng)庫地址

lower_case_table_names=1

log-bin = mysql-bin

### ---------------db that need replicate

binlog_do_db = zdhtst1

replicate-do-db = zdhtst1

binlog_do_db = zdhtst2

replicate-do-db = zdhtst2

binlog_do_db = jeecg

replicate-do-db = jeecg

### ---------------db that need replicate

binlog-ignore-db = mysql

replicate-ignore-db = mysql

#auto-increment-increment = 2

#auto-increment-offset = 2

[root@zdhhadba ~]# mysql -uroot -p111111 -S /data/mysql/mysql.sock

mysql: [Warning] Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1427861

Server version: 5.7.18-log MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show slave status\G

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

Slave_IO_State: Waiting for master to send event

Master_Host: 9.1.8.155

Master_User: repl

Master_Port: 3306

Connect_Retry: 60

Master_Log_File: mysql-bin.000003

Read_Master_Log_Pos: 154

Relay_Log_File: zdhhadba-relay-bin.000007

Relay_Log_Pos: 367

Relay_Master_Log_File: mysql-bin.000003

Slave_IO_Running: Yes

Slave_SQL_Running: Yes

Replicate_Do_DB: zdhtst1,zdhtst2,jeecg

Replicate_Ignore_DB: mysql

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: 154

Relay_Log_Space: 743

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: 2

Master_UUID: f6a093d2-4119-11e7-a20d-005056aa3bf3

Master_Info_File: /data/mysql/master.info

SQL_Delay: 0

SQL_Remaining_Delay: NULL

Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates

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

Replicate_Rewrite_DB:

Channel_Name:

Master_TLS_Version:

1 row in set (0.00 sec)

mysql> show master status\G

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

File: mysql-bin.000003

Position: 37332794

Binlog_Do_DB: zdhtst1,zdhtst2,jeecg

Binlog_Ignore_DB: mysql

Executed_Gtid_Set:

1 row in set (0.00 sec)

9.1.8.154 配置

[root@zdhhadbb ~]# cat /etc/my.cnf

[mysqld]

user = mysql

port = 3306

server_id = 2

socket=/data/mysql/mysql.sock

basedir =/usr/local/mysql #安裝目錄

datadir =/data/mysql #數(shù)據(jù)倉(cāng)庫地址

lower_case_table_names=1

log-bin = mysql-bin

### ---------------db that need replicate

binlog_do_db = zdhtst1

replicate-do-db = zdhtst1

binlog_do_db = zdhtst2

replicate-do-db = zdhtst2

binlog_do_db = jeecg

replicate-do-db = jeecg

### ---------------db that need replicate

binlog-ignore-db = mysql

replicate-ignore-db = mysql

#auto-increment-increment = 2

#auto-increment-offset = 2

[root@zdhhadbb ~]# mysql -uroot -pmusingtec -S /data/mysql/mysql.sock

mysql: [Warning] Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1427672

Server version: 5.7.18-log MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show slave status\G

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

Slave_IO_State: Waiting for master to send event

Master_Host: 9.1.8.154

Master_User: repl

Master_Port: 3306

Connect_Retry: 60

Master_Log_File: mysql-bin.000003

Read_Master_Log_Pos: 37332794

Relay_Log_File: zdhhadbb-relay-bin.000006

Relay_Log_Pos: 37333007

Relay_Master_Log_File: mysql-bin.000003

Slave_IO_Running: Yes

Slave_SQL_Running: Yes

Replicate_Do_DB: zdhtst1,zdhtst2,jeecg

Replicate_Ignore_DB: mysql

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: 37332794

Relay_Log_Space: 38749550

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: e8bda496-4119-11e7-bc47-005056aa2bfe

Master_Info_File: /data/mysql/master.info

SQL_Delay: 0

SQL_Remaining_Delay: NULL

Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates

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

Replicate_Rewrite_DB:

Channel_Name:

Master_TLS_Version:

1 row in set (0.00 sec)

mysql> show master status\G

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

File: mysql-bin.000003

Position: 154

Binlog_Do_DB: zdhtst1,zdhtst2,jeecg

Binlog_Ignore_DB: mysql

Executed_Gtid_Set:

1 row in set (0.00 sec)

mysql>

總結(jié)

以上是生活随笔為你收集整理的mysql 5.7 双主配置_MySQL5.7.18 双主配置的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。