Get the App
SLTechnology News&Howtos  ›  Database  › 

How to build oneproxy in Mysql

Shulou Source: shulou.com Published: 2022-05-31 14:04:16 10月05日 Update

Editor to share with you how to build oneproxy in Mysql, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

1 download

Official website: http://www.onexsoft.cn/software/step_into_oneproxy.pdf

2 installation

The machine is limited. Oneproxy is installed on 192.168.1.6.

192.168.1.6 oneproxy-main

192.168.1.56 Mustang-from

(3) simple read-write separation

Insert data: [chenliang@hostnfsd oneproxy] $mysql-utestuser-ptestuser-h292.168.1.6-- port=3308-e "insert into test2 (id) values (4)" testbak

Warning: Using a password on the command line interface can be insecure.

[chenliang@hostnfsd oneproxy] $mysql-utestuser-ptestuser-h292.168.1.6-- port=3308-e "select * from test2" testbak

Warning: Using a password on the command line interface can be insecure.

+-+ +

| | id | name |

+-+ +

| | 1 | NULL |

| | 2 | NULL |

| | 3 | 4 |

+-+ +

Successfully inserted into the main library

Read the load balancing test:

[chenliang@hostnfsd oneproxy] $mysql-utestuser-ptestuser-h292.168.1.6-- port=3308-e "select * from test2" group1

Warning: Using a password on the command line interface can be insecure.

+-+ +

| | id | name |

+-+ +

| | 1 | NULL |

| | 2 | NULL |

| | 3 | 4 |

+-+ +

[chenliang@hostnfsd oneproxy] $mysql-utestuser-ptestuser-h292.168.1.6-- port=3308-e "select * from test2" group1

Warning: Using a password on the command line interface can be insecure.

+-+

| | id |

+-+

| | 1 |

| | 2 |

+-+

[chenliang@hostnfsd oneproxy] $mysql-utestuser-ptestuser-h292.168.1.6-- port=3308-e "select * from test2" group1

Warning: Using a password on the command line interface can be insecure.

+-+ +

| | id | name |

+-+ +

| | 1 | NULL |

| | 2 | NULL |

| | 3 | 4 |

+-+ +

[chenliang@hostnfsd oneproxy] $mysql-utestuser-ptestuser-h292.168.1.6-- port=3308-e "select * from test2" group1

Warning: Using a password on the command line interface can be insecure.

+-+

| | id |

+-+

| | 1 |

| | 2 |

+-+

Read load balancer and distribute it to each library

Multi-user:

[root@hostnfsd: / usr/local/oneproxy] $vi demo.sh

# / bin/bash

#

Export ONEPROXY_HOME=/usr/local/oneproxy

# valgrind-- leak-check=full\

${ONEPROXY_HOME} / bin/oneproxy-- keepalive\

-- proxy-address=192.168.1.6:3308\

-- admin-address=192.168.1.6:4041\

-- proxy-master-addresses=192.168.1.6:3307@group1\

-- proxy-slave-addresses=192.168.1.56:3307@group1\

-- proxy-user-list=testuser/950434F7872CB57A600E1B2B7237766FA7E95460@testbak\

-- proxy-user-list=jonn/950434F7872CB57A600E1B2B7237766FA7E95460@testbak2\-it's just that the default database specified by the user is different.

-- proxy-group-policy=group1:Read-balance\

-- proxy-charset=utf8_chinese_ci\

-- log-file=$ {ONEPROXY_HOME} / oneproxy.log\

-- pid-file=$ {ONEPROXY_HOME} / oneproxy.pid

Test:

[root@hostnfsd: / root] $mysql-ujonn-ptestuser-h292.168.1.6-port=3308-e "select * from test2" group1-read-write separation

Warning: Using a password on the command line interface can be insecure.

+-+

| | id |

+-+

| | 106 |

+-+

[root@hostnfsd: / root] $mysql-ujonn-ptestuser-h292.168.1.6-- port=3308-e "select * from test2" group1

Warning: Using a password on the command line interface can be insecure.

+-+

| | id |

+-+

| | 56 |

+-+

[root@hostnfsd: / root] $mysql-ujonn-ptestuser-h292.168.1.6-- port=3308-e "select * from test2" group1

Warning: Using a password on the command line interface can be insecure.

+-+

| | id |

+-+

| | 106 |

+-+

[root@hostnfsd: / root] $mysql-ujonn-ptestuser-h292.168.1.6-- port=3308-e "insert into test2 values" group1-insert the main library

Warning: Using a password on the command line interface can be insecure.

[root@hostnfsd: / root] $mysql-ujonn-ptestuser-h292.168.1.6-- port=3308-e "select * from test2" group1

Warning: Using a password on the command line interface can be insecure.

+-+

| | id |

+-+

| | 56 |

+-+

[root@hostnfsd: / root] $mysql-ujonn-ptestuser-h292.168.1.6-- port=3308-e "select * from test2" group1

Warning: Using a password on the command line interface can be insecure.

+-+

| | id |

+-+

| | 106 |

| | 111 |

+-+

[root@hostnfsd: / root] $mysql-ujonn-ptestuser-h292.168.1.6-- port=3308-e "select * from test2" group1

Warning: Using a password on the command line interface can be insecure.

+-+

| | id |

+-+

| | 56 |

+-+

[root@hostnfsd: / root] $mysql-ujonn-ptestuser-h292.168.1.6-- port=3308-e "select * from test2" group1

Warning: Using a password on the command line interface can be insecure.

+-+

| | id |

+-+

| | 106 |

| | 111 |

These are all the contents of the article "how to build oneproxy in Mysql". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Balance articles content data users testing different successful not so much most databases more limited machines knowledge just industry information information channels channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Shulou Tech Info Microsoft Shulou Information Redmi