91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

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

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

shell之路--mysql主從自動部署

發布時間:2020-08-05 17:51:44 來源:網絡 閱讀:666 作者:Max_zhao 欄目:MySQL數據庫

#!/bin/bash

#auto make install Mysql AB Relication

#by author max

#date 2017-05-04

MYSQL_SOFT="mysql mysql-server mysql-devel php-mysql"

NUM=`rpm -qa |grep -i mysql |wc -l`

CODE=$?


#Mysql To Install 2017

if [ $NUM -ne 0 ];then

echo -e "\033[32mThis server mysql already install.\033[0m"

read -p "Please ensure yum remove mysql server , Yes or No[y/n]": INPUT

if [ $INPUT == "y" ];then

yum remove $MYSQL_SOFT -y

rm -rf /var/lib/mysql /etc/my.cnf

yum -y install $MYSQL_SOFT

else

exit 0

fi

else

rm -rf /var/lib/mysql

yum -y install $MYSQL_SOFT

if [ $CODE -eq 0 ];then

echo -e "\033[32mThe mysql install successfully.\033[0m"

exit 1

fi

fi


#mysql to start and config

cat >/etc/my.cnf<<EOF

[mysqld]

datadir=/car/lib/mysql

socket=/var/lib/mysql/mysql.sock

user=mysql

symbpolic-links=0

log-bin=mysql-bin

server-id=1

auto_increment_offset=1

auto_increment_increment=2

[mysql_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysql/mysqld.pid

replicate-do-db=all

EOF

/etc/init.d/mysqld restart

ps -ef |grep mysql


function MYSQL_CONFIG(){


#master config mysql 

mysql -e "grant replication slave on *.* to 'max'@'%' identified by 'zhaomiao';"

MASTER_FILE=`mysql -e "show master status;"|tail -1|awk '{print $1}'`

MASTER_POS=`mysql -e "show master status;"|tail -1|awk '{print $2}'`

MASTER_IPADDR=`ifconfig eth0 |grep "Bcast"|awk '{print $2}'|cut -d: -f2`

read -p "please enter input slave ip address": SLAVE_IPADDR


#slave config mysql

ssh -l root $SLAVE_IPADDR "sed -i 's#server-id = 1#server-id = 2#g' /etc/my.cnf"

ssh -l root $SLAVE_IPADDR "/etc/init.d/mysqld restart"

ssh -l root $SLAVE_IPADDR "mysql -e \"change master to master_host='$MASTER_IPADDR',master_user='max',master_password='zhaomiao',master_log_file='$MASTER_FILE',master_log_pos=$MASTER_POS;\""

ssh -l root $SLAVE_IPADDR "mysql -e \"slave start;\""

ssh -l root $SLAVE_IPADDR "mysql -e \"show slave status\G;\""

}


read -p "please ensure your  server is master ? yes or no[y/n]": INPUT

if [ $INPUT == "y" ];then

MYSQL_CONFIG

else

exit 0

fi


向AI問一下細節

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

AI

重庆市| 京山县| 韶关市| 卓资县| 平泉县| 堆龙德庆县| 伽师县| 北流市| 尼勒克县| 广元市| 衡水市| 商河县| 新源县| 盘山县| 利辛县| 民权县| 茂名市| 镇康县| 长宁县| 绵竹市| 乐安县| 安龙县| 岐山县| 菏泽市| 准格尔旗| 乐亭县| 台江县| 北流市| 阿巴嘎旗| 达州市| 桦南县| 民丰县| 三亚市| 安图县| 澎湖县| 古丈县| 西贡区| 奉化市| 南宁市| 孟村| 绥棱县|