MariaDB单机双实例主从复制
MariaDB单机双实例主从复制,MariaDB其实和MySQL一样,非有啥不一样那就是名字不一样。
MariaDB单机双实例主从复制
MariaDB其实和MySQL一样,非有啥不一样那就是名字不一样。
开始~上篇实验是MariaDB的单机多实例安装
双实例端口3307主库,,3308从库
3307主实例的mysqld配置
[mysqld2]
port=3307
socket=/tmp/mysql3307.sock
pid-file=/tmp/mysql3307.pid
max_allowed_packet=1M
net_buffer_length=2k
table_open_cache=4
sort_buffer_size=64k
thread_stack=128k
basedir=/usr/local/mysql
datadir=/data/mydata2
server-id=244
log-bin = master3307-bin
log-bin-index = master3307-bin.index
thread_concurrency=4
innodb_file_per_table = 1
#mysql_pwd='teleframe'
3308从实例的mysqld配置
[mysqld3]
port=3308
socket=/tmp/mysql3308.sock
pid-file=/tmp/mysql3308.pid
max_allowed_packet=1M
net_buffer_length=2k
table_open_cache=4
sort_buffer_size=64k
thread_stack=128k
basedir=/usr/local/mysql
datadir=/data/mydata3
innodb_file_per_table = 1
server-id=245
log-bin=mysql3308-bin
relay-log = relay-log
relay-log-index = relay-log-index
thread_concurrency=4
read-only = on
开始主从配置
步骤1、连接到主库上授权一个REPLICATION SLAVE 帐号,并且刷新授权表
[root@e3 mysql]# mysql -uroot -h127.0.0.1 -P3307 -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.0.15-MariaDB-log Source distribution
Copyright (c) 2000, 2014, Oracle, SkySQL Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
| test1 |
+--------------------+
5 rows in set (0.00 sec)
MariaDB [(none)]> grant replication slave on *.* to 'repl'@'192.168.0.%' identified by 'repl';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> show master status;
+-----------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+-----------------------+----------+--------------+------------------+
| master3307-bin.000005 | 632 | | |
+-----------------------+----------+--------------+------------------+
1 row in set (0.00 sec)
MariaDB [(none)]>
2、连接到从库上指定主库,启动slave
[root@e3 ~]# mysql -uroot -p'teleframe' -h127.0.0.1 -P3308
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.0.15-MariaDB-log Source distribution
Copyright (c) 2000, 2014, Oracle, SkySQL Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> change master to master_host='192.168.0.244',master_user='repl',master_password='repl',master_port=3307,master_log_file='master3307-bin.000005',master_log_pos=632;
ERROR 1201 (HY000): Could not initialize master info structure for ''; more error messages can be found in the MariaDB error log #我这报错了,如果你跟我一样报错就执行下面的命令
MariaDB [(none)]> reset slave;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> change master to master_host='192.168.0.244',master_user='repl',master_password='repl',master_port=3307,;
Query OK, 0 rows affected (0.22 sec) #好了现在连接上了 master_log_file='master3307-bin.000005',master_log_pos=632 表示从主服务器那个二进制日志文件开始复制因为这是复制授权信息,所以没必要复制,在主服务器上可以查看show master status; 查看内容show binglog events in 'master-bin.000001';
MariaDB [(none)]> show slave status\G
*************************** 1. row ***************************
Slave_IO_State:
Master_Host: 192.168.0.244
Master_User: repl
Master_Port: 3307
Connect_Retry: 60
Master_Log_File: master3307-bin.000005
Read_Master_Log_Pos: 632
Relay_Log_File: relay-log.000002
Relay_Log_Pos: 4
Relay_Master_Log_File: master3307-bin.000005
Slave_IO_Running: No # 从服务器有没有正常工作主要是看这个值是否YES
Slave_SQL_Running: No #
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: 632
Relay_Log_Space: 248
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: NULL
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: 0
Master_SSL_Crl:
Master_SSL_Crlpath:
Using_Gtid: No
Gtid_IO_Pos:
1 row in set (0.00 sec)
MariaDB [(none)]> start slave; #好启动slave
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.0.244
Master_User: repl
Master_Port: 3307
Connect_Retry: 60
Master_Log_File: master3307-bin.000005
Read_Master_Log_Pos: 632
Relay_Log_File: relay-log.000003
Relay_Log_Pos: 540
Relay_Master_Log_File: master3307-bin.000005
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: 632
Relay_Log_Space: 831
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: 244
Master_SSL_Crl:
Master_SSL_Crlpath:
Using_Gtid: No
Gtid_IO_Pos:
来测试!
在主的上面创建一个库看从的是否可以复制到
主上创建

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

熱門話題

質因數 - 在數論中,正整數的質因數是精確整除該整數的質因數。找出這些數字的過程稱為整數分解或質因數分解。例 - 288 的質因數是:288=2x2x2x2x2

2025年全球數字虛擬幣交易平台競爭激烈,本文根據交易量、安全性、用戶體驗等指標,權威發布2025年全球十大數字虛擬幣交易平台排行榜。 OKX憑藉強大的技術實力和全球化運營策略居首,Binance以高流動性和低費用緊隨其後。 Gate.io、Coinbase、Kraken等平台憑藉各自優勢穩居前列。榜單涵蓋Huobi、KuCoin、Bitfinex、Crypto.com和Gemini等交易平台,各有特色,但投資需謹慎。選擇平台需考慮安全性、流動性、費用、用戶體驗、幣種選擇及監管合規性等因素,理性投資

虛擬貨幣十大交易平台排行榜(2025年最新): 幣安:全球龍頭,高流動性,監管受關注。 OKX:龐大用戶基數,支持多種幣種,提供槓桿交易。 Gate.io:資深交易所,多種法幣支付方式,提供多種交易對和投資產品。 Bitget:衍生品交易所,高流動性,低費用。 火幣:老牌交易所,支持多種幣種和交易對。 Coinbase:美國知名交易所,受監管嚴格。 Phemex等等。

十大數字貨幣交易平台:1. OKX,2. Binance,3. Gate.io,4. Huobi Global,5. Kraken,6. Coinbase,7. KuCoin,8. Bitfinex,9. Crypto.com,10. Gemini,這些交易所各具特色,用戶可根據安全性、費用、幣種選擇、用戶界面和客戶支持等因素選擇適合自己的平台。

本文推薦十個數字貨幣交易App:1. OKX;2. Binance;3. Gate.io;4. Huobi Global;5. Kraken;6. Coinbase;7. KuCoin;8. Crypto.com;9. Bitfinex;10. Poloniex。選擇平台需考慮安全性、流動性、交易費用、幣種選擇、用戶界面、客服支持及法規合規性等因素,謹慎評估風險,切勿盲目跟風。

本文提供Binance、OKX、Gate.io、Huobi Global(火幣)、Coinbase、KuCoin(庫幣)、Kraken和Bitfinex等主流數字貨幣交易平台的安卓和蘋果手機APP下載方法。無論是安卓用戶還是蘋果用戶,都能輕鬆找到對應平台的官方APP下載鏈接,並按照步驟完成安裝。 文章詳細指導了在各自官網或應用商店搜索下載,並針對安卓系統安裝APK文件的特殊步驟做了說明,方便用戶快速便捷地下載使用。

靠譜的數字貨幣平台包括:1. OKX,2. Binance,3. Gate.io,4. Huobi Global,5. Kraken,6. Coinbase,7. KuCoin,8. Bitfinex,9. Crypto.com,10. Gemini,這些交易所各具特色,用戶可根據安全性、費用、幣種選擇、用戶界面和客戶支持等因素選擇適合自己的平台。

十大虛擬幣交易平台排名依次為:1. OKX;2. Binance;3. Gate.io;4. Huobi Global;5. Kraken;6. Coinbase;7. KuCoin;8. Crypto.com;9. Bitfinex;10. Gemini。 排名基於平台流動性、幣種選擇、安全性、用戶體驗、手續費及合規性等因素綜合考量,但僅供參考,投資需謹慎,風險自擔。
