MySql 主從同步 (庫名不同)
主庫:192.168.1.250
從庫:192.168.1.199
主庫 my.ini
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html # *** DO NOT EDIT THIS FILE. It's a template which will be copied to the # *** default location during install, and will be replaced if you # *** upgrade to a newer version of MySQL. [mysqld] # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # These are commonly set, remove the # and set as required. # basedir = ..... # datadir = ..... # port = ..... # server_id = ..... # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M # 以下內容手動新增 [client] default-character-set=utf8 [mysqld] port=3306 server-id=1 log-bin=mysql-bin binlog-do-db=kintech_pd sync_binlog=1 basedir=C:\ProgramData\MySQL\MySQL Server 5.7 #解壓目錄下data目錄 datadir=C:\ProgramData\MySQL\MySQL Server 5.7\data sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES [WinMySQLAdmin] C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe
從庫 my.ini
# For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html # *** DO NOT EDIT THIS FILE. It's a template which will be copied to the # *** default location during install, and will be replaced if you # *** upgrade to a newer version of MySQL. [mysqld] # Remove leading # and set to the amount of RAM for the most important data # cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%. # innodb_buffer_pool_size = 128M # Remove leading # to turn on a very important data integrity option: logging # changes to the binary log between backups. # log_bin # These are commonly set, remove the # and set as required. # basedir = ..... # datadir = ..... # port = ..... # server_id = ..... # Remove leading # to set options mainly useful for reporting servers. # The server defaults are faster for transactions and fast SELECTs. # Adjust sizes as needed, experiment to find the optimal values. # join_buffer_size = 128M # sort_buffer_size = 2M # read_rnd_buffer_size = 2M # 以下內容手動新增 [client] default-character-set=utf8 [mysqld] #從庫配置 server_id=2 #如果庫名相同,使用這個 #replicate-do-db=kintech_pd #如果庫名不同,使用這個。 replicate-rewrite-db = kintech_pd -> kps_common #埠 port=3306 character_set_server=utf8 #解壓目錄 basedir=C:\ProgramData\MySQL\MySQL Server 5.7 #解壓目錄下data目錄 datadir=C:\ProgramData\MySQL\MySQL Server 5.7\data sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES [WinMySQLAdmin] C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe
主庫:記住 File 和 Position
CREATE USER 'slave'@'MySql2伺服器ip' IDENTIFIED BY '密碼';
GRANT REPLICATION SLAVE ON *.* TO 'slave'@'MySql2伺服器ip';
flush privileges;
show master status;
從庫:
CHANGE MASTER TO master_host = 'MySql1伺服器ip', master_user = 'slave', master_password = '密碼', master_log_file = 'bin_log.000002', master_log_pos = 631; start slave; show slave status\G
最後顯示:
代表成功。
相關推薦
MySql 主從同步 (庫名不同)
主庫:192.168.1.250 從庫:192.168.1.199 主庫 my.ini # For advice on how to change settings please see #
mysql 主從同步(自用)
mysql 主從同步最精簡的步驟和命令 mysqldump -h110.25.149.220 -uroot -pqwe~\!\@ zhly_db > /data/zhly_db.sql //備份sqlscp -P 2289 [email protected]:/da
Linux下配置MySQL主從同步(不復雜,簡單明瞭)
明人不說暗話,直接進入正題 一、準備工作 假設兩個伺服器IP如下: 主伺服器:44.92.163.112 -Linux 從伺服器:114.74.22.11 -Linux 注意: 1、主從資料庫版本最好一致; 2、主從資料庫內資料保持一致;
一、MySQL主從同步(binlog方式)
部署環境 機器A:192.168.2.63(主) 機器B:192.168.2.94(從) mysql-5.6.23 主(master)配置 修改mysql安裝目錄下my.ini配置檔案 log_bin=mysql-bin-1 #檔名mysql-bin-1 server_id=1 #服務ID,用
黃聰:mysql主從配置(清晰的思路)
mysql主從配置。鄙人是在如下環境測試的: 主資料庫所在的作業系統:win7 主資料庫的版本:5.0 主資料庫的ip地址:192.168.1.111 從資料庫所在的作業系統:linux 從資料的版本:5.0 從資料庫的ip地址:192.168.1.112 介紹完
mysql主從配置(清晰的思路)
主資料庫所在的作業系統:win7 主資料庫的版本:5.0 主資料庫的ip地址:192.168.1.111 從資料庫所在的作業系統:linux 從資料的版本:5.0 從資料庫的ip地址:192.168.1.112 介紹完了環境,就聊聊配置步驟: 1、
mysql主從複製(版本不一致)
mysql主從複製要求版本最好一致,至少前兩個版本號相同,因為官方推薦這樣,最主要還是怕版本不一致帶來的不相容問題;最近剛好在學習mysql主從複製,我已經有了兩臺伺服器,但是mysql版本並不一致,但是既然版本不一致有可能導致不相容,那麼我就讓低版本作為主ma
數據庫 之 Mysql的主主同步(雙主模型)
兩個 white serve 執行 密碼連接 進行 st3 提交 復制 1 概述互為主從:兩個節點各自都要開啟binlog和relay log; 1、數據不一致; 2、自動增長id;為了防止id沖突,解決辦法是一個服務器使用奇數id,另一個服務器使用偶數id,合並的時候一
同一條伺服器(centos7)配置mysql 主從同步
說明:以下的埠為3307的例項為主資料庫,3308 對應的例項為從庫 主資料庫 配置檔案 cd /home/multiMysql/ vim ./etc/3307.cnf 新增內容: server-id=3307 log-bin=master-bin log
Linux下Mysql主從複製(從庫是MariaDB)
排版不易,希望能幫助到大家 一、準備2臺伺服器 ip:120.168.0.1(主)、120.168.0.2(從) 二、配置檔案 1. Linux中的MySQL配置檔案都在/etc/my.cnf(windows中的配置檔案為mysql.ini)
mysql主從複製(單向同步)
0、環境 系統:ubuntu14.04(阿里雲\騰訊雲) 資料庫:mysql5.6 主:阿里雲ubuntu 從:騰訊雲ubuntu 預設需要同步的資料庫已經事先建立。 1、原理 我們設定一個主庫(Master),和一個從庫(S
Mysql主從同步配置方案(Centos7)
最近在做專案高可用時,需要使用資料同步。由於只有雙節點,且採用主主同步可能存在迴圈同步的風險,故綜合考慮採用Mysql主從同步(Master-Slave同步)。 可能沒有接觸過Mysql資料同步時,可能會覺得資料同步很難,但你按照如下操作一遍之後,會發現原來同步如此簡單,畢竟我們只需要會配置,會排查問
集群之mysql主從配置(windows和linux版)
p s class 本地 -h 路徑 數據庫容災 主從機 混合 二進制文件 起因 由於網站進一步開發運行的需求,要求主機7*24小時運行正常,同時要求能夠防止數據庫災難。考慮到後期的開發程度和業務量,準備向高可用系統進行改變,同時通過負載均衡提高網絡性能。於是第一步就
Mysql主從配置(超級簡單)
配置 ges ide wait mas 建立 slave end event fec 1、準備(版本和數據保持一致):主服務器 192.168.2.41(主)從服務器 192.168.2.42(從) 2、修改主服務器master: #vi my.cnf [mysqld
61.mysql主從相關(二)
mysql主從相關(二)一、mysql主主 兩臺mysql都可讀寫,互為主備,默認只使用一臺(masterA)負責數據的寫入,另一臺(masterB)備用; 二、mysql讀寫分離 首先設置主從,讀的操作會在從上執行,寫的操作在主上執行 mysql-proxy mysql官方產品。 mycat 開源的分布式
MySQL--主從數據庫同步原理
http info img 技術分享 位置 分享 ima bin-log 同時 主從數據庫的復制原理:摘自MySQL官網 1. 異步 * 主在執行sql之後,記錄二進制bin-log文件。 * 同時從連接主服務器,並從主獲取binlog,存於本地relay-l
redis學習筆記——主從同步(複製)
在Redis中,使用者可以通過執行SLAVEOF命令或者設定slaveof選項,讓一個伺服器去複製(replicate)另一個伺服器,我們稱呼被複制的伺服器為主伺服器(master),而對主伺服器進行復制的伺服器則被稱為從伺服器(slave),如圖所示。 假設現在有兩個Redis伺服器,地
Mysql主從複製(GTID),一主兩從
複製原理: Mysql中有一種日誌叫做bin日誌(二進位制日誌)。這個日誌會記錄下所有修改了資料庫的SQL語句(insert,update,delete,ALTER TABLE,grant等等)。 主從複製的原理其實就是把主伺服器上的BIN日誌複製到從伺服器上執行一遍,這樣
mysql主從複製(基於gtid)
mysql的主從複製 主伺服器將更新寫入二進位制日誌檔案,並維護檔案的一個索引以跟蹤日誌迴圈。這些日誌可以記錄傳送到從伺服器的更新.當一個從伺服器連線主伺服器時,它通知主伺服器從伺服器在日誌中讀取的最後一次成功更新的位置。從伺服器接收從那時起發生的任何更新,然後封鎖並等待主
MySQL基礎篇(庫/表的增刪改查)
上一篇我們已經在Linux系統裝好了MySQL,現在我們來熟悉一下MySQL及它的操作語句。 MySQL是一個關係型資料庫管理系統,MySQL 是最流行的關係型資料庫管理系統之一. 設計模型: E-R設計模型【E表示Entry,實體】、【R表示Relationship,關係】。