mysql proxy 安裝部署
作者:徐振業
、下載mysql-proxy
、安裝mysql-proxy
0.6.0-linux-rhas4-x86.tar.gz
# mv mysql-proxy-0.6.0-linux-rhas4-x86 /usr/local/proxymysql
# cd /usr/local/proxymysql/
# ls
sbin share
# cd sbin/
# ls
mysql-proxy
安裝完畢
、使用mysql-proxy
檢視幫助 :
#./ mysql-proxy --help-all
引數說明:
--admin-address=
--proxy-address=
--proxy-read-only-backend-addresses=
--proxy-backend-addresses=
--proxy-lua-script. =
啟動mysql-proxy (前提 :本機安裝mysql 並可透過遠端登入,假設本機地址為
192.168.1.1)
#cd /usr/local/proxymysql/sbin
#./mysql-proxy &
#ps –ef
可以看到該程式
透過mysql-proxy 登入mysql
本機登陸:
#/usr/local/mysql/bin/mysql –uroot –p –P 4040
遠端登陸:
C:>mysql –h192.168.1.1 –utesting –ptesting –P 4040
、使用Lua指令碼完成讀寫分發
#cd /usr/local/mysqlproxy/sbin
#mkdir proxy
#ls
mysql-proxy proxy
登陸cvs:
下載 rw-splitting.lua 並複製到 /usr/local/mysqlproxy/sbin 目錄下。
下載 auto-config.lua balance.lua commands.lua. parser.lua tokenizer.lua
並複製到 /usr/local/mysqlproxy/sbin/proxy 目錄下。
、測試環境
192.168.1.1 : mysql master
192.168.1.2 : mysql slave
Replication database : backup
Tables in replication database: proxy
On master :
Mysql> use backup;
Mysql>select * from proxy;
+----------+
| name |
+----------+
| testing |
| lsps-efd |
| 2 |
| 1 |
| 0 |
| 1111 |
| 1 |
| 2 |
| 1 |
| 0 |
+----------+
On slave :
Mysql>use backup;
Mysql>select * from proxy;
+----------+
| name |
+----------+
| testing |
| lsps-efd |
| 1 |
| 0 |
| 1 |
| 0 |
| 1111 |
| 1 |
+----------+
在mysql-proxy 的伺服器啟動mysql-proxy:
#/usr/local/mysqlproxy/sbin/mysql-proxy --proxy-read-only-backend-addresses=192.168.1.2:3306 --proxy-backend-addresses=192.168.1.1:3306 --proxy-lua-script=rw-splitting.lua &
為了看到顯示結果,透過客戶端(客戶端要安裝mysql)多次傳送以下請求命令:
C:>mysql –h192.168.1.1 –utesting –ptesting –P 4040 –D backup –e “select * from proxy “
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/90618/viewspace-612222/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Ubuntu安裝mysql-proxyUbuntuMySql
- MySQL所有的安裝部署方式MySql
- mysql5.7GeleraCluster安裝部署(二)MySql
- MySQL 主從複製安裝部署配置MySql
- MySQL全面瓦解:安裝部署與準備MySql
- 伺服器安裝部署-01-MySQL伺服器MySql
- Mysql MHA部署-03MHA軟體安裝MySql
- MySQL 8 複製(八)——組複製安裝部署MySql
- Linux環境下MySQL安裝部署操作步驟LinuxMySql
- Linux安裝部署Linux
- ELK安裝部署
- chromedriver安裝部署Chrome
- canal安裝部署
- SQOOP安裝部署OOP
- keepalived 安裝部署
- Hadoop安裝部署Hadoop
- Zabbix安裝部署
- Doris安裝部署
- Centos7安裝安裝部署dockerCentOSDocker
- mysql 安裝MySql
- 安裝mysqlMySql
- MySQL安裝MySql
- Linux安裝解除安裝MySQLLinuxMySql
- 連網安裝mysql與原始碼安裝mysqlMySql原始碼
- 【MySQL安裝】Linux下安裝MySQL(預編譯)MySqlLinux編譯
- ElasticSearch + Kibana 安裝部署Elasticsearch
- hadoop的安裝部署Hadoop
- Jenkins安裝部署(一)Jenkins
- Saltstack基本安裝部署
- docke安裝與部署
- CDH - [02] 安裝部署
- gitlab - [02] 安裝部署Gitlab
- Tomcat 8安裝部署Tomcat
- DataX - [02] 安裝部署
- flume的安裝部署
- RocketMQ安裝及部署MQ
- python安裝部署(3.12)Python
- Hive(八)安裝部署Hive
- Apache Ranger安裝部署ApacheRanger