先使用一台作为读写,一台作为只读
现在使用一台作为读写.两台作为只读
总结
1.同一个IP不同的session的情况下,Proxy将算作一个client,也就是每个IP是一个CLIENT.而不是实际连接数.
2.控制触发读写分离的参数位于 /usr/local/share/mysql-proxy/rw-splitting.lua 脚本min_idle_connections.当客户端的连接数超过此值时,Proxy的读写分离开始执行.(max_idle_connections参数暂时实验出来没有特殊作用)
3.--proxy-read-only-backend-addresses可以增加多条.但是测试始终是连接到第一条增加的服务器上.不会产生自动分发请求的效果.
Hey, I really enjoyed what you wrote here. I really like your blog, I'm sure I'll be visiting again! http://whitneyb99.blogspot.com
是lua的原因吧
在这里
http://jan.kneschke.de/2007/8/26/mysql-proxy-more-r-w-splitting
有对这个问题的描述
Improvements
keeping default-db in sync
One of the basic problems with rw-splitting is that each connection has a state, e.g. the default_db. If you switch to another backend you have to make sure that before we issue a SQL query, that also set the new default-db, if they are not in sync.
[read_query]
current backend = 0
client default db = mysql
client username = root
query = select * from user
server default db: repl
client default db: mysql
syncronizing
The client-side did a USE mysql against the master and wanted to SELECT from the a slave afterwards. As the connection the slave was still using repl from the previous query we have apply the DB-change now. For achieve this we insert a USE mysql before sending the SELECT to the slave.
In case the DB want to switch to doesn't exist on the slave, you will get an error like:
ERROR 1000 (00S00): can't change DB 'norepl' to on slave ':3307'
for the SELECT statement.
我的QQ 184990379
谢谢.
我一开始也没有发现.真正给用户使用的时候,用户是用工具连接的,都连接不上,会提示这个错误.
后来经过多次测试,用mysql 连接也是一样的错误.
方便msn沟通吗?或QQ
我的msn jabincn at hotmail.com
谢谢
明天我回公司测试一下
可能因为每次我测试之前都会use数据库
所以没有后发现这个问题.
不知道您在测试的时候是否有遇到这个问题。
我刚刚换了一个环境测试mysqlproxy 0.7问题依旧。怪了。
谢谢
您好,我在mysql里也提交了这个问题:
http://forums.mysql.com/read.php?146,211000
非常感谢。
谢谢。不过我确定在主辅机器都有相同的用户,相同的密码,权限也是可以的。但是use后就可以show database了。如果不user dataname的话就就其它任何命令都 无法使用。
你要确定使用的用户在read only的服务器上存在
有时候会忘记在read only数据库上建立同样的数据库用户
导致无法连接到read only服务器或者rw 服务器
还有如果存在.权限如何
感觉这个似乎是你的read only的服务器上
用户没有show database权限的挂你
你use以后就可以正常使用了
http://bbs.chinaunix.net/thread-1104131-1-1.html
这个贴子。
您好,我在做mysql-proxy读写分离的时,遇到
mysql> show databases;
ERROR 1105 (07000): can't change DB to on slave 192.168.0.9:3306
mysql> select count(*) from cjhjd.t_plan;
ERROR 1105 (07000): can't change DB to on slave 192.168.0.9:3306
mysql> use cjhjd;
Database changed
mysql> select count(*) from cjhjd.t_plan;
+----------+
| count(*) |
+----------+
| 1440 |
+----------+
1 row in set (1.10 sec)
在chinaunix.net发贴请教,暂还没有答案。请问有时间帮我看看吗,谢谢。
我的msn jabincn at hotmail.com