MySQL深刻利用Ameoba實現讀寫分離

3 ameoba安裝配置 java

 

3.1 安裝配置JDK node

[root@stu15 ~]# rpm -ivh jdk-7u67-linux-x64.rpm mysql

[root@stu15 ~]# cd /usr/java/ linux

 

修改環境變量 sql

 

[root@stu15 ~]# vim /etc/profile.d/java.sh 數據庫

[root@stu15 ~]# cat /etc/profile.d/java.sh vim

export JAVA_HOME=/usr/java/latest 後端

export PATH=$JAVA_HOME/bin:$PATH 測試

#即時生效配置文件 ui

[root@stu15 ~]# . /etc/profile.d/java.sh

測試:執行java -version,正確的話應該會顯示:

[root@stu15 ~]# java -version

java version "1.7.0_67"

Java(TM) SE Runtime Environment (build 1.7.0_67-b01)

Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

 

lftp 172.16.0.1:/pub/Sources/6.x86_64/amoeba>

[root@node15 ~]# mkdir /usr/local/amoeba

[root@node15 ~]# tar xf amoeba-mysql-binary-2.2.0.tar.gz -C /usr/local/amoeba

 

 

 

[root@node15 amoeba]# bin/amoeba start

 

The stack size specified is too small, Specify at least 228k

Error: Could not create the Java Virtual Machine.

Error: A fatal exception has occurred. Program will exit.

#解決方法

[root@node15 bin]# pwd

/usr/local/amoeba/bin

DEFAULT_OPTS="-server -Xms256m -Xmx256m -Xss516k"

 

 

 

 

 

 

 

 

[root@node15 amoeba]# bin/amoeba start

 

 

3.4 使用驗證

 

# 登陸驗證

[root@node15 ~]# mysql -h127.0.0.1 -uroot -p -P3306

mysql> show master status;

+------------------+----------+--------------+------------------+

| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |

+------------------+----------+--------------+------------------+

| mysql-bin.000003 | 961 | | |

+------------------+----------+--------------+------------------+

1 row in set (0.06 sec)

 

 

測試讀寫分離:

在安裝的amoea的節點node15上,建立一個數據庫,分別查看後端節點master(node16),slave(node17)的全部數據庫:

mysql> create database amoeba_test;

Query OK, 1 row affected (0.11 sec)

 

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| amoeba_test |

| mysql |

| performance_schema |

| test |

+--------------------+

5 rows in set (0.00 sec)

 

[root@node17 ~]# mysql

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| performance_schema |

| test |

+--------------------+

4 rows in set (0.07 sec)

 

 

# 從amoeba接口登陸建立數據庫amoeba_test後,再從主庫的接口中去查詢數據庫已建立,說明寫入確實是落在了主庫節點上;

# 若要驗證ameoba對於讀操做的調度,則須要暫時中止從庫的複製操做,而後在主庫上更新數據,這樣從ameoba讀取數據將出現

相關文章
相關標籤/搜索