Use OneProxy to deploy the read/write splitting of the MySQL database

Source: Internet
Author: User
Experimental System: CentOS6.6 _ x86_64 experimental premise: Firewall and selinux are closed experiment Description: This experiment has a total of 4 hosts, IP allocation such as topology experimental software: mariadb-10.

Experimental System: CentOS 6.6 _ x86_64 experimental premise: Firewall and selinux are closed experiment Description: This experiment has a total of 4 hosts, IP allocation such as topology experimental software: mariadb-10.

Experimental System: CentOS 6.6 _ x86_64
Prerequisites: Firewall and selinux are both disabled.
Tutorial Description: In this experiment, there are a total of four hosts, with IP addresses allocated as topology.
Experimental software: mariadb-10.0.20 oneproxy-rhel5-linux64-v5.6-ga

For details, see:

Baidu online storage download:

------------------------------------------ Split line ------------------------------------------

Free on

Both the user name and password are

The specific download directory is/July 6,/July 6,/July 6,/. Deploy the MySQL database read/write splitting with OneProxy/

For the download method, see

------------------------------------------ Split line ------------------------------------------

Tutorial topology:

Note: This experiment is an extension of the MySQL-Proxy experiment. Therefore, most environments and settings are the same. Steps 1 and 2 are not repeated here. For details, see: use MySQL-Proxy for MySQL database read/write splitting

I. Preparations

Ii. Configure master-slave Replication

3. Install oneproxy

1. In this experiment, 19.79 is the onproxy server, so the software is installed on this host:

Tar xf oneproxy-rhel5-linux64-v5.6-ga.tar.gz-C/usr/local/
Cd/usr/local/oneproxy
Vim demo. sh
---------------------------------------------------------------->
#/Bin/bash
#
Export ONEPROXY_HOME =/usr/local/oneproxy

# Valgrind -- leak-check = full -- show-reachable = yes \
$ {ONEPROXY_HOME}/oneproxy -- keepalive \ // automatically checks and restarts the OneProxy Service
-- Proxy-address = 192.168.19.79: 3306 // The first listening address of the Proxy Server
-- Admin-address = 192.168.19.79: 4041 // manage the port address
-- Proxy-master-addresses = 192.168.19.66: 3306 @ server1 \ // address of the Master node (which can be written to the node), where @ is followed by the name of "Server Group". If not specified, the default value is "default"
-- Proxy-slave-addresses = 192.168.19.74: 3306 @ server1 \ // Slave Node Address (read node)
-- Proxy-slave-addresses = 192.168.19.76: 3306 @ server1 \
-- Proxy-user-list = test/14B1772BA9874974E6ECEA0745EE774930E2EFA3 \ // Proxy user list (user Name/password). After completing step 2, you can return to the configuration.
-- Proxy-part-tables =$ {ONEPROXY_HOME}/part.txt \
-- Proxy-found-rows \
-- Event-threads = 4 \ // Number of worker threads of OneProxy
-- Proxy-group-policy = server1: 2 \ // defines the routing access policy of the MySQL cluster. The configuration here is to read from the Slave. If the Slave end is unavailable, read from the Master.
-- Proxy-group-security = server1: 0 // defines the security access policy of the MySQL Cluster
-- Proxy-memory-db = root/@: test \
-- Proxy-memory-engine \
-- Proxy-SQL-autosave =$ {ONEPROXY_HOME}/SQL _firewall. SQL \
-- Log-file =$ {ONEPROXY_HOME}/oneproxy. log \
-- Pid-file =$ {ONEPROXY_HOME}/oneproxy. pid

2. View and configure the password characters:

Chmod + x demo. sh
./Demo. sh
Mysql-uadmin-pOneProxy-h192.168.19.79 -- port = 4041 // enter the Management Interface
-------------------------------------------------------------------->
Passwd 'redhat'; // view the password and write it to demo. sh.
+ -------- + ------------------------------------------ +
| TEXT | PASSWORD |
+ -------- + ------------------------------------------ +
| Redhat | 14B1772BA9874974E6ECEA0745EE774930E2EFA3 |
+ -------- + ------------------------------------------ +

3. Create a test user on the master:

/Usr/local/mysql/bin/mysql
----------------------------------------------->
Grant all on *. * TO 'test' @ '192. 192.% 'identified by 'redhat'; // The Proxy user list information in demo. sh must be consistent.
Flush privileges;

4. Return to the oneproxy server to start the process:

Killall-9 oneproxy // clear the previous process first
./Demo. sh
Tail-f oneproxy. log // view the log

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.