当前位置:首页 » 安全设置 » 如何设置自动同步网络
扩展阅读
计算机网络是信息传输 2024-11-24 19:22:43
手机网络信号自动加速器 2024-11-24 19:16:58

如何设置自动同步网络

发布时间: 2024-10-07 08:56:43

㈠ 鐢佃剳缃戠粶钖屾ュ备綍璁剧疆

銆涓銆佸嗳澶囨湇锷″櫒

銆銆鐢变簬MySQL涓嶅悓鐗堟湰涔嬮棿镄(浜岃繘鍒舵棩蹇)binlog镙煎纺鍙鑳戒细涓崭竴镙凤纴锲犳ゆ渶濂界殑鎼閰岖粍钖堟槸Master镄凪ySQL鐗堟湰鍜孲lave镄勭増链鐩稿悓鎴栬呮洿浣庯纴Master镄勭増链镶瀹氢笉鑳介珮浜岙lave鐗堟湰銆

銆銆链鏂囦腑锛屾垜浠锅囱句富链嶅姟鍣(浠ヤ笅绠绉癕aster)鍜屼粠链嶅姟鍣(浠ヤ笅绠绉癝lave)镄勭増链閮芥槸5.0.15锛屾搷浣灭郴缁熸槸Linux Ubuntu 5.0.x銆

銆銆锅囱惧悓姝Master镄勪富链哄悕涓猴细rep1锛孲lave涓绘満钖崭负锛歳ep2锛2涓狭ySQL镄刡asedir鐩褰曢兘鏄/usr/local/mysql锛宒atadir閮芥槸锛/usr/local/MySQL/data銆

銆銆浜屻佽剧疆钖屾ユ湇锷″櫒

銆銆1銆佽剧疆钖屾Master

銆銆姣忎釜钖屾ユ湇锷″櫒閮藉繀椤昏惧畾涓涓鍞涓镄勭紪鍙凤纴钖﹀垯钖屾ュ氨涓嶈兘姝e父杩愯屼简銆傛帴涓嬫潵寮濮嬩慨鏀 my.cnf锛屽炲姞浠ヤ笅鍑犺岋细

銆銆server-id = 1

銆銆log-bin

銆銆set-variable=binlog-ignore-db=MySQL

銆銆铹跺悗鍦∕aster涓婂炲姞涓涓璐﹀彿涓挞棬鐢ㄤ簬钖屾ワ纴濡备笅锛

銆銆MySQL>GRANT REPLICATION SLAVE ON *.* TO rep@rep2 IDENTIFIED BY 'rep';

銆銆濡傛灉𨱍宠佸湪Slave涓婃湁𨱒冮檺镓ц "LOAD TABLE FROM MASTER" 鎴 "LOAD DATA FROM MASTER" 璇鍙ョ殑璇濓纴蹇呴’鎺堜篑鍏ㄥ眬镄 FILE 鍜 SELECT 𨱒冮檺锛

銆銆MySQL>GRANT FILE,SELECT,REPLICATION SLAVE ON *.* TO rep@rep2 IDENTIFIED BY 'rep';

銆銆绗涓夎岃〃绀轰笉璁板綍鏁版嵁搴揗ySQL镄勬洿鏂版棩蹇楋纴杩椤氨阆垮厤浜哅aster涓婄殑𨱒冮檺璁剧疆绛夎钖屾ュ埌Slave涓婏纴濡傛灉瀵硅繖鏂归溃娌℃湁闄愬埗锛屽氨鍙浠ヤ笉璁剧疆杩欎釜鍙傛暟銆

銆銆鎺ヤ笅𨱒ュ囦唤Master涓婄殑鏁版嵁锛岄栧厛镓ц屽备笅SQL璇鍙ワ细

銆銆MySQL>FLUSH TABLES WITH READ LOCK;

銆銆涓嶈侀鍑鸿繖涓缁堢锛屽惁鍒栾繖涓阌佸氨涓岖敓鏁堜简锛涙帴镌瀵煎嚭鏁版嵁锛屽彲浠ョ洿鎺ユ墦鍖呭帇缂╂暟鎹鏂囦欢锛屼篃鍙浠ヤ娇鐢∕ySQLmp宸ュ叿𨱒ュ仛锛屾帹钻愬墠钥呯殑鏂规硶锛岃繖镙锋洿涓哄揩鎹风亩渚裤

銆銆root$cd /usr/local/MySQL

銆銆root$tar zcf data.tar.gz ./data (鍦ㄨ繖閲屼篃鍙鑳芥槸 "var" 绛夊叾瀹冨疄闄呭瓨鏀炬暟鎹鏂囦欢镄勭洰褰曪纴镙规嵁瀹炴儏钥屽畾)

銆銆铹跺悗灏呜繖浜涙暟鎹𨰾疯礉鍒癝lave链嶅姟鍣ㄤ笂锛岃В寮锛岃剧疆濂芥g‘镄勬潈闄愬强灞炰富绛夛绂涔嫔悗锛屾墽琛 "UNLOCK TABLES" 璇鍙ユ潵閲婃斁阌併

銆銆2銆佽剧疆Slave

銆銆淇鏀筸y.cnf锛屽炲姞濡备笅鍑犺岋细

銆銆server-id = 2

銆銆master-host = rep1 #涓绘湇锷″櫒钖

銆銆master-user = rep #钖屾ヨ处鎴峰悕锛岄粯璁ゆ槸test

銆銆master-password = rep #钖屾ュ笎鎴峰瘑镰侊纴榛樿ゆ槸绌

銆銆master-port = 3306 #涓绘湇锷″櫒镄 TCP/IP 绔鍙e彿锛岄粯璁ゆ槸3306

銆銆set-variable=replicate-ignore-db=MySQL #鐣ヨ繃钖屾ョ殑鏁版嵁搴揿悕锛屽傛灉链夊氢釜锛岃疯剧疆澶氭

銆銆set-variable=replicate-do-db=yejr #𨱍宠佸悓姝ョ殑鏁版嵁搴揿悕锛屽傛灉链夊氢釜锛岃疯剧疆澶氭

銆銆鎺ヤ笅𨱒ュ湪Slave涓婃楠屼竴涓嬫槸钖﹁兘姝g‘杩炴帴鍒癕aster涓婏纴骞朵笖鍏峰囩浉搴旂殑𨱒冮檺銆

銆銆root$MySQL -hrep1 -urep -prep

銆銆MySQL>SHOW GRANTS;

銆銆+------------------------------------------------- --------------------------------------------------- ----------------------------------+

銆銆 Grants for rep@rep2

銆銆+------------------------------------------------- --------------------------------------------------- ----------------------------------+

銆銆 GRANT SELECT, FILE, REPLICATION SLAVE ON *.* TO 'rep'@'rep2' IDENTIFIED BY PASSWORD '*'

銆銆+------------------------------------------------- --------------------------------------------------- ----------------------------------+

銆銆鐜板湪锛屽彲浠ュ惎锷⊿lave浜嗐傚惎锷ㄦ垚锷熷悗锛岀橱褰昐lave锛屾煡鐪嬩竴涓嫔悓姝ョ姸镐侊细

銆銆MySQL -hlocalhost -uroot

銆銆MySQL>SHOW SLAVE STATUS\G

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

銆銆Slave_IO_State: Waiting for master to send event

銆銆Master_Host: rep1

銆銆Master_User: rep

銆銆Master_Port: 3306

銆銆Connect_Retry: 60

銆銆Master_Log_File: binlog.000001

銆銆Read_Master_Log_Pos: 98

銆銆Relay_Log_File: relay.000003

銆銆Relay_Log_Pos: 232

銆銆Relay_Master_Log_File: binlog.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: 98 Relay_Log_Space: 232 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 1 row in set (0.00 sec) 鍙浠ョ湅鍒帮纴Slave_IO_Running 鍜 Slave_SQL_Running 涓ゅ垪镄勫奸兘涓 "Yes"锛岃繖琛ㄦ槑 Slave 镄 I/O 鍜 SQL 绾跨▼閮藉湪姝e父杩愯屻

銆銆镊虫わ纴钖屾ヨ惧畾鎴愬姛銆
璋㈣阿鍙傝

怎么设置电脑时间自动同步网络时间

点开电脑右下角的时间,里面有个Internet时间,里面有个自动同步,前面小方框勾选,确定即可