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

Mysql中如何搭建oneproxy

97次阅读
没有评论

共计 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字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)
主站蜘蛛池模板: 毛片在线免费播放 | 黄污视频免费 | 麻豆第一区mv免费观看网站 | 国产在线无码精品电影网 | 日韩精品少妇无码受不了 | 欧美激情日本一道免费视频 | 久久精品夜色国产 | 国产成人精品午夜福利 | 亚洲国产午夜精品理论片 | 超级碰碰色偷偷免费视频 | 亚洲一区不卡 | 日韩资源站 | 亚洲丶国产丶欧美一区二区三区 | 亚洲v无码一区二区三区四区观看 | 美女被免费网站视频九色 | 久9精品视频| 色综合久久久久无码专区 | 午夜精品网 | 强伦人妻一区二区三区视频18 | 极品白嫩大长腿美女在线观看 | 无码人妻品一区二区三区精99 | 成人h无码动漫在线观看 | 人人爽久久久噜噜噜婷婷 | 色先锋影音岛国av资源 | 亚洲av乱码一区二区三区香蕉 | 久久久久欧美激情 | 一本一本久久a久久精品综合 | 亚洲日本欧美 | 午夜视频在线观看视频 | 小sao货水好多真紧h无码视频 | 天干天干啦夜天干天2017 | 成视人a免费观看 视频 | 2020天堂中文字幕一区在线观 | 国产一级理论免费版 | 伊人亚洲综合网成人 | 羽月希奶水一区二区三区 | 非洲黑人性xxxx精品 | 一二三四在线观看免费高清视频 | 亚洲欧美日韩综合精品网 | 国产亚洲av综合人人澡精品 | 免费黑人真实处破女系列 |