下文主要給大家?guī)硎褂肐nnoDB Cluster解決MySQL數(shù)據(jù)庫高可用方案,希望這些內(nèi)容能夠帶給大家實際用處,這也是我編輯使用InnoDB Cluster解決MySQL數(shù)據(jù)庫高可用方案這篇文章的主要目的。好了,廢話不多說,大家直接看下文吧。
創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價比瑤海網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式瑤海網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋瑤海地區(qū)。費用合理售后完善,十多年實體公司更值得信賴。MySQL InnoDB Cluster為MySQL提供了一個完整的高可用解決方案。MySQL Shell包含AdminAPI,能夠輕松地配置和管理至少三個MySQL云服務(wù)器實例組,以作為InnoDB集群。每個MySQL云服務(wù)器實例都運行MySQL Group Replication,它提供了在innodb集群中復(fù)制數(shù)據(jù)的機制,并內(nèi)置故障轉(zhuǎn)移。MySQL Router可以根據(jù)您部署的集群自動配置自己,將客戶端應(yīng)用程序透明地連接到云服務(wù)器實例。如果云服務(wù)器實例發(fā)生意外故障,群集將自動重新配置。在默認(rèn)的單主模式下,InnoDB集群有一個讀寫云服務(wù)器實例——主云服務(wù)器。多個輔助云服務(wù)器實例是主云服務(wù)器的副本。如果主云服務(wù)器出現(xiàn)故障,輔助云服務(wù)器將自動提升為主云服務(wù)器的角色。MySQL Router檢測到這一點,并將客戶端應(yīng)用程序轉(zhuǎn)發(fā)到新的主云服務(wù)器。
[root@wallet01 ~]# mysql -uroot -p Enter password: mysql> grant all privileges on *.* to 'root'@'wallet01' identified by 'abcd@1234'; Query OK, 0 rows affected, 1 warning (0.05 sec) mysql> flush privileges; Query OK, 0 rows affected (0.06 sec) [root@wallet01 ~]# yum install -y mysql-shell [root@wallet01 ~]# mysqlsh --log-level=DEBUG3 MySQL Shell 8.0.18 Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type '\help' or '\?' for help; '\quit' to exit. MySQL JS > shell.connect('root@wallet01:3306') Creating a session to 'root@wallet01:3306' Please provide the password for 'root@wallet01:3306': ********* Save password for 'root@wallet01:3306'? [Y]es/[N]o/Ne[v]er (default No): y Fetching schema names for autocompletion... Press ^C to stop. Your MySQL connection id is 290 Server version: 5.7.27-log MySQL Community Server (GPL) No default schema selected; type \use <schema> to set one. <ClassicSession:root@wallet01:3306> MySQL wallet01:3306 JS > var cluster = dba.createCluster('walletCluster', {adoptFromGR: true}) A new InnoDB cluster will be created based on the existing replication group on instance 'wallet01:3306'. Creating InnoDB cluster 'walletCluster' on 'wallet01:3306'... Adding Seed Instance... Adding Instance 'wallet03:3306'... Adding Instance 'wallet01:3306'... Adding Instance 'wallet02:3306'... Resetting distributed recovery credentials across the cluster... Cluster successfully created based on existing replication group. MySQL wallet01:3306 JS > cluster.status(); { "clusterName": "walletCluster", "defaultReplicaSet": { "name": "default", "primary": "wallet01:3306", "ssl": "DISABLED", "status": "OK", "statusText": "Cluster is ONLINE and can tolerate up to ONE failure.", "topology": { "wallet01:3306": { "address": "wallet01:3306", "mode": "R/W", "readReplicas": {}, "role": "HA", "status": "ONLINE" }, "wallet02:3306": { "address": "wallet02:3306", "mode": "R/O", "readReplicas": {}, "role": "HA", "status": "ONLINE" }, "wallet03:3306": { "address": "wallet03:3306", "mode": "R/O", "readReplicas": {}, "role": "HA", "status": "ONLINE" } }, "topologyMode": "Single-Primary" }, "groupInformationSourceMember": "wallet01:3306" } MySQL wallet01:3306 JS > \quit Bye![root@wallet01 ~]# yum install -y mysql-router [root@wallet01 ~]# mysqlrouter --bootstrap root@wallet01:3306 --user=mysqlrouter --name=router01 Please enter MySQL password for root: WARNING: The MySQL server does not have SSL configured and metadata used by the router may be transmitted unencrypted. # Reconfiguring system MySQL Router instance... - Checking for old Router accounts - No prior Router accounts found - Creating mysql account 'mysql_router1_a8933v9tcn8v'@'%' for cluster management - Storing account in keyring - Adjusting permissions of generated files - Creating configuration /etc/mysqlrouter/mysqlrouter.conf # MySQL Router 'router01' configured for the InnoDB cluster 'walletCluster' After this MySQL Router has been started with the generated configuration $ /etc/init.d/mysqlrouter restart or $ mysqlrouter -c /etc/mysqlrouter/mysqlrouter.conf the cluster 'walletCluster' can be reached by connecting to: ## MySQL Classic protocol - Read/Write Connections: localhost:6446 - Read/Only Connections: localhost:6447 ## MySQL X protocol - Read/Write Connections: localhost:64460 - Read/Only Connections: localhost:64470 Existing configuration backed up to '/etc/mysqlrouter/mysqlrouter.conf.bak' [root@wallet01 ~]# /etc/init.d/mysqlrouter start Starting mysqlrouter: [ OK ] [root@wallet01 ~]# /etc/init.d/mysqlrouter status mysqlrouter (pid 24451) is running... [root@wallet02 ~]# yum install -y mysql-router [root@wallet02 ~]# mysqlrouter --bootstrap root@wallet01:3306 --user=mysqlrouter --name=router02 [root@wallet02 ~]# /etc/init.d/mysqlrouter start Starting mysqlrouter: [ OK ] [root@wallet02 ~]# /etc/init.d/mysqlrouter status mysqlrouter (pid 6906) is running... [root@wallet03 ~]# yum install -y mysql-router [root@wallet03 ~]# mysqlrouter --bootstrap root@wallet01:3306 --user=mysqlrouter --name=router03 [root@wallet03 ~]# /etc/init.d/mysqlrouter start Starting mysqlrouter: [ OK ] [root@wallet03 ~]# /etc/init.d/mysqlrouter status mysqlrouter (pid 18081) is running...對于以上關(guān)于使用InnoDB Cluster解決MySQL數(shù)據(jù)庫高可用方案,大家是不是覺得非常有幫助。如果需要了解更多內(nèi)容,請繼續(xù)關(guān)注我們的行業(yè)資訊,相信你會喜歡上這些內(nèi)容的。
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機、免備案服務(wù)器”等云主機租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。
網(wǎng)頁標(biāo)題:使用InnoDBCluster解決MySQL數(shù)據(jù)庫高可用方案-創(chuàng)新互聯(lián)
文章地址:http://jinyejixie.com/article10/peogo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站排名、營銷型網(wǎng)站建設(shè)、面包屑導(dǎo)航、網(wǎng)站改版、網(wǎng)站設(shè)計、品牌網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)