亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

maxscale + mariadb5.5如何實現讀寫分離

發布時間:2021-09-28 11:32:37 來源:億速云 閱讀:302 作者:柒染 欄目:MySQL數據庫

本篇文章給大家分享的是有關maxscale + mariadb5.5如何實現讀寫分離,小編覺得挺實用的,因此分享給大家學習,希望大家閱讀完這篇文章后可以有所收獲,話不多說,跟著小編一起來看看吧。

1、安裝
[root@localhost ~]# yum -y localinstall maxscale-2.3.5-1.centos.7.x86_64.rpm

2、添加訪問用戶

mysql> create user xingzhenxiang identified by '111111';
Query OK, 0 rows affected (0.04 sec)

mysql> grant all privileges on . to xingzhenxiang;

3、格式化密碼,沒有這么配置密碼的時候,好像連接有問題
maxkeys /var/lib/maxscale/
maxpasswd /var/lib/maxscale/ 111111
不同機器得到的格式串不一樣
44F2F27B48309A316C0B02046796B505 a機器
28C52C82EA2328A7853B450734B5CEB3 b輯器

chown maxscale.maxscale /var/lib/maxscale/.secrets
systemctl restart maxscale
4、編輯配置文件
[root@localhost maxscale]# cat /etc/maxscale.cnf

[maxscale]
threads=auto
log_info=1
log_warning=1
[server1]
type=server
address=192.168.204.130
port=3306
protocol=MariaDBBackend
[server2]
type=server
address=192.168.204.129
port=3306
protocol=MariaDBBackend
[MariaDB-Monitor]
type=monitor
module=mariadbmon
servers=server1,server2
user=xingzhenxiang
passwd=28C52C82EA2328A7853B450734B5CEB3
monitor_interval=2000
detect_replication_lag=true
detect_stale_master=true
[Read-Write-Service]
type=service
router=readwritesplit
servers=server1,server2
user=xingzhenxiang
passwd=28C52C82EA2328A7853B450734B5CEB3
max_slave_connections=100%
max_slave_replication_lag=5
use_sql_variables_in=all
enable_root_user=1
log_auth_warnings=1
[MaxAdmin-Service]
type=service
router=cli
[Read-Write-Listener]
type=listener
service=Read-Write-Service
#address=192.168.204.129
protocol=MariaDBClient
port=4006
[MaxAdmin-Listener]
type=listener
service=MaxAdmin-Service
protocol=maxscaled
socket=default
[root@localhost maxscale]#
5、安裝sysbench
curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.rpm.sh | sudo bash
6、壓測

[root@localhost ~]# sysbench /usr/share/sysbench/tests/include/oltp_legacy/oltp.lua --mysql-host=192.168.204.129 --mysql-port=4006 --mysql-user=xingzhenxiang --mysql-password=111111 --oltp-test-mode=complex --oltp-tables-count=10 --oltp-table-size=100000 --threads=10 --time=120 --report-interval=10 run

7、我的壓測
[root@localhost ~]# sysbench /usr/share/sysbench/tests/include/oltp_legacy/oltp.lua --mysql-host=192.168.204.129 --mysql-port=4006 --mysql-user=xingzhenxiang --mysql-password=111111 --oltp-test-mode=complex --oltp-tables-count=10 --oltp-table-size=100000 --threads=10 --time=120 --report-interval=10 run
sysbench 1.0.17 (using bundled LuaJIT 2.1.0-beta2)

Running the test with following options:
Number of threads: 10
Report intermediate results every 10 second(s)
Initializing random number generator from current time

Initializing worker threads...

Threads started!

[ 10s ] thds: 10 tps: 163.15 qps: 3281.87 (r/w/o: 2298.15/656.41/327.31) lat (ms,95%): 125.52 err/s: 0.00 reconn/s: 0.00
[ 20s ] thds: 10 tps: 139.10 qps: 2780.82 (r/w/o: 1947.42/555.20/278.20) lat (ms,95%): 193.38 err/s: 0.00 reconn/s: 0.00
[ 30s ] thds: 10 tps: 141.09 qps: 2813.63 (r/w/o: 1969.68/561.77/282.18) lat (ms,95%): 186.54 err/s: 0.00 reconn/s: 0.00
[ 40s ] thds: 10 tps: 115.85 qps: 2326.65 (r/w/o: 1627.53/467.41/231.71) lat (ms,95%): 325.98 err/s: 0.00 reconn/s: 0.00
[ 50s ] thds: 10 tps: 113.95 qps: 2268.95 (r/w/o: 1589.37/451.79/227.80) lat (ms,95%): 337.94 err/s: 0.00 reconn/s: 0.00
[ 60s ] thds: 10 tps: 115.60 qps: 2317.01 (r/w/o: 1621.81/463.90/231.30) lat (ms,95%): 235.74 err/s: 0.00 reconn/s: 0.00
[ 70s ] thds: 10 tps: 113.60 qps: 2270.16 (r/w/o: 1589.84/453.11/227.21) lat (ms,95%): 277.21 err/s: 0.00 reconn/s: 0.00
[ 80s ] thds: 10 tps: 117.40 qps: 2349.56 (r/w/o: 1644.67/470.09/234.80) lat (ms,95%): 186.54 err/s: 0.00 reconn/s: 0.00
[ 90s ] thds: 10 tps: 119.30 qps: 2385.28 (r/w/o: 1669.66/477.02/238.61) lat (ms,95%): 262.64 err/s: 0.00 reconn/s: 0.00
[ 100s ] thds: 10 tps: 115.29 qps: 2305.23 (r/w/o: 1613.78/460.87/230.58) lat (ms,95%): 193.38 err/s: 0.00 reconn/s: 0.00
[ 110s ] thds: 10 tps: 109.61 qps: 2190.48 (r/w/o: 1533.02/438.24/219.22) lat (ms,95%): 277.21 err/s: 0.00 reconn/s: 0.00
[ 120s ] thds: 10 tps: 111.70 qps: 2242.33 (r/w/o: 1568.15/450.79/223.39) lat (ms,95%): 272.27 err/s: 0.00 reconn/s: 0.00
SQL statistics:
queries performed:
read:                            206738
write:                           59068
other:                           29534
total:                           295340
transactions:                        14767  (122.93 per sec.)
queries:                             295340 (2458.60 per sec.)
ignored errors:                      0      (0.00 per sec.)
reconnects:                          0      (0.00 per sec.)

General statistics:
total time:                          120.1241s
total number of events:              14767

Latency (ms):
min:                                   14.39
avg:                                   81.34
max:                                 1064.40
95th percentile:                      227.40
sum:                              1201151.18

Threads fairness:
events (avg/stddev):           1476.7000/7.23
execution time (avg/stddev):   120.1151/0.00

8、主從狀態,內部機制自動識別主從,并不是以server1為主
MaxScale> list servers
Servers.
-------------------+-----------------+-------+-------------+--------------------
Server             | Address         | Port  | Connections | Status              
-------------------+-----------------+-------+-------------+--------------------
server1            | 192.168.204.130 |  3306 |           0 | Master, Running
server2            | 192.168.204.129 |  3306 |           0 | Slave, Running
-------------------+-----------------+-------+-------------+--------------------
MaxScale>

MaxScale> list servers
Servers.
-------------------+-----------------+-------+-------------+--------------------
Server             | Address         | Port  | Connections | Status              
-------------------+-----------------+-------+-------------+--------------------
server1            | 192.168.204.129 |  3306 |           0 | Slave, Running
server2            | 192.168.204.130 |  3306 |           0 | Master, Running
-------------------+-----------------+-------+-------------+--------------------
MaxScale>

以上就是maxscale + mariadb5.5如何實現讀寫分離,小編相信有部分知識點可能是我們日常工作會見到或用到的。希望你能通過這篇文章學到更多知識。更多詳情敬請關注億速云行業資訊頻道。

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

突泉县| 潼南县| 平昌县| 滨州市| 麻江县| 富平县| 大姚县| 安岳县| 蕉岭县| 宁国市| 济南市| 石首市| 定陶县| 旬阳县| 永吉县| 邛崃市| 南投市| 巴彦淖尔市| 叙永县| 南郑县| 玉树县| 于田县| 夏河县| 榆树市| 崇礼县| 精河县| 河池市| 南澳县| 武汉市| 沅江市| 麻江县| 渑池县| 武强县| 桓仁| 上林县| 兰考县| 湖州市| 南宫市| 镇沅| 潮安县| 巍山|