mysql amoeba 读写分离

本文在Mysql主从同步的基础上进行配置

不熟悉的盆友请自行乘坐时光机。 Mysql主从同步:http://nothing-whoami.iteye.com/blog/2144294

再加一台主机 amoeba : 192.168.10.21

一、下载amoeba

 

wget http://nchc.dl.sourceforge.net/project/amoeba/Amoeba%20for%20mysql/2.x/amoeba-mysql-binary-2.1.0-RC5.tar.gz

 二、解压并修改amoeba配置文件

dbServer.xml






		
		
	
		
			${defaultManager}
			64
			128
				
			
			3306
			
			
			test
			
			
			nothing
			
			
			123456
			
		

		
			500
			500
			10
			600000
			600000
			true
			true
		
	

	
		
			
			192.168.10.31
		
	
	
	
		
			
			192.168.10.146
		
	

	
		
			
			1
			
			
			master
		
	
		
	
		
			
			1
			
			
			slave
		
	


 amoeba.xml






	
	
		
		
			
			8066
			
			
			
			
			${clientConnectioneManager}
			
			
				
					128
					64
				
			
			
			
				
					
					nothing
					
					123456
					
					
						
							${amoeba.home}/conf/access_list.conf
						
					
				
			
			
		
		
		
		
			
			
			
			127.0.0.1
			true
			${clientConnectioneManager}
			
				
			
			
		
		
		
			
			20
			
			
			30
			
			
			30
			
			
			500
			
			
			60
		
		
	
	
	
	
		
			com.meidusa.amoeba.net.ConnectionManager
			
		
		
			com.meidusa.amoeba.net.AuthingableConnectionManager
			
			
		
	
	
		
	
		${amoeba.home}/conf/dbServers.xml
	
	
	
		
			
				${amoeba.home}/conf/rule.xml
				${amoeba.home}/conf/ruleFunctionMap.xml
			
		
		${amoeba.home}/conf/functionMap.xml
		1500
		masterPool
		
		masterPool
		slavePool

		true
	

 3 启动

./amoeba start & 
[1] 20516
[email protected]:~/nothing/amoeba/bin$ log4j:WARN log4j config load completed from file:/home/wolfplus/nothing/amoeba/conf/log4j.xml
2014-10-17 16:18:35,197 INFO  context.MysqlRuntimeContext - Amoeba for Mysql current versoin=5.1.45-mysql-amoeba-proxy-2.1.0-RC5
log4j:WARN ip access config load completed from file:/home/wolfplus/nothing/amoeba/conf/access_list.conf
2014-10-17 16:18:35,482 INFO  net.ServerableConnectionManager - Amoeba for Mysql listening on 0.0.0.0/0.0.0.0:8066.
2014-10-17 16:18:35,489 INFO  net.ServerableConnectionManager - Amoeba Monitor Server listening on /127.0.0.1:25475.

 4 登陆方式

mysql -unothing -p123456 -h192.168.10.21 -P8066

 

这里如果插入的话就会插到 192.168.10.17,读数据的话就会读到 192.168.10.20 。测试时请先停止主从模式。在从机插入数据,再进行试验。

写的简单了点!这是主要的操作过程。至于更详细的!这里推荐两个链接吧

http://zhou123.blog.51cto.com/4355617/983592

http://634871.blog.51cto.com/624871/1335129



已有 0 人发表留言,猛击->> 这里<<-参与讨论


ITeye推荐
  • —软件人才免语言低担保 赴美带薪读研!—



你可能感兴趣的:(mysql,amoeba,分离)