• MySQL深入利用Ameoba实现读写分离


    3 ameoba安装配置

     

    3.1 安装配置JDK

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

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

     

    修改环境变量

     

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

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

    export JAVA_HOME=/usr/java/latest

    export PATH=$JAVA_HOME/bin:$PATH

    #即时生效配置文件

    [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读取数据将出现

  • 相关阅读:
    NSURL 的简单实用
    动画demo
    UIScrollView的简单页面
    关于UITableview(更新)
    添加手势
    多线程
    IOS 瀑布流
    高低字节序转换(htonl、ntohl、htons、ntohs函数)
    Xcode个版本
    网址
  • 原文地址:https://www.cnblogs.com/na2po2lun/p/4271036.html
Copyright © 2020-2023  润新知