欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

MySQL?InnoDB?Cluster搭建安裝教程

 更新時間:2024年01月26日 09:59:28   作者:瀟湘隱者  
這篇文章主要介紹了MySQL?InnoDB?Cluster搭建安裝教程,本文給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友參考下吧

環(huán)境介紹:

這里的MySQL Innodb Cluster搭建環(huán)境如下所示,總共有三臺機(jī)器搭建MySQL InnoDB Cluster:

操作系統(tǒng): Red Hat Enterprise Linux release 8.8 (Ootpa)

數(shù)據(jù)庫版本:8.0.35 MySQL Community Server - GPL

第一步:環(huán)境檢查與配置

1:防火墻配置

測試環(huán)境可以關(guān)閉防火墻,生產(chǎn)環(huán)境一般會開啟防火墻。在防火墻上設(shè)置相關(guān)IP和端口。根據(jù)實際情況進(jìn)行設(shè)置(需要root權(quán)限,一般由系統(tǒng)管理員設(shè)置)

關(guān)于如何設(shè)置防火墻限定IP地址,這里不做過多介紹,其實配置也很簡單。端口號根據(jù)實際情況配置。

# systemctl status  firewalld.service
# systemctl stop  firewalld.service
# systemctl status  firewalld.service
# systemctl disable  firewalld.service

2:關(guān)閉或配置SELinux

檢查是否關(guān)閉selinux

# /usr/sbin/sestatus
SELinux status:                 disabled

修改SELinux配置文件

如果沒有關(guān)閉selinux的話,我們建議關(guān)閉selinux,可以通過修改selinux的配置文件,將SELINUX=enforcing改為SELINUX=disabled。

#vi /etc/selinux/config 
SELINUX=disabled

如果不想重啟,如果想驗證一下,可以重啟一下服務(wù)器。

setenforce 0
getenforce

如果公司要求開啟SELinux的話, 必須設(shè)置SELinux 策略,在SELinux 下允許MySQL連接

sudo setsebool -P mysql_connect_any 1

3:配置IP與主機(jī)名映射

編輯/etc/hosts

#MySQL InnoDB Cluster
192.168.9.200  mysqlu01
192.168.9.201  mysqlu02
192.168.9.202  mysqlu03

[注意]:三臺MySQL服務(wù)器都必須設(shè)置,不能只設(shè)置一臺服務(wù)器。請注意,不要遺漏。

4:修改內(nèi)核參數(shù)

/etc/security/limits.conf
mysql        hard    nofile          65536
mysql        soft    nofile          65536
或者
*            hard    nofile          65536
*            soft    nofile          65536

5:配置標(biāo)準(zhǔn)大頁???????

grep -i huge /proc/meminfo

建議開啟標(biāo)準(zhǔn)大頁,這樣更有利于性能。

6:禁用透明大頁

第二步:安裝MySQL實例

1:安裝MySQL實例

使用mysql_auto_install.sh腳本自動安裝MySQL單實例,如果常規(guī)的安裝MySQL實例,參考文檔“MySQL 8.0的二進(jìn)制安裝文檔.docx” ,三臺(多臺)服務(wù)器上安裝MySQL實例

$ cd /data/soft
$ sh mysql_auto_install.sh

2:修改參數(shù)文件中MGR參數(shù)配置

修改server_id=xxxx #規(guī)則,取IP地址的最后一位,然后在my.cnf中添加下面配置

##########################################################################################################################
#                                           GTID SETTING
##########################################################################################################################
plugin_dir=/opt/mysql/mysql8.0/lib/plugin  #設(shè)置plugin的路徑
enforce_gtid_consistency = ON                #強(qiáng)制GTID的一致性
gtid-mode=ON                                     #開啟GTID,必須開啟
master-info-repository=TABLE
relay-log-info-repository=TABLE            #記錄同步的信息,便于管理和恢復(fù)
log-slave-updates = ON                     #需要記錄事務(wù)的binlog,用作以后的恢復(fù)用,哪怕不是寫入點(diǎn),也需要
binlog-checksum=NONE                       #MGR本身不支持binlog的checksum校驗
slave-parallel-workers=8                   #GTID的SQL線程
slave_preserve_commit_order=ON             #GTID配置,SQL線程按照順序重放事物
#slave-parallel-type=LOGICAL_CLOCK       #SQL線程工作模式。有兩種。
disabled_storage_engines="MyISAM,BLACKHOLE,FEDERATED,ARCHIVE,MEMORY"
##########################################################################################################################
##########################################################################################################################
#                                           組復(fù)制設(shè)置
##########################################################################################################################
#記錄事務(wù)的算法,官網(wǎng)建議設(shè)置該參數(shù)使用 XXHASH64 算法
transaction_write_set_extraction = XXHASH64
plugin_load_add='group_replication.so'
#是否隨服務(wù)器啟動而自動啟動組復(fù)制,不建議直接啟動,怕故障恢復(fù)時有擾亂數(shù)據(jù)準(zhǔn)確性的特殊情況
#loose-group_replication_start_on_boot = OFF
group_replication_start_on_boot = OFF
#開啟引導(dǎo)模式,添加組成員,用于第一次搭建MGR或重建MGR的時候使用,只需要在集群內(nèi)的其中一臺開啟,
#loose-group_replication_bootstrap_group = OFF
group_replication_bootstrap_group = OFF
#IP地址白名單,默認(rèn)只添加127.0.0.1,不會允許來自外部主機(jī)的連接,按需安全設(shè)置
#loose-group_replication_ip_whitelist = '127.0.0.1/8,192.168.9.0/24'
group_replication_ip_allowlist = '127.0.0.1/8,192.168.9.0/24'
#是否啟動單主模式,如果啟動,則本實例是主庫,提供讀寫,其他實例僅提供讀,如果為off就是多主模式了
loose-group_replication_single_primary_mode = ON
##ssl for mgr
group_replication_ssl_mode         = REQUIRED
group_replication_recovery_use_ssl = ON
binlog_transaction_dependency_tracking=WRITESET
##########################################################################################################################

注意,這里使用mysql shell創(chuàng)建InnoDB Cluster時,不需要在參數(shù)文件中設(shè)置group_replication_group_name等參數(shù),有些版本的參數(shù)也有所出入,請以實際情況為準(zhǔn)。

修改后重啟每一臺MySQL服務(wù)。

$ sudo systemctl stop mysqld.service
$ sudo systemctl start mysqld.service
$ sudo systemctl status mysqld.service

安裝MySQL Shell??????

# yum localinstall mysql-shell-8.0.35-1.el8.x86_64.rpm

這里使用root用戶安裝。因為mysql用戶沒有權(quán)限安裝??梢灾话惭b一臺MySQL服務(wù)器,也可以三臺都安裝。

創(chuàng)建數(shù)據(jù)庫用戶

##手動創(chuàng)建需要設(shè)置log bin 為0,創(chuàng)建完成后設(shè)置回1,所有服務(wù)器執(zhí)行

SET SQL_LOG_BIN=0;
CREATE USER icadmin@'192.168.9.%' IDENTIFIED BY '******';
GRANT ALL ON *.* TO icadmin@'192.168.9.%' WITH GRANT OPTION;
SET SQL_LOG_BIN=1;

注意:所有MySQL節(jié)點(diǎn)需要執(zhí)行創(chuàng)建用戶操作,此用戶臨時使用,配置完集群后刪除。

mysqlsh
\cicadmin@192.168.9.200:7306

mysqlsh-h192.168.9.200-P7306-uicadmin-p

檢查實例是否符合InnoDB Cluster的參數(shù)及權(quán)限配置要求

dba.checkInstanceConfiguration('icadmin@192.168.9.200:7306')
dba.checkInstanceConfiguration('icadmin@192.168.9.201:7306')
dba.checkInstanceConfiguration('icadmin@192.168.9.202:7306')

檢查符合InnoDB Cluster的參數(shù)、權(quán)限配置符合要求的話,則會返回status為OK,否則會提示不符合要求信息。

MySQL192.168.9.200:7306sslJS>dba.checkInstanceConfiguration('icadmin@192.168.9.201:7306')
Pleaseprovidethepasswordfor'icadmin@192.168.9.201:7306':****************
Savepasswordfor'icadmin@192.168.9.201:7306'?[Y]es/[N]o/Ne[v]er(defaultNo):yes
ValidatingMySQLinstanceatmysqlu02:7306foruseinanInnoDBcluster...
Thisinstancereportsitsownaddressasmysqlu02:7306
Clientsandotherclustermemberswillcommunicatewithitthroughthisaddressbydefault.Ifthisisnotcorrect,thereport_hostMySQLsystemvariableshouldbechanged.
CheckingwhetherexistingtablescomplywithGroupReplicationrequirements...
Noincompatibletablesdetected
Checkinginstanceconfiguration...
InstanceconfigurationiscompatiblewithInnoDBcluster
Theinstance'mysqlu02:7306'isvalidtobeusedinanInnoDBcluster.
{
"status":"ok"
}
MySQL192.168.9.200:7306sslJS>

如果MySQL的參數(shù)不符合要求,則上面輸出信息"status"不為"ok",則必須修改相關(guān)參數(shù)參數(shù),重新檢測。

初始化InnoDB Cluster相關(guān)配置

dba.configureInstance('icadmin@192.168.9.200:7306',{clusterAdmin:"'icadmin'@'192.168.9.%'"});
dba.configureInstance('icadmin@192.168.9.201:7306',{clusterAdmin:"'icadmin'@'192.168.9.%'"});
dba.configureInstance('icadmin@192.168.9.202:7306',{clusterAdmin:"'icadmin'@'192.168.9.%'"});

或者

dba.configureInstance('root@192.168.9.200:7306',{clusterAdmin:"'icadmin'@'192.168.9.%'"},clusterAdminPassword:"*****"});
dba.configureInstance('root@192.168.9.201:7306',{clusterAdmin:"'icadmin'@'192.168.9.%'"},clusterAdminPassword:"*****"});
dba.configureInstance('root@192.168.9.202:7306',{clusterAdmin:"'icadmin'@'192.168.9.%'"},clusterAdminPassword:"*****"});

具體執(zhí)行過程如下所示:

MySQL192.168.9.200:7306sslJS>dba.configureInstance('icadmin@192.168.9.200:7306',{clusterAdmin:"'icadmin'@'192.168.9.%'"});
ConfiguringlocalMySQLinstancelisteningatport7306foruseinanInnoDBcluster...
Thisinstancereportsitsownaddressasmysqlu01:7306
Clientsandotherclustermemberswillcommunicatewithitthroughthisaddressbydefault.Ifthisisnotcorrect,thereport_hostMySQLsystemvariableshouldbechanged.
User'icadmin'@'192.168.9.%'alreadyexistsandwillnotbecreated.
applierWorkerThreadswillbesettothedefaultvalueof4.
Theinstance'mysqlu01:7306'isvalidtobeusedinanInnoDBcluster.
Theinstance'mysqlu01:7306'isalreadyreadytobeusedinanInnoDBcluster.
Successfullyenabledparallelappliers.
MySQL192.168.9.200:7306sslJS>dba.configureInstance('icadmin@192.168.9.201:7306',{clusterAdmin:"'icadmin'@'192.168.9.%'"});
ConfiguringMySQLinstanceatmysqlu02:7306foruseinanInnoDBcluster...
Thisinstancereportsitsownaddressasmysqlu02:7306
Clientsandotherclustermemberswillcommunicatewithitthroughthisaddressbydefault.Ifthisisnotcorrect,thereport_hostMySQLsystemvariableshouldbechanged.
User'icadmin'@'192.168.9.%'alreadyexistsandwillnotbecreated.
applierWorkerThreadswillbesettothedefaultvalueof4.
Theinstance'mysqlu02:7306'isvalidtobeusedinanInnoDBcluster.
Theinstance'mysqlu02:7306'isalreadyreadytobeusedinanInnoDBcluster.
Successfullyenabledparallelappliers.
MySQL192.168.9.200:7306sslJS>dba.configureInstance('icadmin@192.168.9.202:7306',{clusterAdmin:"'icadmin'@'192.168.9.%'"});
ConfiguringMySQLinstanceatmysqlu03:7306foruseinanInnoDBcluster...
Thisinstancereportsitsownaddressasmysqlu03:7306
Clientsandotherclustermemberswillcommunicatewithitthroughthisaddressbydefault.Ifthisisnotcorrect,thereport_hostMySQLsystemvariableshouldbechanged.
User'icadmin'@'192.168.9.%'alreadyexistsandwillnotbecreated.
applierWorkerThreadswillbesettothedefaultvalueof4.
Theinstance'mysqlu03:7306'isvalidtobeusedinanInnoDBcluster.
Theinstance'mysqlu03:7306'isalreadyreadytobeusedinanInnoDBcluster.
Successfullyenabledparallelappliers.
MySQL192.168.9.200:7306sslJS>

創(chuàng)建集群

varcluster=dba.createCluster('gsp_cluster');

具體操作如下所示:

MySQL192.168.9.200:7306sslJS>varcluster=dba.createCluster('gsp_cluster');
AnewInnoDBClusterwillbecreatedoninstance'mysqlu01:7306'.
Validatinginstanceconfigurationat192.168.9.200:7306...
Thisinstancereportsitsownaddressasmysqlu01:7306
Instanceconfigurationissuitable.
NOTE:GroupReplicationwillcommunicatewithothermembersusing'mysqlu01:7306'.UsethelocalAddressoptiontooverride.
*CheckingconnectivityandSSLconfiguration...
CreatingInnoDBCluster'gsp_cluster'on'mysqlu01:7306'...
AddingSeedInstance...
Clustersuccessfullycreated.UseCluster.addInstance()toaddMySQLinstances.
Atleast3instancesareneededfortheclustertobeabletowithstandupto
oneserverfailure.
MySQL192.168.9.200:7306sslJS>

查看創(chuàng)建集群狀態(tài)

varcluster=dba.getCluster()
cluster.status()

具體輸出如下所示:

MySQL192.168.9.200:7306sslJS>varcluster=dba.getCluster()
MySQL192.168.9.200:7306sslJS>cluster.status()
{
"clusterName":"gsp_cluster",
"defaultReplicaSet":{
"name":"default",
"primary":"mysqlu01:7306",
"ssl":"REQUIRED",
"status":"OK_NO_TOLERANCE",
"statusText":"ClusterisNOTtoleranttoanyfailures.",
"topology":{
"mysqlu01:7306":{
"address":"mysqlu01:7306",
"memberRole":"PRIMARY",
"mode":"R/W",
"readReplicas":{},
"replicationLag":"applier_queue_applied",
"role":"HA",
"status":"ONLINE",
"version":"8.0.33"
}
},
"topologyMode":"Single-Primary"
},
"groupInformationSourceMember":"mysqlu01:7306"
}
MySQL192.168.9.200:7306sslJS>

添加節(jié)點(diǎn)到集群

varcluster=dba.getCluster()
cluster.addInstance('icadmin@192.168.9.201:7306')
cluster.status()
cluster.addInstance('icadmin@192.168.9.202:7306')
cluster.status()

部分輸出如下所示:

MySQL192.168.9.200:7306sslJS>cluster.addInstance('icadmin@192.168.9.202:7306')
NOTE:Thetargetinstance'mysqlu03:7306'hasnotbeenpre-provisioned(GTIDsetisempty).TheShellisunabletodecidewhetherincrementalstaterecoverycancorrectlyprovisionit.
Thesafestandmostconvenientwaytoprovisionanewinstanceisthroughautomaticcloneprovisioning,whichwillcompletelyoverwritethestateof'mysqlu03:7306'withaphysicalsnapshotfromanexistingclustermember.Tousethismethodbydefault,setthe'recoveryMethod'optionto'clone'.
TheincrementalstaterecoverymaybesafelyusedifyouaresureallupdateseverexecutedintheclusterweredonewithGTIDsenabled,therearenopurgedtransactionsandthenewinstancecontainsthesameGTIDsetastheclusterorasubsetofit.Tousethismethodbydefault,setthe'recoveryMethod'optionto'incremental'.
Pleaseselectarecoverymethod[C]lone/[I]ncrementalrecovery/[A]bort(defaultClone):C
Validatinginstanceconfigurationat192.168.9.202:7306...
Thisinstancereportsitsownaddressasmysqlu03:7306
Instanceconfigurationissuitable.
NOTE:GroupReplicationwillcommunicatewithothermembersusing'mysqlu03:7306'.UsethelocalAddressoptiontooverride.
*CheckingconnectivityandSSLconfiguration...
AnewinstancewillbeaddedtotheInnoDBCluster.Dependingontheamountof
dataontheclusterthismighttakefromafewsecondstoseveralhours.
Addinginstancetothecluster...
Monitoringrecoveryprocessofthenewclustermember.Press^Ctostopmonitoringandletitcontinueinbackground.
Clonebasedstaterecoveryisnowinprogress.
NOTE:Aserverrestartisexpectedtohappenaspartofthecloneprocess.Ifthe
serverdoesnotsupporttheRESTARTcommandordoesnotcomebackaftera
while,youmayneedtomanuallystartitback.
*Waitingforclonetofinish...
NOTE:mysqlu03:7306isbeingclonedfrommysqlu02:7306
**StageDROPDATA:Completed
**CloneTransferFILECOPY============================================================0%NotStartedPAGECOPY============================================================0%NotStartedREDOCOPY============================================================0%NotStarted**CloneTransferFILECOPY============================================================0%InProgressPAGECOPY============================================================0%NotStartedREDOCOPY============================================================0%NotStarted**CloneTransferFILECOPY############################################################100%CompletedPAGECOPY############################################################100%CompletedREDOCOPY############################################################100%Completed
NOTE:mysqlu03:7306isshuttingdown...
*Waitingforserverrestart...ready
*mysqlu03:7306hasrestarted,waitingforclonetofinish...
**StageRESTART:Completed
*Cloneprocesshasfinished:73.65MBtransferredinabout1second(~73.65MB/s)
Staterecoveryalreadyfinishedfor'mysqlu03:7306'
Theinstance'mysqlu03:7306'wassuccessfullyaddedtothecluster.
MySQL192.168.9.200:7306sslJS>cluster.status()
{
"clusterName":"gsp_cluster",
"defaultReplicaSet":{
"name":"default",
"primary":"mysqlu01:7306",
"ssl":"REQUIRED",
"status":"OK",
"statusText":"ClusterisONLINEandcantolerateuptoONEfailure.",
"topology":{
"mysqlu01:7306":{
"address":"mysqlu01:7306",
"memberRole":"PRIMARY",
"mode":"R/W",
"readReplicas":{},
"replicationLag":"applier_queue_applied",
"role":"HA",
"status":"ONLINE",
"version":"8.0.33"
},
"mysqlu02:7306":{
"address":"mysqlu02:7306",
"memberRole":"SECONDARY",
"mode":"R/O",
"readReplicas":{},
"replicationLag":"applier_queue_applied",
"role":"HA",
"status":"ONLINE",
"version":"8.0.33"
},
"mysqlu03:7306":{
"address":"mysqlu03:7306",
"memberRole":"SECONDARY",
"mode":"R/O",
"readReplicas":{},
"replicationLag":"applier_queue_applied",
"role":"HA",
"status":"ONLINE",
"version":"8.0.33"
}
},
"topologyMode":"Single-Primary"
},
"groupInformationSourceMember":"mysqlu01:7306"
}
MySQL192.168.9.200:7306sslJS>

檢查集群狀態(tài)

最后再檢查一次集群的狀態(tài)
varcluster=dba.getCluster()
cluster.status();

MySQL Router安裝

MySQL Router有兩種配置方式,如下所示:

手工配置,手工填寫后端 MGR 節(jié)點(diǎn)的地址,但是這樣MySQL Router就沒法感知 Primary 節(jié)點(diǎn)的變化,手工創(chuàng)建 MGR 時只能這么配置

引導(dǎo)模式自動進(jìn)行配置,通過 mysql_innodb_cluster_metadata 元數(shù)據(jù)庫動態(tài)感知 Primary 節(jié)點(diǎn)的變化,實現(xiàn)對應(yīng)用的透明,這也是 InnoDB Cluster 的標(biāo)準(zhǔn)配置方法。

bootstrap模式

bootstrap模式支持failover,但是必須結(jié)合InnoDB Cluster使用,在--directory指定的路徑下自動生成安裝目錄,配置文件里的端口為6446和6447

$cd/data/soft
$tarxvfmysql-router-8.0.35-linux-glibc2.28-x86_64.tar.xz-C/opt/mysql
$cd/opt/mysql/
$ln-smysql-router-8.0.35-linux-glibc2.28-x86_64/router

配置環(huán)境變量

#在mysql用戶下編輯,加入下面配置信息

exportPATH=$PATH:/opt/mysql/router/bin

執(zhí)行下面命令,使之生效。

$source~/.bash_profile
#查看幫助信息
mysqlrouter--help
#創(chuàng)建目錄
mkdir-p/data/mysqlrouter

初始化腳本(例子1)

mysqlrouter--bootstrapicadmin@mysqlu01:7306--directory/data/mysqlrouter--name='icrouter'--force-password-validation

具體如下所示:

$mysqlrouter--bootstrapicadmin@mysqlu01:7306--directory/data/mysqlrouter--name='iicrouter'--force-password-validation
PleaseenterMySQLpasswordforicadmin:
#BootstrappingMySQLRouter8.0.35(MySQLCommunity-GPL)instanceat'/data/mysqlrouter'...
-Creatingaccount(s)(onlythosethatareneeded,ifany)
-Verifyingaccount(usingittorunSQLqueriesthatwouldberunbyRouter)
-Storingaccountinkeyring
-Adjustingpermissionsofgeneratedfiles
-Creatingconfiguration/data/mysqlrouter/mysqlrouter.conf
#MySQLRouter'iicrouter'configuredfortheClusterSet'yicticcset'
AfterthisMySQLRouterhasbeenstartedwiththegeneratedconfiguration
$mysqlrouter-c/data/mysqlrouter/mysqlrouter.conf
ClusterSet'yicticcset'canbereachedbyconnectingto:
##MySQLClassicprotocol
-Read/WriteConnections:localhost:6446
-Read/OnlyConnections:localhost:6447
##MySQLXprotocol
-Read/WriteConnections:localhost:6448
-Read/OnlyConnections:localhost:6449

初始化腳本(例子2):

mysqlrouter--bootstrapicadmin@mysqlu01:7306\
--directory/data/mysqlrouter\
--accounticcrouter\
--usermysql--nameicrouter\
--conf-bind-address="0.0.0.0"\
--account-host="192.168.9.%"--force-password-validation

注意:--conf-bind-address,如果想任何其它機(jī)器都能訪問mysql router的話,那么--conf-bind-address應(yīng)該設(shè)置為0.0.0.0,如果設(shè)置為某個IP,表示只能在這個IP訪問mysql router,根據(jù)具體情況設(shè)置。

具體輸出如下所示:

[mysql@mysqlu01mysqlrouter]$mysqlrouter--bootstrapicadmin@mysqlu01:7306\
>--directory/data/mysqlrouter\
>--accounticcrouter\
>--usermysql--nameicrouter\
>--conf-bind-address="192.168.9.200"\
>--account-host="192.168.9.%"--force-password-validation
PleaseenterMySQLpasswordforicadmin:
#ReconfiguringMySQLRouter8.0.35(MySQLCommunity-GPL)instanceat'/data/mysqlrouter'...
PleaseenterMySQLpasswordforiccrouter:
-Creatingaccount(s)(onlythosethatareneeded,ifany)
-Usingexistingcertificatesfromthe'/data/mysqlrouter/data'directory
-Verifyingaccount(usingittorunSQLqueriesthatwouldberunbyRouter)
-Storingaccountinkeyring
-Adjustingpermissionsofgeneratedfiles
-Creatingconfiguration/data/mysqlrouter/mysqlrouter.conf
Existingconfigurationsbackedupto'/data/mysqlrouter/mysqlrouter.conf.bak'
#MySQLRouter'icrouter'configuredfortheInnoDBCluster'gsp_cluster'
AfterthisMySQLRouterhasbeenstartedwiththegeneratedconfiguration
$mysqlrouter-c/data/mysqlrouter/mysqlrouter.conf
InnoDBCluster'gsp_cluster'canbereachedbyconnectingto:
##MySQLClassicprotocol
-Read/WriteConnections:localhost:6446
-Read/OnlyConnections:localhost:6447
##MySQLXprotocol
-Read/WriteConnections:localhost:6448
-Read/OnlyConnections:localhost:6449
[mysql@mysqlu01mysqlrouter]$

查看MySQL Router信息

varcluster=dba.getCluster()
cluster.listRouters()

具體信息如下所示

配置MySQL Router的systemd服務(wù),編輯配置/usr/lib/systemd/system/mysqlrouter.service

[Unit]
Description=MySQLRouter
After=syslog.target
After=network.target
[Service]
Type=simple
User=mysql
Group=mysql
PIDFile=/data/mysqlrouter/mysqlrouter.pid
ExecStart=/opt/mysql/router/bin/mysqlrouter-c/data/mysqlrouter/mysqlrouter.conf
Restart=on-failure
PrivateTmp=true
[Install]
WantedBy=multi-user.target

然后執(zhí)行下面命令

#systemctldaemon-reload
#systemctlenablemysqlrouter.service
#systemctlstatusmysqlrouter.service
#systemctlstartmysqlrouter.service

啟動MySQL Router后,可以通過下面命令查看/驗證其監(jiān)聽端口是否開啟。

$netstat-ntlp|grepmysqlrouter
$ps-ef|grepmysqlrouter|grep-vgrep

然后依葫蘆畫瓢,在另外一臺服務(wù)器上安裝MySQL Router,關(guān)于MySQL Router的安裝,一般應(yīng)該在應(yīng)用服務(wù)器或單獨(dú)的服務(wù)器上安裝MySQL Router,結(jié)合Keepalvied實現(xiàn)MySQL Router的高可用性,這里不做展開介紹。

到此這篇關(guān)于MySQL InnoDB Cluster搭建安裝 的文章就介紹到這了,更多相關(guān)MySQL InnoDB Cluster安裝 內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • MySQL更新存放JSON的字段、\“ 轉(zhuǎn)義成 “的問題描述

    MySQL更新存放JSON的字段、\“ 轉(zhuǎn)義成 “的問題描述

    本篇介紹在執(zhí)行MySQL線上變更時遇到的問題,表現(xiàn)為"更新JSON字段時,實際更新的值與SQL語句中的值不一致,JSON格式錯誤",本文給大家分享問題描述及解決方案,感興趣的朋友一起看看吧
    2022-12-12
  • 如何給MySQL添加自定義語法的方法示例

    如何給MySQL添加自定義語法的方法示例

    本文主要介紹了如何給MySQL添加自定義語法的方法示例,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2022-08-08
  • MySQL?中定位?DDL?被阻塞的問題及解決方案

    MySQL?中定位?DDL?被阻塞的問題及解決方案

    DDL 被阻塞了,如何找到阻塞它的 SQL?下面,就這個問題,給一個清晰明了、拿來即用的解決方案,本文通過一個簡單的demo給大家介紹的非常詳細(xì),感興趣的朋友跟隨小編一起看看吧
    2022-01-01
  • MySql like模糊查詢通配符使用詳細(xì)介紹

    MySql like模糊查詢通配符使用詳細(xì)介紹

    MySQL提供標(biāo)準(zhǔn)的SQL模式匹配,以及一種基于象Unix實用程序如vi、grep和sed的擴(kuò)展正則表達(dá)式模式匹配的格式
    2013-10-10
  • MySQL讀取Binlog日志常見的3種錯誤

    MySQL讀取Binlog日志常見的3種錯誤

    這篇文章主要介紹了MySQL讀取Binlog日志常見的3種錯誤,非常不錯,具有一定的參考借鑒價值 ,需要的朋友可以參考下
    2019-04-04
  • 最新評論