https://dev.mysql.com/downloads/mysql/
yum -y install cmake gcc gcc-c++ ncurses ncurses-devel libaio-devel openssl openssl-devel
mkdir mysql_1
mkdir mysql_2
tar -xzf mysql-boost-5.7.24.tar.gz -C mysql_1
tar -xzf mysql-boost-5.7.24.tar.gz -C mysql_2
useradd mysql_1 -s /sbin/nologin -M
useradd mysql_2 -s /sbin/nologin -M
mkdir -p /data/mysql/mysql_1/data
mkdir -p /data/mysql/mysql_2/data
cd mysql_1/mysql-5.7.24
cmake . -DCMAKE_INSTALL_PREFIX=/data/mysql/mysql_1 \
-DMYSQL_DATADIR=/data/mysql/mysql_1/data \
-DSYSCONFDIR=/etc \
-DMYSQL_TCP_PORT=3307 \
-DWITH_BOOST=./boost
make && make install
cd mysql_2/mysql-5.7.24
cmake . -DCMAKE_INSTALL_PREFIX=/data/mysql/mysql_2 \
-DMYSQL_DATADIR=/data/mysql/mysql_2/data \
-DSYSCONFDIR=/etc \
-DMYSQL_TCP_PORT=3308 \
-DWITH_BOOST=./boost
make && make install
chown -R mysql_1.mysql_1 /data/mysql/mysql_1
chown -R mysql_2.mysql_2 /data/mysql/mysql_2
[mysqld]
user=mysql_1
server-id=1
port=3307
basedir=/data/mysql/mysql_1
datadir=/data/mysql/mysql_1/data
socket=/tmp/mysql_1.sock
ngram_token_size=2
log-bin=mysql_1
slave-skip-errors=all
vim /etc/mysql_2.cnf
專注于為中小企業(yè)提供網(wǎng)站制作、成都做網(wǎng)站服務(wù),電腦端+手機端+微信端的三站合一,更高效的管理,為中小企業(yè)衛(wèi)濱免費做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了近1000家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實現(xiàn)規(guī)模擴充和轉(zhuǎn)變。
[mysqld]
user=mysql_2
server-id=2
port=3308
basedir=/data/mysql/mysql_2
datadir=/data/mysql/mysql_2/data
socket=/tmp/mysql_2.sock
ngram_token_size=2
log-bin=mysql_2
slave-skip-errors=all
/data/mysql/mysql_1/bin/mysqld --initialize-insecure --user=mysql_1 --datadir=/data/mysql/mysql_1/data
/data/mysql/mysql_1/bin/mysql_ssl_rsa_setup --defaults-file=/etc/mysql_1.cnf
/data/mysql/mysql_2/bin/mysqld --initialize-insecure --user=mysql_2 --datadir=/data/mysql/mysql_2/data
/data/mysql/mysql_2/bin/mysql_ssl_rsa_setup --defaults-file=/etc/mysql_2.cnf
/data/mysql/mysql_1/bin/mysqld_safe --defaults-file=/etc/mysql_1.cnf &
/data/mysql/mysql_2/bin/mysqld_safe --defaults-file=/etc/mysql_2.cnf &
/data/mysql/mysql_1/bin/mysql -S /tmp/mysql_1.sock
grant all on *.* to 'root'@'%' identified by '123456';
update mysql.user set Grant_priv='Y' where Host='%';
delete from mysql.user where Host<>'%' or User<>'root';
quit;
/data/mysql/mysql_2/bin/mysql -S /tmp/mysql_2.sock
grant all on *.* to 'root'@'%' identified by '123456';
update mysql.user set Grant_priv='Y' where Host='%';
delete from mysql.user where Host<>'%' or User<>'root';
quit;
show master status;
change master to
master_host='172.20.10.12',
master_port=3308,
master_user='root',
master_password='123456',
master_log_file='mysql_2.000003',
master_log_pos=154;
change master to
master_host='172.20.10.12',
master_port=3307,
master_user='root',
master_password='123456',
master_log_file='mysql_1.000004',
master_log_pos=154;
start slave;
show slave status\G
pkill mysql
給大家推薦幾個好用的工具
文章題目:centos7部署mysql雙主服務(wù)器
文章URL:http://aaarwkj.com/article48/gdiihp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計公司、品牌網(wǎng)站設(shè)計、網(wǎng)站導(dǎo)航、App設(shè)計、小程序開發(fā)、移動網(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)