真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

Mysql數(shù)據(jù)庫(kù)讀寫(xiě)分離簡(jiǎn)單配置

環(huán)境:

公司主營(yíng)業(yè)務(wù):網(wǎng)站制作、網(wǎng)站建設(shè)、移動(dòng)網(wǎng)站開(kāi)發(fā)等業(yè)務(wù)。幫助企業(yè)客戶真正實(shí)現(xiàn)互聯(lián)網(wǎng)宣傳,提高企業(yè)的競(jìng)爭(zhēng)能力。創(chuàng)新互聯(lián)是一支青春激揚(yáng)、勤奮敬業(yè)、活力青春激揚(yáng)、勤奮敬業(yè)、活力澎湃、和諧高效的團(tuán)隊(duì)。公司秉承以“開(kāi)放、自由、嚴(yán)謹(jǐn)、自律”為核心的企業(yè)文化,感謝他們對(duì)我們的高要求,感謝他們從不同領(lǐng)域給我們帶來(lái)的挑戰(zhàn),讓我們激情的團(tuán)隊(duì)有機(jī)會(huì)用頭腦與智慧不斷的給客戶帶來(lái)驚喜。創(chuàng)新互聯(lián)推出廣宗免費(fèi)做網(wǎng)站回饋大家。

Master:192.168.71.128      MySQL-sql-node1

Slave:192.168.71.140       mysql-data-node1

Mysql-Proxy:192.168.71.138 mysql-mgm-node

 

 

rpm -q libevent glib2 pkgconfig libtool mysql-devel 查看系統(tǒng)是否已安裝以上包,如未安裝,使用yum install 安裝。

yum install -y libtermcap-devel ncurses-devel libevent-devel readline-devel gcc-c++

 

一、下載程序:

 

wget http://www.lua.org/ftp/lua-5.1.4.tar.gz

wget http://gd.tuwien.ac.at/db/mysql/Downloads/MySQL-Proxy/mysql-proxy-0.6.0.tar.gz

wget http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz

 

二、安裝lua:

 

[root@mailtest /software]# tar zxvf lua-5.1.4.tar.gz

[root@mailtest lua-5.1.4]#  cd lua-5.1.4

[root@mailtest lua-5.1.4]# # vi Makefile

修改:

INSTALL_TOP= /usr/local/lua

 

[root@mailtest lua-5.1.4]#  make && make linux && make install

 

設(shè)置環(huán)境變量

[root@mailtest lua-5.1.4]# export LUA_CFLAGS="-I/usr/local/lua/include" LUA_LIBS="-L/usr/local/lua/lib -llua -ldl" LDFLAGS="-L/usr/local/libevent/lib -lm"

[root@mailtest lua-5.1.4]# export CPPFLAGS="-I/usr/local/libevent/include"

[root@mailtest lua-5.1.4]# export CFLAGS="-I/usr/local/libevent/include"

 

三、安裝 libevent:

 

tar zvxf libevent-1.4.13-stable.tar.gz

cd libevent-1.4.13-stable

./configure --prefix=/usr/local/libevent

make && make install

 

四、安裝mysql-proxy:

./configure --prefix=/usr/local/mysql-proxy --with-mysql=/usr/local/mysql --with-lua

make && make install

 

 

啟動(dòng):

/usr/local/mysql-proxy/sbin/mysql-proxy --proxy-read-only-backend-addresses=192.168.71.140:3306 --proxy-backend-addresses=192.168.71.128:3306 --proxy-lua-

 

script=/usr/local/mysql-proxy/share/mysql-proxy/rw-splitting.lua &

 

查看進(jìn)程:

netstat -ntlp | grep mysql

編輯啟動(dòng)腳本:

vi /etc/init.d/mysql-proxy

#!/bin/bash

PRODIR=/usr/local/mysql-proxy

LUA_PATH=$PRODIR/share/mysql-proxy

start(){

$PRODIR/sbin/mysql-proxy --proxy-read-only-backend-addresses=192.168.71.140:3306 --proxy-backend-addresses=192.168.71.128:3306 --proxy-lua-

 

script=/usr/local/mysql-proxy/share/mysql-proxy/rw-splitting.lua &

>>$PRODIR/mysql-proxy.log &

}

stop(){

kill $(pidof mysql-proxy)

if [ $? -ne 0 ];then

kill -9 $(pidof mysql-proxy)

fi

}

case "$1" in

start)

start

;;

stop)

stop

;;

restart)

stop

start

;;

*)

echo $"Usage: $0 {start|stop|restart}"

esac

 

 

 

修改權(quán)限:

chmod +x /etc/init.d/mysql-proxy

/etc/init.d/mysql-proxy start

 

測(cè)試:

在MySQL-Master 上創(chuàng)建測(cè)試數(shù)據(jù)庫(kù)和用戶。

mysql> create database unixhot;

mysql> GRANT ALL PRIVILEGES ON king.* to proxytest@'%' identified by 'bobo365';

連接測(cè)試

[root@MySQL-Proxy ~]# mysql -h 192.168.71.138 -P 4040 -u proxytest -p

輸入密碼即可登錄。

 

 

mysql> show processlist;

+----+-----------+----------------------+------+---------+------+-------+------------------+

| Id | User      | Host                 | db   | Command | Time | State | Info             |

+----+-----------+----------------------+------+---------+------+-------+------------------+

| 14 | proxytest | 192.168.71.138:17350 | NULL | Sleep   |    2 |       | NULL             |

| 15 | proxytest | 192.168.71.138:17355 | NULL | Query   |    0 | NULL  | show processlist |

| 16 | proxytest | 192.168.71.138:17358 | NULL | Sleep   |    2 |       | NULL             |

+----+-----------+----------------------+------+---------+------+-------+------------------+

3 rows in set (0.01 sec)


網(wǎng)頁(yè)名稱:Mysql數(shù)據(jù)庫(kù)讀寫(xiě)分離簡(jiǎn)單配置
網(wǎng)頁(yè)網(wǎng)址:http://weahome.cn/article/gioohe.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部