» tagged pages
» logout

(Feed found, click Add Page to syndicate.) Error finding feed, please try again » Find feed title

A Blog Page allows you to add entries, for news or other time sensitive postings

(Login required to save to your tagged pages.)
(or Cancel)

Make further edits, (or Cancel)

(Login required to save to your tagged pages.)
(or Cancel)

(Editing anonymously: to be credited for your changes, login or register a new account)

Change Page Permissions? Changing these permissions will adjust who can modify this page.

Anonymous (change)
(change)
(or Cancel)
Upload an image from your computer:
or Copy an image from a URL:
or Erase the current icon:
Icon Preview:

or Cancel

Erase mysqlproxy? The contents of mysqlproxy page and all pages directly attached to mysqlproxy will be erased.

or Cancel

(Editing anonymously: to be credited for your changes, login or register a new account)

other page actions:
mysqlproxy

mysqlproxy

Tags Applied to mysqlproxy

No one has tagged this page.

mysqlproxy Wiki Pages

Tag Cloud

To further filter what appears in the Things Tagged mysqlproxy list, select a tag from the Tag Cloud.
What is mysqlproxy? Edit this page and describe it here.

sorted by: recent | see : popular
Content Tagged mysqlproxy

Most Commonly Sought-After Command in MySQL Proxy

One of the most frequently needed functionality in the MySQL Proxy is the need to know which server you are on. This is not given, on purpose, by the proxy, because the proxy is supposed to be transparent. It is not supposed to matter which back-end server you are on.

However, for testing purposes we often want to know which back-end server we’re on. Thus I developed functionality for SHOW PROXY BACKEND [INDEX ADDRESS OTHER].

SHOW PROXY BACKEND INDEX — gives the index of the server you’re on (backend_ndx, ie 1)

SHOW PROXY BACKEND ADDRESS — gives the address of the server you’re on (ie, foo.bar.com:3306)

SHOW PROXY BACKEND OTHER — gives the address of all the other servers except those you’re not on, in multiline format.

Note that I was pretty lazy and the commands are case-sensitive. But I figured that since this is supposed to be used mostly in testing circumstances, it did not really matter.

The code is on the MySQL Forge Wiki at http://forge.mysql.com/tools/tool.php?id=139

Interestingly enough, this script is actually being used in production — a site has a primary and failover server, and wants to check that when the primary server is in use, there are no connections on the failover. I wrote that check as well, but as the logic is somewhat particular, I am not sure it would be useful to many. The logic is:

  1. Run SHOW PROXY BACKEND INDEX.
  2. if it fails, I can’t connect to the proxy, log an error, exit.
  3. if it !=1, I’m on the failover server, log a warning, exit.
  4. if it =1, I’m on the primary server.
  5. Run SHOW PROXY BACKEND OTHER.
  6. if it is empty, either I can’t connect to the proxy or there are no failovers defined, log a warning, exit
  7. For each OTHER address, connect to them and find what that connection’s host looks like (sometimes it looks like foo.bar.com:4325, other times it looks like 1.2.3.4:4573). Get the value of “my host” by stripping off the port.
  8. Connect to the OTHER address again, killing off connections from “my host” except for the “system user” and a few other special accounts (replication slave being one of them). Log each kill with the thread number and a warning.
  9. If there are no connections to be killed, log OK.

Let me know if you’d like to see that…it’s a shell script, and it requires the mysql client and bintools like grep and cut.

MySQL: Planet MySQL

~jk MySQL Proxy learns R/W Splitting

Using mysql-proxy and Lua to split read/writes between master/slave DB nodes.

Lua: del.icio.us/tag/lua

MySQL Proxy - MySQLForge Wiki

A simple program that sits between your client and MySQL server(s) that can monitor, analyze or transform their communication.

Lua: del.icio.us/tag/lua

Username:
Password:
(or Cancel)