search
HomeDatabaseMysql TutorialAmoeba新版本MYSQL读写分离配置_MySQL

bitsCN.com

官方简介
Amoeba的中文意思是变型虫
主要解决:
• 降低 数据切分带来的复杂多数据库结构
• 提供切分规则并降低 数据切分规则 给应用带来的影响
• 降低db 与客户端的连接数
• 读写分离

个人简单描述
可能你还没明白Amoebla这鬼东西主要干麻的呢!比方说PHP环境众所周知,PHP没有数据连接池,如果PHP环境下MYSQL访问量大时会蹦掉,除非配置Cluster集群,而Amoeba就是在PHP程序和MYSQL之间,充当一个缓冲的作用。

准备工作
Server:192.168.1.208 #Amoeba
Server:192.168.1.11  #NDBD1(主)
Server:1921.68.1.13  #NDBD2(从)
注:11和13两台服务器上,事先请安装好MYSQL单向步

另请安装MYSQL版本必须5.1以上,因为新版的Amoeba2.10对5.1以下版本不稳定。

 

结构图

Amoeba新版本MYSQL读写分离配置_MySQL

 

Step 1:配置Amoeba192.168.2.8读写分离 
1:解压安装包
[root@Management down]# mkdir /usr/local/amoeba
[root@Management down]# tar -zxf amoeba-mysql-binary-2.1.0-RC5.tar.gz -C /usr/local/amoeba/
2:进入配置目录,浏览文件
[root@Management down]# cd /usr/local/amoeba/
[root@Management amoeba]# ll
total 88
drwxr-xr-x 2 root root    4096 Jul 26 11:57 benchmark
drwxr-xr-x 2 root root    4096 Feb 28 09:25 bin
-rw-r--r-- 1 root root    3983 May 18 13:43 changelogs.txt
drwxr-xr-x 2 root root    4096 Jul 26 11:57 conf
drwxr-xr-x 3 root root    4096 Jul 26 11:57 lib
-rw-r--r-- 1 root root 34520 May 18 13:43 LICENSE.txt
-rw-r--r-- 1 root root    2031 May 18 13:43 README.html
3:进入主配置文件目录
[root@Management amoeba]# cd conf/
[root@Management conf]# ls
access_list.conf    amoeba.xml        dbServers.xml    functionMap.xml    log4j.xml    ruleFunctionMap.xml
amoeba.dtd                dbserver.dtd    function.dtd     log4j.dtd                rule.dtd     rule.xml
在这里我主要介绍配置  amoeba.xml、    dbServers.xml、 log4j.xml 三个主要的配置文件,其它文件没有特殊需要默认就可以了夺
4:vi amoeba.xml 修改主配置文件
4.1)把默认端口8066改成3306
3066
4.2)把默认连接用户名和密码改成自己的
sky

                                                                                123456
4.3)把默认的客户端线程数,请求数及服务端回应数改成200,300,300
200

                                               
                                                300

                                               
                                                300
4.4)把默认注释掉的读写分离选项,把注释去掉并readpool修改成server2

                                server1
                                server2

                                    
 5:vi dbServers.xml 增加SEVER2模块,里面的连接用户名密码及地址都表示两台MYSQL的物理机器,192.168.1.11和192.168.1.13 另SERVER1是写,SERVER是读
需要手动增加SERVER2代码如下:
 

   

      ${defaultManager}

      64

      128

        

     

      3306

       

     

      test

       

     

      root

       

     

      123456

   

 

   

      500

      500

      10

      600000

      600000

      true

      true

   

 

 

 

   

     

      192.168.2.11

   

 


最终改变成如下:

 

 

   

    

 

   

      ${defaultManager}

      64

      128

        

     

      3306

       

     

      test

       

     

      root

       

     

      123456

   

 

   

      500

      500

      10

      600000

      600000

      true

      true

   

 

 

 

   

     

      192.168.2.11

   

 

 

 

     

 

 

 

   

      ${defaultManager}

      64

      128

        

     

      3306

       

     

      test

       

     

      root

       

      123456

   

 

   

      500

      500

      10

      600000

      600000

      true

      true

   

 

 

 

   

     

      192.168.2.13

   

 


 

   

     

      1

       

     

      server1

   

 

    

 

6:修改log4j.xml 取消日志文件生成(太大了,磁盘很容易满)

改成

7:性能优化,打开bin/amoeba

DEFAULT_OPTS="-server -Xms256m -Xmx256m -Xss128k"
改成
DEFAULT_OPTS="-server -Xms512m -Xmx512m -Xmn100m -Xss1204k"
8:启动amoeba
nohup /usr/local/amoeba/bin/amoeba start 2>&1 >/dev/null &

 


本文出自 “Intelligence” 博客

bitsCN.com
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How do you alter a table in MySQL using the ALTER TABLE statement?How do you alter a table in MySQL using the ALTER TABLE statement?Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

How do I configure SSL/TLS encryption for MySQL connections?How do I configure SSL/TLS encryption for MySQL connections?Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

How do you handle large datasets in MySQL?How do you handle large datasets in MySQL?Mar 21, 2025 pm 12:15 PM

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

How do you drop a table in MySQL using the DROP TABLE statement?How do you drop a table in MySQL using the DROP TABLE statement?Mar 19, 2025 pm 03:52 PM

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

How do you represent relationships using foreign keys?How do you represent relationships using foreign keys?Mar 19, 2025 pm 03:48 PM

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)?How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)?Mar 18, 2025 pm 12:00 PM

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)

How do you create indexes on JSON columns?How do you create indexes on JSON columns?Mar 21, 2025 pm 12:13 PM

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software