You are on page 1of 15

MySQL

................................................................................................................................. 2

................................................................................................................................. 2

................................................................................................................................. 3

1 ......................................................................................................... 3

2..................................................................................................................... 4

3................................................................................................................. 4

4..................................................................................................................... 5

5 slave ............................................................................................ 6

6 slave ............................................................................................... 6

7..................................................................................................................... 7

................................................................................................................................. 8

1 amoeba .......................................................................................................... 8

2..................................................................................................................... 8

3........................................................................................................................... 10

4................................................................................................................... 11

............................................................................................................................... 13

............................................................................................................................... 14

1 JVM ................................................................................................................. 14

2 ..................................................................................................................... 15

1
MySQL

MySQL
Master-Slave
amobe

Red Hat Enterprise Linux 6.3 32 MySQL 5.1amobe 3.0.5java1.6



Master IP192.168.1.10 xuel_master_write
Slave IP192.168.1.11 xuel_slave_read
3306 8066 Selinux

2

1
mysql
yum install -y mysql mysql-devel mysql-server
/etc/init.d/mysqld start
chkcofig mysqld on
master mysqlmaster
slave mysqlslave

3
2
mysql
grant all privileges on . to @IP identified by

3
master master_test,
create database ; //
Use ; //
create table //

4
description ; //
Select from //

master

4
master_test
mysql my.cnf

5
server-id = 1 // ID 1
log-bin=mysql-bin //
binlog-do-db=master_test//
binlog-ignore-db=mysql //
master

5 slave
master master_test

slave

6 slave
slave mysql

master_test

6
mysql slave

7
Master master_test

7
slave

Amoeba( MySQL
MySQL MySQL SQL
Database Proxy ClientDB Server(s)
,SQL
jave jdk

1 amoeba
amoeba

8
java-1.6.0 java

amoeba.xml
Amoeba 8066 master

amoeba

pool

dbServers.xml
Master

9
server1 masterserver2 slave

writepool server1readpool server1server2server1


<!Load balancing strategy: 1=ROUNDROBIN , 2=WEIGHTBASED , 3=HA-->
pool HA

java bin/launcher JAVA_HOME=/usr

10

4
master

Slave slave1

11
slave
master slave

12
Master

Slave

13
Master

Slave

1JVM
stack size JVM

14
amoeba-mysql-3.0.5-RC/jvm.properties

JVM_OPTIONS="-server -Xms1024m -Xmx1024m -Xss256k -XX:PermSize=16m -XX:MaxPermSize=


96m"
2
master

slave
mysql> slave stop;
mysql> change master to Master_Log_File='mysql-bin.000002',Master_Log_Pos=106;
mysql> slave start;
mysql> show slave status\G

15