Mysql Scalability(3)Amoeba - Proxy - Reads and Writes
Oh, seem that the Amoeba is working with version 2.2.0. I will try this version with source codes.
Find the start script file bin/amoeba, find the line which configure the JAVA_OPTS, change it as follow:
DEFAULT_OPTS="-server -Xms256m -Xmx256m -Xss256k"
Then we can run
>bin/amoeba start
One Machine Proxy
Check the configuration files for db connection information
>vi dbServers.xml
<dbServer name="server1" parent="abstractServer"> <factoryConfig> <property name="ipAddress">ubuntu-master</property> </factoryConfig> </dbServer> <!-- <dbServer name="server2" parent="abstractServer"> <factoryConfig> <property name="ipAddress">ubuntu-client1</property> </factoryConfig> </dbServer> --> <dbServer name="multiPool"virtual="true"> <poolConfig class="com.meidusa.amoeba.server.MultipleServerPool"> <!-- Load balancing strategy: 1=ROUNDROBIN , 2=WEIGHTBASED , 3=HA--> <property name="loadbalance">1</property> <!-- Separated by commas,such as: server1,server2,server1 --> <property name="poolNames">server1</property> </poolConfig> </dbServer>
Check the Proxy Connection Configuration
>vi amoeba.xml
<service name="Amoeba Monitor Server" class="com.meidusa.amoeba.monitor.MonitorServer"> <!-- port --> <!-- default value: random number <property name="port">9066</property> --> <!-- bind ipAddress --> <property name="ipAddress">0.0.0.0</property> <property name="daemon">true</property> <property name="manager">${clientConnectioneManager}</property> <property name="connectionFactory"> <bean class="com.meidusa.amoeba.monitor.net.MonitorClientConnectionFactory"></bean> </property> </service>
After star the amoeba, we can use this proxy to connect to the DB.
>mysql -h ubuntu-master -u root -P 8066 -p
Multiple Machine - Separating Writes and Reads
Grant the Privileges
>use mysql;
>grant all privileges on test.* to root@"%" identified by 'kaishi';
>flush privileges;
Show the SQL
>use mysql
>show variables like "%general_log%";
+------------------+----------------------------------+ | Variable_name | Value | +------------------+----------------------------------+ | general_log | OFF | | general_log_file | /var/lib/mysql/ubuntu-master.log | +------------------+----------------------------------+ 2 rows in set (0.00 sec)
>set global general_log = true;
>sudo tail -f /var/lib/mysql/ubuntu-master.log
Prepare the Configurations
<dbServer name="master1" parent="abstractServer"]]> <factoryConfig> <property name="ipAddress"]]>ubuntu-master</property> </factoryConfig> </dbServer> <dbServer name="slave11" parent="abstractServer"]]> <factoryConfig> <property name="ipAddress"]]>ubuntu-client1</property> </factoryConfig> </dbServer> <dbServer name="slavePool1"virtual="true"]]> <poolConfig class="com.meidusa.amoeba.server.MultipleServerPool"]]> <!-- Load balancing strategy: 1=ROUNDROBIN , 2=WEIGHTBASED , 3=HA--> <property name="loadbalance"]]>1</property> <!-- Separated by commas,such as: server1,server2,server1 --> <property name="poolNames"]]>slave11</property> </poolConfig> </dbServer>
<queryRouter class="com.meidusa.amoeba.mysql.parser.MysqlQueryRouter"]]> <property name="ruleLoader"]]> <bean class="com.meidusa.amoeba.route.TableRuleFileLoader"]]> <property name="ruleFile"]]>${amoeba.home}/conf/rule.xml</property> <property name="functionFile"]]>${amoeba.home}/conf/ruleFunctionMap.xml</property> </bean> </property> <property name="sqlFunctionFile"]]>${amoeba.home}/conf/functionMap.xml</property> <property name="LRUMapSize"]]>1500</property> <property name="defaultPool"]]>master1</property> <property name="writePool"]]>master1</property> <property name="readPool"]]>slavePool1</property> <property name="needParse"]]>true</property> </queryRouter>
Execute these SQLs to Verify
>insert into branduser(id,username,age) values (2, "kiko", 28);
>select * from branduser;
Here is the slave machines
140729 11:14:15 44 Queryselect * from branduser 140729 11:16:13 1 QueryBEGIN 1 Queryinsert into branduser(id,username,age) values (2, "kiko", 28) 1 QueryCOMMIT /* implicit, from Xid_log_event */ 140729 11:16:53 44 Queryselect * from branduser
Here is the master machines
140729 11:16:13 43 Queryinsert into branduser(id,username,age) values (2, "kiko", 28)
That works well to separate the reads and writes.
References:
Download the mysql-proxy all versions
https://downloads.skysql.com/archive/index/p/mysql-proxy/v/0.8
http://askubuntu.com/questions/477873/how-do-i-work-around-a-stack-size-specified-is-too-small-error-in-java-on-powe
http://boke.25k5.com/kan16489.html
http://www.cnblogs.com/taven/archive/2012/09/11/2680282.html
http://www.aslibra.com/blog/post/amoeba_mysql_proxy_rw_split.php
https://www.centos.bz/2012/05/amoeba-for-mysql/
http://pengranxiang.iteye.com/blog/1145342
http://sillycat.iteye.com/blog/2070163 mysql logging
相关推荐
Designing for Scalability with Erlang-OTP.pdf Designing for Scalability with Erlang-OTP.pdf Designing for Scalability with Erlang-OTP.pdf
综上所述,《Robustness Communication Software -- Extreme Availability, Reliability and Scalability for Carrier-Grade System》这本书提供了关于如何设计高性能、高可靠性、高可用性以及高伸缩性的电信级系统...
3. **组合使用**:除了单独使用FGS外,还可以与时间可伸缩性结合使用,即Temporal and Fine Granularity Scalability (T&FGS)。时间可伸缩性允许视频根据帧率的不同进行分级,而FGS则侧重于图像质量的不同层次。二者...
学习java性能调优的好书,国外专家写的,很不错
3. **参数编码与波形编码的结合**:参数编码主要基于音频的特征参数,如频谱和声学模型,而波形编码则直接对原始音频信号进行采样。结合两者,可以在保持可伸缩性的同时,兼顾音质和编码效率。 4. **自适应码率控制...
- **HA/Scalability Guide**:提供了关于如何构建高可用和可扩展MySQL架构的指南。 - **备份与恢复**:介绍了备份策略和恢复流程,确保数据的安全性和可靠性。 - **虚拟化**:讨论了MySQL在虚拟化环境中的部署和管理...
- **MySQL Proxy**:MySQL代理服务器,提供了一种用于负载均衡和连接管理的工具。 - **MySQL Version Reference**:MySQL版本参考,提供了不同版本之间的差异和兼容性的信息。 - **MySQL Utilities**:MySQL实用...
Advanced Computer Architecture - Parallelism, Scalability, and Programmability 高级计算机体系结构
根据提供的文件信息,我们可以从多个角度来探讨与MySQL 5.0相关的知识点。以下是对这些知识点的详细解析: ### MySQL 5.0 参考手册概述 #### 1. **MySQL 5.0版本覆盖范围** - **版本详情**:此手册涵盖了MySQL ...
MySQL 8 Administrator's Guide pdf ...MySQL 8 - Scalability & High Availability MySQL 8 - Security Optimizing MySQL 8 Extending MySQL 8 MySQL 8 Best Practices & Benchmarking Troubleshooting MySQL 8
为了满足企业级应用的需求,MySQL 5.5 提供了一系列高可用性和可扩展性的解决方案,例如 MySQL Thread Pool、MySQL Cluster NDB 7.2、MySQL and DRBD 以及分区功能。这些特性有助于提高数据库的性能并确保其稳定性。...
Although some of the discussion (for example, on performance and scalability) would be most relevant to architects and lead developers, the practical focus would make it useful to anyone with some ...
My name is Jorge Acetozi, and I’m a Brazilian software engineer who has worked for many years as a Java developer. During my career, I have been interested in subjects such as these: • Linux • ...
- **扩展性**: 如 MySQL Proxy、MySQL and Virtualization 等。 #### 四、安全与合规 ##### 4.1 Security - **安全性**: MySQL Enterprise Security 功能介绍。 - **功能**: 包括加密、身份验证、访问控制等。 #...
Each optimization discusses techniques to improve the performance and scalability of your code. Every claim is substantiated with hard numbers and an experience-based evaluation. Java(TM) Performance...
在这个存储库中,我将阅读 Francesco Cesarini 和 Steve Vinoski 所著的“Designing for scaling with Erlang and Otp”一书时编写的代码组合在一起,你可以在购买这本书。 指数 第 3 章:行为 第 4 章:通用服务器
MySQL + .NET Framework 4.5.2 安装包 ...MySQL Cluster enables users to meet the database challenges of next generation web, cloud, and communications services with uncompromising scalability, uptime...
3. **资源利用率监控**:跟踪CPU、内存、网络和存储资源的使用情况,以便进行调整优化。 4. **故障检测与恢复**:检测系统故障并自动触发恢复机制,提高系统的可靠性。 5. **配置分析**:分析Glidein配置的合理性,...