master主服務(wù)器:
在成都網(wǎng)站制作、網(wǎng)站建設(shè)過(guò)程中,需要針對(duì)客戶的行業(yè)特點(diǎn)、產(chǎn)品特性、目標(biāo)受眾和市場(chǎng)情況進(jìn)行定位分析,以確定網(wǎng)站的風(fēng)格、色彩、版式、交互等方面的設(shè)計(jì)方向。創(chuàng)新互聯(lián)建站還需要根據(jù)客戶的需求進(jìn)行功能模塊的開(kāi)發(fā)和設(shè)計(jì),包括內(nèi)容管理、前臺(tái)展示、用戶權(quán)限管理、數(shù)據(jù)統(tǒng)計(jì)和安全保護(hù)等功能。
ip:192.168.5.112
sudo vi /etc/MySQL/my.cnf
[mysqld] server-id=1 log-bin=mysql-bin #一定要把下面的一句話注銷(xiāo),否則無(wú)法遠(yuǎn)程登錄服務(wù)器 #bind-address = 127.0.0.1 #這里可以設(shè)置哪些庫(kù)需要備份,哪些不需要,我在這里沒(méi)有設(shè)置 #binlog_do_db = include_database_name #binlog_ignore_db = include_database_name
修改完成之后,運(yùn)行mysql -uroot -proot
新建查詢用戶:
mysql> CREATE USER 'repl'@'#' IDENTIFIED BY '12345678'; mysql> GRANT REPLICATION SLAVE ON *.* TO 'repl'@'#';
之后,重啟服務(wù)器,重啟之后,再次登錄mysql
mysql> show master status;
+------------------+----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+----------+--------------+------------------+-------------------+
| mysql-bin.000001 | 411 | | | |
+------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)
出現(xiàn)這個(gè),表示master已經(jīng)設(shè)置完成了,接下來(lái)設(shè)置slave
slave從服務(wù)器:
ip:192.168.5.113
sudo vi /etc/mysql/my.cnf
[mysqld] server-id=2
之后登錄mysql
mysql> CHANGE MASTER TO -> MASTER_HOST='192.168.5.112', -> MASTER_USER='repl', -> MASTER_PASSWORD='12345678', -> MASTER_LOG_FILE='mysql-bin.000001', -> MASTER_LOG_POS=411;
然后重啟服務(wù)器
之后,登錄mysql
mysql > show slave status;
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.5.112
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000002
Read_Master_Log_Pos: 1196
Relay_Log_File: mysqld-relay-bin.000004
Relay_Log_Pos: 1359
Relay_Master_Log_File: mysql-bin.000002
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: 1196
Relay_Log_Space: 1696
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: f4c24d5d-5622-11e7-89df-000c295755b8
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)
ERROR:
No query specified
紅色框部分顯示yes時(shí),表示主從已經(jīng)配置成功。之后在主服務(wù)器上的mysql新建數(shù)據(jù),在從服務(wù)器的mysql中查詢,看是否成功。
備注:
若主服務(wù)器已經(jīng)存在服務(wù)器,則將對(duì)應(yīng)的數(shù)據(jù)庫(kù)導(dǎo)出為sql文件
之后,在slave上新建主服務(wù)器的數(shù)據(jù)庫(kù),然后將主服務(wù)器上的sql文件導(dǎo)入到對(duì)應(yīng)的庫(kù)中,同步之前數(shù)據(jù)。
之后,再開(kāi)始主從復(fù)制過(guò)程。
文章題目:mysql主從熱備份
URL網(wǎng)址:http://bm7419.com/article40/jddeho.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供全網(wǎng)營(yíng)銷(xiāo)推廣、服務(wù)器托管、品牌網(wǎng)站建設(shè)、標(biāo)簽優(yōu)化、網(wǎng)站建設(shè)、外貿(mào)網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)