日日操夜夜添-日日操影院-日日草夜夜操-日日干干-精品一区二区三区波多野结衣-精品一区二区三区高清免费不卡

公告:魔扣目錄網(wǎng)為廣大站長提供免費(fèi)收錄網(wǎng)站服務(wù),提交前請做好本站友鏈:【 網(wǎng)站目錄:http://www.ylptlb.cn 】, 免友鏈快審服務(wù)(50元/站),

點(diǎn)擊這里在線咨詢客服
新站提交
  • 網(wǎng)站:51998
  • 待審:31
  • 小程序:12
  • 文章:1030137
  • 會(huì)員:747

集群服務(wù)部署

1、配置主庫映射文件

 

Rancher部署MySQL集群

 


Rancher部署MySQL集群

 

鍵名MySQLd.cnf

## The Percona Server 5.7 configuration file.

### * IMPORTANT: Additional settings that can override those from this file!

# The files must end with '.cnf', otherwise they'll be ignored.

# Please make any edits and changes to the Appropriate sectional files# included below.

[mysqld]

server_id = 1

log-bin= mysql-binread-only=0

replicate-ignore-db=mysql

replicate-ignore-db=sys

replicate-ignore-db=information_schema

replicate-ignore-db=performance_schema

[client]

user = root

password =123456

 

 

配置從庫映射文件:

## The Percona Server 5.7 configuration file.

### * IMPORTANT: Additional settings that can override those from this file!# The files must end with '.cnf', otherwise they'll be ignored.

# Please make any edits and changes to the appropriate sectional files

# included below.

[mysqld]

server_id = 2

log-bin= mysql-binread-only=0

replicate-ignore-db=mysql

replicate-ignore-db=sys

replicate-ignore-db=information_schema

replicate-ignore-db=performance_schema

[client]

user = root

password =123456

 

文件掛載目錄 /etc/my.cnf.d/

2、部署服務(wù)mysql-1,mysql-2

部署服務(wù),type=statefulset,port:3306 默認(rèn)模式 444

 

Rancher部署MySQL集群

 


Rancher部署MySQL集群

 

 

Rancher部署MySQL集群

 

部署完成需要給每個(gè)工作負(fù)載添加一個(gè)sidecar

 

Rancher部署MySQL集群

 

 

 

Rancher部署MySQL集群

 

 

選擇init容器

執(zhí)行命令 入口:/usr/bin/chown 命令:-R mysql /var/lib/mysql

建好后,重新部署mysql-1,mysql-2。

分別進(jìn)入mysql-1,mysql-2,命令行界面,查看mysql服務(wù)是否正常運(yùn)行;

 

3、正常運(yùn)行后,設(shè)置集群腳本 setgroup.sh

設(shè)置主從前須保證主從能正常通訊且數(shù)據(jù)一致,否則主從關(guān)系無法建立或操作不一致的數(shù)據(jù)時(shí)會(huì)導(dǎo)致主從關(guān)系Error。

進(jìn)入mysql-1或者mysql-2命令行,新建腳本 setgroup.sh(文件名自行命名):

#!/bin/bash

MASTERNAME="mysql-1" #數(shù)據(jù)庫信息

SLAVE_2="mysql-2"

#SLAVE_3="mysql-3"

PORT="3306"

USERNAME="root"

PWD="634634"

touch tmp.txt

mysql -h${MASTERNAME} << EOF

reset master;

grant replication slave on *.* to '${MASTERNAME}'@'%' identified by '${PWD}';

flush privileges;

tee ./tmp.txt;

show master statusG;

notee;

EOF

FILE_bin=`awk '/File/ {print $2}' tmp.txt`

POSIT=`awk '/Position/ {print $2}' tmp.txt`

rm -rf ./tmp.txt

touch tmp1.txt

mysql -h${SLAVE_2} << EOF

stop slave;

change master to master_host='${MASTERNAME}',master_port=${PORT},master_user='${USERNAME}',master_password='${PWD}',master_log_file='${FILE_bin}',master_log_pos=${POSIT};

start slave;

tee ./tmp1.txt;

show slave statusG;

show variables like "server_id";

notee;

EOF

id_1=`awk '/server_id/' tmp1.txt`

IO_sta_1=`awk '/Slave_IO_Running/' tmp1.txt`

SQL_sta_1=`awk '/Slave_SQL_Running:/' tmp1.txt`

rm -rf tmp1.txt

#touch tmp2.txt

#mysql -h${SLAVE_3} << EOF

#stop slave;

#change master to master_host='${MASTERNAME}',master_port=${PORT},master_user='${USERNAME}',master_password='${PWD}',master_log_file='${FILE_bin}',master_log_pos=${POSIT};

#start slave;

#tee ./tmp2.txt;

#show slave statusG;

#show variables like "server_id";

#notee;

#EOF

#id_2=`awk '/server_id/' tmp2.txt`

#IO_sta_2=`awk '/Slave_IO_Running/' tmp2.txt`

#SQL_sta_2=`awk '/Slave_SQL_Running:/' tmp2.txt`

#rm -rf tmp2.txt

#clear

echo ${id_1}

echo ${IO_sta_1}

echo ${SQL_sta_1}

#echo ${id_2}

#echo ${IO_sta_2}

#echo ${SQL_sta_2}

 

執(zhí)行./setgroup,進(jìn)入mysql-2查看鏈接狀態(tài):

[root@mysql-2-0 app]# mysql;

mysql>show slave statusG

 

 

Rancher部署MySQL集群

 

 

4、驗(yàn)證

user=root password=634634,服務(wù)器配置文件已經(jīng)在[client]字段添加好了,所以直接mysql就可以進(jìn)入控制臺。

進(jìn)入mysql-1,新建一個(gè)database ,再進(jìn)入mysql-2驗(yàn)證是否同步;

[root@mysql-1-0 app]# mysql;

mysql>create database test;

mysql>show databases;

 

[root@mysql-2-0 app]# mysql;

mysql>show databases;

分享到:
標(biāo)簽:Rancher
用戶無頭像

網(wǎng)友整理

注冊時(shí)間:

網(wǎng)站:5 個(gè)   小程序:0 個(gè)  文章:12 篇

  • 51998

    網(wǎng)站

  • 12

    小程序

  • 1030137

    文章

  • 747

    會(huì)員

趕快注冊賬號,推廣您的網(wǎng)站吧!
最新入駐小程序

數(shù)獨(dú)大挑戰(zhàn)2018-06-03

數(shù)獨(dú)一種數(shù)學(xué)游戲,玩家需要根據(jù)9

答題星2018-06-03

您可以通過答題星輕松地創(chuàng)建試卷

全階人生考試2018-06-03

各種考試題,題庫,初中,高中,大學(xué)四六

運(yùn)動(dòng)步數(shù)有氧達(dá)人2018-06-03

記錄運(yùn)動(dòng)步數(shù),積累氧氣值。還可偷

每日養(yǎng)生app2018-06-03

每日養(yǎng)生,天天健康

體育訓(xùn)練成績評定2018-06-03

通用課目體育訓(xùn)練成績評定