Server-mysql5.6 read/write splitting problems

Source: Internet
Author: User
When doing read and write separation again, this is okay [root @ proxymysql-proxy] # mysql-proxy -- daemon -- pluginsproxy -- log-leveldebug -- log-filevarlogmysql-proxy.log -- proxy-read-only-backend-addresses192.168.85.145: 3306 -- proxy-backend-addresses192.168.85.144: 3306 -- proxy-lua... mysql server

When performing read/write splitting, it is okay.
[Root @ proxy mysql-proxy] # mysql-proxy -- daemon -- plugins = proxy -- log-level = debug -- log-file =/var/log/mysql-proxy.log -- proxy-read- only-backend-addresses = 192.168.85.145: 3306 -- proxy-backend-addresses = 192.168.85.144: 3306 -- proxy-lua-script =/usr/local/mysql-proxy/share/doc/mysql-proxy/rw-splitting.lua -- plugins = admin -- admin-username = admini -- admin-password = admini -- admin-lua-script =/usr/local/mysql-proxy/share/doc/mysql-proxy/admin. lua

Whether it is Port 4041 or port 4040, you can log on to and add backend servers. The log shows:
[Root @ proxy mysql-proxy] # tail/var/log/mysql-proxy.log
2015-12-31 10: 50: 41: (critical) plugin proxy 0.8.5 started
2015-12-31 10: 50: 41: (critical) plugin admin 0.8.5 started
2015-12-31 10: 50: 41: (debug) max open file-descriptors = 1024
2015-12-31 10: 50: 41: (message) proxy listening on port: 4040
10: 50: 41: (message) added read/write backend: 192.168.85.144: 3306
10: 50: 41: (message) added read-only backend: 192.168.85.145: 3306
2015-12-31 10: 50: 41: (message) admin-server listening on port: 4041

But it is not very troublesome to write this way. I just want to write a configuration file and start mysql-proxy by reading the settings in the configuration file, but Port 4040 cannot be started anyway.

Content of the first configuration file:
[Root @ proxy ~] # Cat/etc/mysql-proxy.conf
[Mysql-proxy]
Pid-file =/var/run/mysql-proxy.pid
Log-file =/var/log/mysql-proxy.log
Log-level = debug
Plugins = admin
Plugins = proxy
#
# Proxy Configuration
User = proxy
Proxy-address = 192.168.85.128: 4040
Proxy-backend-addresses = 192.168.85.144: 3306
Proxy-read-only-backend-addresses = 192.168.85.145: 3306
Proxy-lua-script =/usr/local/mysql-proxy/share/doc/mysql-proxy/rw-splitting.lua
#

Admin Configuration

Admin-username = admini
Admin-password = admini
Admin-lua-script =/usr/local/mysql-proxy/share/doc/mysql-proxy/admin. lua

Then mysql-proxy -- daemon -- defaults-file =/etc/mysql-proxy.conf

Logs at this time:
2016-01-01 16: 28: 09: (critical) plugin proxy 0.8.5 started
2016-01-01 16: 28: 09: (debug) max open file-descriptors = 1024
2016-01-01 16: 28: 09: (message) proxy listening on port 192.168.85.128: 4040
16: 28: 09: (message) added read/write backend: 192.168.85.144: 3306
16: 28: 09: (message) added read-only backend: 192.168.85.145: 3306
16: 28: 09: (debug) now running as user: proxy (496/493)
The backend servers are also added. Port 4040 is enabled and can be logged on normally, but Port 4041 is not enabled;

Then, I changed the configuration file (in fact, the bit of the proxy and admin plug-ins is replaced)
The second configuration file content:
[Mysql-proxy]
Pid-file =/var/run/mysql-proxy.pid
Log-file =/var/log/mysql-proxy.log
Log-level = debug
Plugins = proxy
Plugins = admin
#
# Proxy Configuration
User = proxy
Proxy-address = 192.168.85.128: 4040
Proxy-backend-addresses = 192.168.85.144: 3306
Proxy-read-only-backend-addresses = 192.168.85.145: 3306
Proxy-lua-script =/usr/local/mysql-proxy/share/doc/mysql-proxy/rw-splitting.lua
# Proxy-skip-profiling = true
#

Admin Configuration

# Admin-address = 0.0.0.0: 4041
Admin-username = admini
Admin-password = admini
Admin-lua-script =/usr/local/mysql-proxy/share/doc/mysql-proxy/admin. lua

Logs after restart:
2016-01-01 16: 33: 35: (critical) plugin admin 0.8.5 started
2016-01-01 16: 33: 35: (debug) max open file-descriptors = 1024
2016-01-01 16: 33: 35: (message) admin-server listening on port: 4041
16: 33: 35: (debug) now running as user: proxy (496/493)
In this case, not only port 4040 is not opened, but the server is not added, and only port 4041 is on;

No matter how I change the configuration file in the future, as long as the plugins = admin option is followed by plugins = proxy, the second situation is that only port 4041 is enabled, and Port 4040 is enabled only for the first configuration file, in addition, ports 4040 and 4041 cannot be enabled simultaneously;

How can I open ports 4040 and 4041 and add them to backend servers? Or am I wrong about the configuration file?

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.