在线精品99_中国九九盗摄偷拍偷看_91免费版在线观看_91.app_91高清视频在线_99热最新网站

Mysql中如何搭建oneproxy

117次阅读
没有评论

共计 3871 个字符,预计需要花费 10 分钟才能阅读完成。

丸趣 TV 小编给大家分享一下 Mysql 中如何搭建 oneproxy,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!

1 下载
官网:http://www.onexsoft.cn/software/step_into_oneproxy.pdf

2 安装
机器有限,oneproxy 就安装在 192.168.1.6 上
192.168.1.6– 主 —oneproxy
192.168.1.56— 从

3 简单读写分离

插入数据:[chenliang@hostnfsd oneproxy]$ mysql -utestuser -ptestuser -h292.168.1.6 –port=3308 -e insert into  test2(id) values(4) testbak; 
Warning: Using a password on the command line interface can be insecure.
[chenliang@hostnfsd oneproxy]$ mysql -utestuser -ptestuser -h292.168.1.6 –port=3308 -e select * from test2 testbak;            
Warning: Using a password on the command line interface can be insecure.
+——+——+
| id   | name |
+——+——+
|    1 | NULL |
|    2 | NULL |
|    3 | 4    |
+——+——+

成功插入主库

读负载均衡测试:

[chenliang@hostnfsd oneproxy]$ mysql -utestuser -ptestuser -h292.168.1.6 –port=3308 -e select * from test2 group1;
Warning: Using a password on the command line interface can be insecure.
+——+——+
| id   | name |
+——+——+
|    1 | NULL |
|    2 | NULL |
|    3 | 4    |
+——+——+
[chenliang@hostnfsd oneproxy]$ mysql -utestuser -ptestuser -h292.168.1.6 –port=3308 -e select * from test2 group1;
Warning: Using a password on the command line interface can be insecure.
+——+
| id   |
+——+
|    1 |
|    2 |
+——+
[chenliang@hostnfsd oneproxy]$ mysql -utestuser -ptestuser -h292.168.1.6 –port=3308 -e select * from test2 group1;
Warning: Using a password on the command line interface can be insecure.
+——+——+
| id   | name |
+——+——+
|    1 | NULL |
|    2 | NULL |
|    3 | 4    |
+——+——+
[chenliang@hostnfsd oneproxy]$ mysql -utestuser -ptestuser -h292.168.1.6 –port=3308 -e select * from test2 group1;
Warning: Using a password on the command line interface can be insecure.
+——+
| id   |
+——+
|    1 |
|    2 |
+——+

读负载均衡,均衡分发至每个库

多用户:

[root@hostnfsd :/usr/local/oneproxy]$ vi demo.sh 
#/bin/bash
#
export ONEPROXY_HOME=/usr/local/oneproxy

# valgrind –leak-check=full \

${ONEPROXY_HOME}/bin/oneproxy –keepalive \
–proxy-address=192.168.1.6:3308 \
–admin-address=192.168.1.6:4041  \
–proxy-master-addresses=192.168.1.6:3307@group1 \
–proxy-slave-addresses=192.168.1.56:3307@group1  \
–proxy-user-list=testuser/950434F7872CB57A600E1B2B7237766FA7E95460@testbak \
–proxy-user-list=jonn/950434F7872CB57A600E1B2B7237766FA7E95460@testbak2 \   — 就这不同,用户指定默认数据库不一样罢了
–proxy-group-policy=group1:Read-balance \
–proxy-charset=utf8_chinese_ci \
–log-file=${ONEPROXY_HOME}/oneproxy.log \
–pid-file=${ONEPROXY_HOME}/oneproxy.pid

测试:
[root@hostnfsd :/root]$ mysql -ujonn -ptestuser -h292.168.1.6 –port=3308 -e select * from test2 group1                         — 读写分离
Warning: Using a password on the command line interface can be insecure.
+——+
| id   |
+——+
|  106 |
+——+
[root@hostnfsd :/root]$ mysql -ujonn -ptestuser -h292.168.1.6 –port=3308 -e select * from test2 group1
Warning: Using a password on the command line interface can be insecure.
+——+
| id   |
+——+
|   56 |
+——+
[root@hostnfsd :/root]$ mysql -ujonn -ptestuser -h292.168.1.6 –port=3308 -e select * from test2 group1
Warning: Using a password on the command line interface can be insecure.
+——+
| id   |
+——+
|  106 |
+——+

[root@hostnfsd :/root]$ mysql -ujonn -ptestuser -h292.168.1.6 –port=3308 -e insert into  test2 values(111) group1              — 插入主库
Warning: Using a password on the command line interface can be insecure.
[root@hostnfsd :/root]$ mysql -ujonn -ptestuser -h292.168.1.6 –port=3308 -e select * from test2 group1          
Warning: Using a password on the command line interface can be insecure.
+——+
| id   |
+——+
|   56 |
+——+
[root@hostnfsd :/root]$ mysql -ujonn -ptestuser -h292.168.1.6 –port=3308 -e select * from test2 group1
Warning: Using a password on the command line interface can be insecure.
+——+
| id   |
+——+
|  106 |
|  111 |
+——+
[root@hostnfsd :/root]$ mysql -ujonn -ptestuser -h292.168.1.6 –port=3308 -e select * from test2 group1
Warning: Using a password on the command line interface can be insecure.
+——+
| id   |
+——+
|   56 |
+——+
[root@hostnfsd :/root]$ mysql -ujonn -ptestuser -h292.168.1.6 –port=3308 -e select * from test2 group1
Warning: Using a password on the command line interface can be insecure.
+——+
| id   |
+——+
|  106 |
|  111 |

以上是“Mysql 中如何搭建 oneproxy”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注丸趣 TV 行业资讯频道!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2023-07-19发表,共计3871字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)
主站蜘蛛池模板: 玖玖精品在线视频 | 国产婷婷色综合av蜜臀av | 中国少妇初尝黑人巨高清 | 欧美最猛黑人xxxx黑人猛交 | 国产精品免费视频能看 | 欧洲变态另类zozo | 九九精品在线视频 | 日本边添边摸边做边爱喷水 | 色噜噜综合网 | gv天堂gv无码男同在线观看 | 杨幂国产精品福利在线观看 | av色欲无码人妻中文字幕 | 国产精品精品自在线拍 | 91精品国产亚洲爽啪在线观看 | 国产精品1| 免费的色视频 | 国产老肥熟一区二区三区 | 日本免费不卡一区二区 | 久久亚洲免费视频 | 国产av偷闻女邻居内裤被发现 | 国产日韩欧美不卡在线二区 | 在线播放一区二区精品产 | 亚洲在线免费 | 深夜福利视频在线观看www | 国产精品麻花传媒二三区别 | 99精品在线免费观看 | 韩国19禁青草福利视频在线 | 欧美三级在线 | 四虎精品在线观看 | 无线日本视频精品 | 亚洲精品欧美综合二区 | 精品国偷自产在线视频九色 | 国外精品视频在线观看免费 | 日本乱理伦中文三区 | 久草国产精品视频 | 麻豆国内精品久久久久久 | 免费看毛片的网站 | 欧美乱妇狂野欧美在线视频 | 又黄又爽又色的视频 | 国产亚洲精品aaaaaaa片 | 欧美一级片在线视频 |