国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

MySQL InnoDB Cluster搭建安裝

這篇具有很好參考價值的文章主要介紹了MySQL InnoDB Cluster搭建安裝。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

環(huán)境介紹:

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

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

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

MySQL InnoDB Cluster搭建安裝

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

1:防火墻配置

測試環(huán)境可以關(guān)閉防火墻,生產(chǎn)環(huán)境一般會開啟防火墻。在防火墻上設(shè)置相關(guān)IP和端口。根據(jù)實際情況進行設(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與主機名映射

編輯/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:配置標準大頁

grep?-i?huge?/proc/meminfo

建議開啟標準大頁,這樣更有利于性能。

6:禁用透明大頁

第二步:安裝MySQL實例

1:安裝MySQL實例

使用mysql_auto_install.sh腳本自動安裝MySQL單實例,如果常規(guī)的安裝MySQL實例,參考文檔“MySQL 8.0的二進制安裝文檔.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????????????????#強制GTID的一致性
gtid-mode=ON?????????????????????????????????????#開啟GTID,必須開啟
master-info-repository=TABLE
relay-log-info-repository=TABLE????????????#記錄同步的信息,便于管理和恢復
log-slave-updates?=?ON?????????????????????#需要記錄事務(wù)的binlog,用作以后的恢復用,哪怕不是寫入點,也需要
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"
##########################################################################################################################

##########################################################################################################################
#???????????????????????????????????????????組復制設(shè)置
##########################################################################################################################
#記錄事務(wù)的算法,官網(wǎng)建議設(shè)置該參數(shù)使用?XXHASH64?算法
transaction_write_set_extraction?=?XXHASH64
plugin_load_add='group_replication.so'

#是否隨服務(wù)器啟動而自動啟動組復制,不建議直接啟動,怕故障恢復時有擾亂數(shù)據(jù)準確性的特殊情況
#loose-group_replication_start_on_boot?=?OFF
group_replication_start_on_boot?=?OFF

#開啟引導模式,添加組成員,用于第一次搭建MGR或重建MGR的時候使用,只需要在集群內(nèi)的其中一臺開啟,
#loose-group_replication_bootstrap_group?=?OFF
group_replication_bootstrap_group?=?OFF



#IP地址白名單,默認只添加127.0.0.1,不會允許來自外部主機的連接,按需安全設(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ù)也有所出入,請以實際情況為準。

修改后重啟每一臺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)限安裝。可以只安裝一臺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é)點需要執(zhí)行創(chuàng)建用戶操作,此用戶臨時使用,配置完集群后刪除。

mysqlsh?

\c?icadmin@192.168.9.200:7306

mysqlsh?-h?192.168.9.200?-P?7306?-u?icadmin?-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,否則會提示不符合要求信息。

MySQL??192.168.9.200:7306?ssl??JS?>?dba.checkInstanceConfiguration('icadmin@192.168.9.201:7306')
Please?provide?the?password?for?'icadmin@192.168.9.201:7306':?****************
Save?password?for?'icadmin@192.168.9.201:7306'??[Y]es/[N]o/Ne[v]er?(default?No):?yes
Validating?MySQL?instance?at?mysqlu02:7306?for?use?in?an?InnoDB?cluster...

This?instance?reports?its?own?address?as?mysqlu02:7306
Clients?and?other?cluster?members?will?communicate?with?it?through?this?address?by?default.?If?this?is?not?correct,?the?report_host?MySQL?system?variable?should?be?changed.

Checking?whether?existing?tables?comply?with?Group?Replication?requirements...
No?incompatible?tables?detected

Checking?instance?configuration...
Instance?configuration?is?compatible?with?InnoDB?cluster

The?instance?'mysqlu02:7306'?is?valid?to?be?used?in?an?InnoDB?cluster.

{
????"status":?"ok"
}
?MySQL??192.168.9.200:7306?ssl??JS?>

如果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í)行過程如下所示:

MySQL??192.168.9.200:7306?ssl??JS?>?dba.configureInstance('icadmin@192.168.9.200:7306',?{clusterAdmin:?"'icadmin'@'192.168.9.%'"});

Configuring?local?MySQL?instance?listening?at?port?7306?for?use?in?an?InnoDB?cluster...

This?instance?reports?its?own?address?as?mysqlu01:7306
Clients?and?other?cluster?members?will?communicate?with?it?through?this?address?by?default.?If?this?is?not?correct,?the?report_host?MySQL?system?variable?should?be?changed.
User?'icadmin'@'192.168.9.%'?already?exists?and?will?not?be?created.

applierWorkerThreads?will?be?set?to?the?default?value?of?4.

The?instance?'mysqlu01:7306'?is?valid?to?be?used?in?an?InnoDB?cluster.
The?instance?'mysqlu01:7306'?is?already?ready?to?be?used?in?an?InnoDB?cluster.

Successfully?enabled?parallel?appliers.
?MySQL??192.168.9.200:7306?ssl??JS?>?dba.configureInstance('icadmin@192.168.9.201:7306',?{clusterAdmin:?"'icadmin'@'192.168.9.%'"});

Configuring?MySQL?instance?at?mysqlu02:7306?for?use?in?an?InnoDB?cluster...

This?instance?reports?its?own?address?as?mysqlu02:7306
Clients?and?other?cluster?members?will?communicate?with?it?through?this?address?by?default.?If?this?is?not?correct,?the?report_host?MySQL?system?variable?should?be?changed.
User?'icadmin'@'192.168.9.%'?already?exists?and?will?not?be?created.

applierWorkerThreads?will?be?set?to?the?default?value?of?4.

The?instance?'mysqlu02:7306'?is?valid?to?be?used?in?an?InnoDB?cluster.
The?instance?'mysqlu02:7306'?is?already?ready?to?be?used?in?an?InnoDB?cluster.

Successfully?enabled?parallel?appliers.
?MySQL??192.168.9.200:7306?ssl??JS?>?dba.configureInstance('icadmin@192.168.9.202:7306',?{clusterAdmin:?"'icadmin'@'192.168.9.%'"});

Configuring?MySQL?instance?at?mysqlu03:7306?for?use?in?an?InnoDB?cluster...

This?instance?reports?its?own?address?as?mysqlu03:7306
Clients?and?other?cluster?members?will?communicate?with?it?through?this?address?by?default.?If?this?is?not?correct,?the?report_host?MySQL?system?variable?should?be?changed.
User?'icadmin'@'192.168.9.%'?already?exists?and?will?not?be?created.

applierWorkerThreads?will?be?set?to?the?default?value?of?4.

The?instance?'mysqlu03:7306'?is?valid?to?be?used?in?an?InnoDB?cluster.
The?instance?'mysqlu03:7306'?is?already?ready?to?be?used?in?an?InnoDB?cluster.

Successfully?enabled?parallel?appliers.
?MySQL??192.168.9.200:7306?ssl??JS?>

創(chuàng)建集群

var?cluster?=?dba.createCluster('gsp_cluster');

具體操作如下所示:

MySQL??192.168.9.200:7306?ssl??JS?>?var?cluster?=?dba.createCluster('gsp_cluster');
A?new?InnoDB?Cluster?will?be?created?on?instance?'mysqlu01:7306'.

Validating?instance?configuration?at?192.168.9.200:7306...

This?instance?reports?its?own?address?as?mysqlu01:7306

Instance?configuration?is?suitable.
NOTE:?Group?Replication?will?communicate?with?other?members?using?'mysqlu01:7306'.?Use?the?localAddress?option?to?override.

*?Checking?connectivity?and?SSL?configuration...

Creating?InnoDB?Cluster?'gsp_cluster'?on?'mysqlu01:7306'...

Adding?Seed?Instance...
Cluster?successfully?created.?Use?Cluster.addInstance()?to?add?MySQL?instances.
At?least?3?instances?are?needed?for?the?cluster?to?be?able?to?withstand?up?to
one?server?failure.

?MySQL??192.168.9.200:7306?ssl??JS?>

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

var?cluster?=?dba.getCluster()
cluster.status()

具體輸出如下所示:

MySQL??192.168.9.200:7306?ssl??JS?>?var?cluster?=?dba.getCluster()
?MySQL??192.168.9.200:7306?ssl??JS?>?cluster.status()
{
????"clusterName":?"gsp_cluster",?
????"defaultReplicaSet":?{
????????"name":?"default",?
????????"primary":?"mysqlu01:7306",?
????????"ssl":?"REQUIRED",?
????????"status":?"OK_NO_TOLERANCE",?
????????"statusText":?"Cluster?is?NOT?tolerant?to?any?failures.",?
????????"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"
}
?MySQL??192.168.9.200:7306?ssl??JS?>

添加節(jié)點到集群

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

部分輸出如下所示:

MySQL??192.168.9.200:7306?ssl??JS?>?cluster.addInstance('icadmin@192.168.9.202:7306')

NOTE:?The?target?instance?'mysqlu03:7306'?has?not?been?pre-provisioned?(GTID?set?is?empty).?The?Shell?is?unable?to?decide?whether?incremental?state?recovery?can?correctly?provision?it.
The?safest?and?most?convenient?way?to?provision?a?new?instance?is?through?automatic?clone?provisioning,?which?will?completely?overwrite?the?state?of?'mysqlu03:7306'?with?a?physical?snapshot?from?an?existing?cluster?member.?To?use?this?method?by?default,?set?the?'recoveryMethod'?option?to?'clone'.

The?incremental?state?recovery?may?be?safely?used?if?you?are?sure?all?updates?ever?executed?in?the?cluster?were?done?with?GTIDs?enabled,?there?are?no?purged?transactions?and?the?new?instance?contains?the?same?GTID?set?as?the?cluster?or?a?subset?of?it.?To?use?this?method?by?default,?set?the?'recoveryMethod'?option?to?'incremental'.


Please?select?a?recovery?method?[C]lone/[I]ncremental?recovery/[A]bort?(default?Clone):?C
Validating?instance?configuration?at?192.168.9.202:7306...

This?instance?reports?its?own?address?as?mysqlu03:7306

Instance?configuration?is?suitable.
NOTE:?Group?Replication?will?communicate?with?other?members?using?'mysqlu03:7306'.?Use?the?localAddress?option?to?override.

*?Checking?connectivity?and?SSL?configuration...
A?new?instance?will?be?added?to?the?InnoDB?Cluster.?Depending?on?the?amount?of
data?on?the?cluster?this?might?take?from?a?few?seconds?to?several?hours.

Adding?instance?to?the?cluster...

Monitoring?recovery?process?of?the?new?cluster?member.?Press?^C?to?stop?monitoring?and?let?it?continue?in?background.
Clone?based?state?recovery?is?now?in?progress.

NOTE:?A?server?restart?is?expected?to?happen?as?part?of?the?clone?process.?If?the
server?does?not?support?the?RESTART?command?or?does?not?come?back?after?a
while,?you?may?need?to?manually?start?it?back.

*?Waiting?for?clone?to?finish...
NOTE:?mysqlu03:7306?is?being?cloned?from?mysqlu02:7306
**?Stage?DROP?DATA:?Completed?




**?Clone?Transfer??????FILE?COPY??============================================================????0%??Not?Started????PAGE?COPY??============================================================????0%??Not?Started????REDO?COPY??============================================================????0%??Not?Started**?Clone?Transfer??????FILE?COPY??============================================================????0%??In?Progress????PAGE?COPY??============================================================????0%??Not?Started????REDO?COPY??============================================================????0%??Not?Started**?Clone?Transfer??????FILE?COPY??############################################################??100%??Completed????PAGE?COPY??############################################################??100%??Completed????REDO?COPY??############################################################??100%??Completed
NOTE:?mysqlu03:7306?is?shutting?down...

*?Waiting?for?server?restart...?ready?
*?mysqlu03:7306?has?restarted,?waiting?for?clone?to?finish...
**?Stage?RESTART:?Completed
*?Clone?process?has?finished:?73.65?MB?transferred?in?about?1?second?(~73.65?MB/s)

State?recovery?already?finished?for?'mysqlu03:7306'

The?instance?'mysqlu03:7306'?was?successfully?added?to?the?cluster.

?MySQL??192.168.9.200:7306?ssl??JS?>?cluster.status()
{
????"clusterName":?"gsp_cluster",?
????"defaultReplicaSet":?{
????????"name":?"default",?
????????"primary":?"mysqlu01:7306",?
????????"ssl":?"REQUIRED",?
????????"status":?"OK",?
????????"statusText":?"Cluster?is?ONLINE?and?can?tolerate?up?to?ONE?failure.",?
????????"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"
}
?MySQL??192.168.9.200:7306?ssl??JS?>

檢查集群狀態(tài)

最后再檢查一次集群的狀態(tài)
var?cluster=dba.getCluster()
cluster.status();
MySQL InnoDB Cluster搭建安裝

MySQL Router安裝

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

  • 手工配置,手工填寫后端 MGR 節(jié)點的地址,但是這樣MySQL Router就沒法感知 Primary 節(jié)點的變化,手工創(chuàng)建 MGR 時只能這么配置
  • 引導模式自動進行配置,通過 mysql_innodb_cluster_metadata 元數(shù)據(jù)庫動態(tài)感知 Primary 節(jié)點的變化,實現(xiàn)對應(yīng)用的透明,這也是 InnoDB Cluster 的標準配置方法。

bootstrap模式

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

$?cd?/data/soft
$?tar?xvf??mysql-router-8.0.35-linux-glibc2.28-x86_64.tar.xz?-C?/opt/mysql
$?cd?/opt/mysql/
$?ln?-s?mysql-router-8.0.35-linux-glibc2.28-x86_64/?router

配置環(huán)境變量

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

export?PATH=$PATH:/opt/mysql/router/bin

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

$?source?~/.bash_profile
#查看幫助信息
mysqlrouter?--help

#
創(chuàng)建目錄
mkdir?-p?/data/mysqlrouter

初始化腳本(例子1)

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

具體如下所示:

$?mysqlrouter?--bootstrap?icadmin@mysqlu01:7306?--directory?/data/mysqlrouter??--name='iicrouter'?--force-password-validation
Please?enter?MySQL?password?for?icadmin:?
#?Bootstrapping?MySQL?Router?8.0.35?(MySQL?Community?-?GPL)?instance?at?'/data/mysqlrouter'...

-?Creating?account(s)?(only?those?that?are?needed,?if?any)
-?Verifying?account?(using?it?to?run?SQL?queries?that?would?be?run?by?Router)
-?Storing?account?in?keyring
-?Adjusting?permissions?of?generated?files
-?Creating?configuration?/data/mysqlrouter/mysqlrouter.conf

#
?MySQL?Router?'iicrouter'?configured?for?the?ClusterSet?'yicticcset'

After?this?MySQL?Router?has?been?started?with?the?generated?configuration

????$?mysqlrouter?-c?/data/mysqlrouter/mysqlrouter.conf

ClusterSet?'yicticcset'?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:6448
-?Read/Only?Connections:??localhost:6449

初始化腳本(例子2):

mysqlrouter?--bootstrap?icadmin@mysqlu01:7306?\
--directory?/data/mysqlrouter??\
--account?iccrouter?\
--user?mysql?--name?icrouter??\
--conf-bind-address="0.0.0.0"??\
--account-host="192.168.9.%"?--force-password-validation

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

具體輸出如下所示:

[mysql@mysqlu01?mysqlrouter]$?mysqlrouter?--bootstrap?icadmin@mysqlu01:7306?\
>?--directory?/data/mysqlrouter??\
>?--account?iccrouter?\
>?--user?mysql?--name?icrouter??\
>?--conf-bind-address="192.168.9.200"??\
>?--account-host="192.168.9.%"?--force-password-validation
Please?enter?MySQL?password?for?icadmin:?
#?Reconfiguring?MySQL?Router?8.0.35?(MySQL?Community?-?GPL)?instance?at?'/data/mysqlrouter'...

Please?enter?MySQL?password?for?iccrouter:?
-?Creating?account(s)?(only?those?that?are?needed,?if?any)
-?Using?existing?certificates?from?the?'/data/mysqlrouter/data'?directory
-?Verifying?account?(using?it?to?run?SQL?queries?that?would?be?run?by?Router)
-?Storing?account?in?keyring
-?Adjusting?permissions?of?generated?files
-?Creating?configuration?/data/mysqlrouter/mysqlrouter.conf

Existing?configurations?backed?up?to?'/data/mysqlrouter/mysqlrouter.conf.bak'

#?MySQL?Router?'icrouter'?configured?for?the?InnoDB?Cluster?'gsp_cluster'

After?this?MySQL?Router?has?been?started?with?the?generated?configuration

????$?mysqlrouter?-c?/data/mysqlrouter/mysqlrouter.conf

InnoDB?Cluster?'gsp_cluster'?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:6448
-?Read/Only?Connections:??localhost:6449

[mysql@mysqlu01?mysqlrouter]$

查看MySQL Router信息

var?cluster?=dba.getCluster()
cluster.listRouters()

具體信息如下所示

MySQL InnoDB Cluster搭建安裝

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

[Unit]
Description=MySQL?Router
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í)行下面命令

#?systemctl?daemon-reload
#?systemctl?enable?mysqlrouter.service
#?systemctl?status?mysqlrouter.service
#?systemctl?start?mysqlrouter.service

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

$?netstat?-ntlp?|grep?mysqlrouter
$?ps?-ef?|?grep?mysqlrouter?|?grep?-v?grep

然后依葫蘆畫瓢,在另外一臺服務(wù)器上安裝MySQL Router,關(guān)于MySQL Router的安裝,一般應(yīng)該在應(yīng)用服務(wù)器或單獨的服務(wù)器上安裝MySQL Router,結(jié)合Keepalvied實現(xiàn)MySQL Router的高可用性,這里不做展開介紹。文章來源地址http://www.zghlxwxcb.cn/news/detail-824588.html

到了這里,關(guān)于MySQL InnoDB Cluster搭建安裝的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔相關(guān)法律責任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • MySQL — InnoDB介紹

    MySQL — InnoDB介紹

    InnoDB是一款兼顧高可靠性和高性能的通用存儲引擎。也是默認的MySQL存儲引擎。 它的DML操作遵循ACID模型,事務(wù)具有提交、回滾和崩潰恢復功能,以保護用戶數(shù)據(jù)。 行級鎖定和oracle風格的一致性讀取提高了多用戶并發(fā)性和性能。 InnoDB表在磁盤上排列數(shù)據(jù),以優(yōu)化基于主鍵的查

    2024年02月14日
    瀏覽(15)
  • MySQL InnoDB Architecture 簡要介紹

    MySQL InnoDB Architecture 簡要介紹

    MySQL InnoDB 存儲引擎整體架構(gòu)圖: buffer pool 是主內(nèi)存中的一塊兒存儲區(qū)域,用于存儲訪問的表及索引數(shù)據(jù)。這樣從內(nèi)存中直接訪問獲取使用的數(shù)據(jù)可以極大的提升訪問效率。在一些特殊專用的服務(wù)里,幾乎 80% 的內(nèi)存區(qū)域都被賦于 buffer pool。 為了提升大數(shù)據(jù)量讀操作效率,b

    2023年04月20日
    瀏覽(61)
  • MySQL-Galera-Cluster集群詳細介紹

    MySQL-Galera-Cluster集群詳細介紹

    當數(shù)據(jù)量和并發(fā)量上去后,單節(jié)點數(shù)據(jù)庫無法滿足大并發(fā)時性能上的要求。 單節(jié)點的MySQL無法滿足高可用,數(shù)據(jù)庫宕機或者意外中斷等故障后,業(yè)務(wù)服務(wù)被迫中斷。 當數(shù)據(jù)量和并發(fā)量上去后,單節(jié)點 MySQL無法承載巨大的業(yè)務(wù)量,數(shù)據(jù)庫負載巨大。 MySQL集群是指多臺服務(wù)器共同

    2024年02月06日
    瀏覽(14)
  • LAMP(Linux+Apache+MySQL+PHP)環(huán)境介紹、配置、搭建

    LAMP(Linux+Apache+MySQL+PHP)環(huán)境介紹、配置、搭建

    LAMP是由Linux, Apache, MySQL, PHP組成的,即把Apache、MySQL以及PHP安裝在Linux系統(tǒng)上,組成一個環(huán)境來運行PHP的腳本語言。Apache是最常用的Web服務(wù)軟件,而MySQL是比較小型的數(shù)據(jù)庫軟件。三個角色可以安裝在一臺機器上,也可以分開(但httpd和php要在一起的) 為什么需要LAMP? 手動

    2024年04月28日
    瀏覽(18)
  • 環(huán)境搭建及源碼運行_java環(huán)境搭建_mysql安裝

    環(huán)境搭建及源碼運行_java環(huán)境搭建_mysql安裝

    抖音教學視頻??????? 目錄 1、介紹 2、下載 MySQL 3、安裝 4、設(shè)置環(huán)境變量 5、啟動 MySQL 6、重新設(shè)置root賬戶密碼 7、創(chuàng)建數(shù)據(jù)庫及表 8、安裝mysql工具 概覽 MySQL是一個關(guān)系型數(shù)據(jù)庫管理系統(tǒng),由瑞典MySQL AB?公司開發(fā),屬于?Oracle旗下產(chǎn)品。MySQL是最流行的關(guān)系型數(shù)據(jù)庫

    2024年02月04日
    瀏覽(18)
  • MySQL安裝與環(huán)境搭建——超詳細教程

    MySQL安裝與環(huán)境搭建——超詳細教程

    大數(shù)據(jù)學習路線,從零開始學大數(shù)據(jù)(點擊跳轉(zhuǎn),學習不迷路) MySQL最詳細教程(點擊跳轉(zhuǎn),學習不迷路) 步驟1:停止MySQL服務(wù) 在卸載之前,先停止MySQL8.0的服務(wù)。按鍵盤上的“Ctrl + Alt + Delete”組合鍵,打開“任務(wù)管理器”對話 框,可以在“服務(wù)”列表找到“MySQL8.0”的服

    2024年02月03日
    瀏覽(15)
  • MySQL InnoDB ReplicaSet安裝文檔

    MySQL InnoDB ReplicaSet安裝文檔

    MySQL InnoDB ReplicaSet(也叫MySQL副本集,有些地方也翻譯成MySQL復制集)是在 MySQL 8.0.19 版本(2020-01-13 Released)之后開始支持的,MySQL副本集中擁有一個primary節(jié)點,一個或多個secondary節(jié)點,它不像MySQL InnoDB Cluster一樣提供故障自愈和多主模式,但是它提供手工的方法添加、移除和配置

    2024年02月03日
    瀏覽(11)
  • 【W(wǎng)indows環(huán)境搭建】Win11 安裝 MySQL 8

    【W(wǎng)indows環(huán)境搭建】Win11 安裝 MySQL 8

    系統(tǒng):Win 11 MySQL版本:mysql 8 ??有些步驟第一次安裝時沒有截圖,是在給其他電腦進行安裝時補上截圖的,因此會出現(xiàn)前后文件路徑不一致的情況。本文圖片僅供參考,一切以文字內(nèi)容為準。 官網(wǎng)下載地址:download 不要使用exe安裝,使用zip壓縮包安裝 exe安裝光是勾選就要十

    2024年02月03日
    瀏覽(21)
  • 59 openEuler 22.03-LTS 搭建MySQL數(shù)據(jù)庫服務(wù)器-軟件介紹和配置環(huán)境

    59 openEuler 22.03-LTS 搭建MySQL數(shù)據(jù)庫服務(wù)器-軟件介紹和配置環(huán)境

    59.1 軟件介紹 MySQL是一個關(guān)系型數(shù)據(jù)庫管理系統(tǒng),由瑞典MySQL AB公司開發(fā),目前屬于Oracle旗下產(chǎn)品。MySQL是業(yè)界最流行的RDBMS (Relational Database Management System,關(guān)系數(shù)據(jù)庫管理系統(tǒng))之一,尤其在WEB應(yīng)用方面。 關(guān)系數(shù)據(jù)庫將數(shù)據(jù)保存在不同的表中,而不是將所有數(shù)據(jù)放在一個大倉庫

    2023年04月22日
    瀏覽(25)
  • CentOS系統(tǒng)環(huán)境搭建(七)——Centos7安裝MySQL

    CentOS系統(tǒng)環(huán)境搭建(七)——Centos7安裝MySQL

    centos系統(tǒng)環(huán)境搭建專欄??點擊跳轉(zhuǎn) 坦誠地說,本文中百分之九十的內(nèi)容都來自于該文章??Linux:CentOS7安裝MySQL8(詳),十分佩服大佬文章結(jié)構(gòu)合理,文筆清晰,我曾經(jīng)在這篇文章指導下成功安裝mysql。今天,想把內(nèi)容搬運寫到此博客,方便查看。 1.1、卸載 MariaDB 1.1.1、Mari

    2024年02月12日
    瀏覽(23)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包