---
title: "sqlrelay 文档"
author: "waveeee"
date: "2011-06-02T16:06:51Z"
tags: []
categories: ["编程语言"]
slug: "sqlrelay"
draft: false
lastmod: "2011-06-03T10:26:42Z"
id: 1068617
url: "https://waveeee.iteye.com/blog/1068617"
---

# 问题由来

### [Update 9/2008](http://www.dottedidesign.com/node/14#comment-481)

Submitted by Joe (not verified) on Sat, 09/27/2008 - 19:47.

You can always query multiple db's on the same server.  
To query multiple db's on different servers with a single query you need to either; combine the tables using federated tables, replication or temporary tables  
In this case you're accessing multiple db's on the same server  
or  
parse the query  
In this case you're splitting the query into two or more queries at the router/proxy server.

This can be done with:

Sql Relay - [http://sqlrelay.sourceforge.net/sqlrelay/router.html](http://sqlrelay.sourceforge.net/sqlrelay/router.html "http://sqlrelay.sourceforge.net/sqlrelay/router.html")

Mysql Proxy - [http://forge.mysql.com/wiki/MySQL\_Proxy](http://forge.mysql.com/wiki/MySQL_Proxy "http://forge.mysql.com/wiki/MySQL_Proxy")

Mysql Federated Storage engine -  
link to an example of a hack for combining multiple db server logs in tables  
[http://www.oreillynet.com/databases/blog/2007/05/hacking\_mysql\_table\_log...](http://www.oreillynet.com/databases/blog/2007/05/hacking_mysql_table_logs.html "http://www.oreillynet.com/databases/blog/2007/05/hacking_mysql_table_logs.html")

You could write your own query filter/proxy using either a plugin or UDF.

Mysql Plugin - [http://dev.mysql.com/doc/refman/5.1/en/plugin-api.html](http://dev.mysql.com/doc/refman/5.1/en/plugin-api.html "http://dev.mysql.com/doc/refman/5.1/en/plugin-api.html")

Mysql UDF - [http://dev.mysql.com/doc/refman/5.0/en/adding-functions.html](http://dev.mysql.com/doc/refman/5.0/en/adding-functions.html "http://dev.mysql.com/doc/refman/5.0/en/adding-functions.html")

» 

- [reply](http://www.dottedidesign.com/comment/reply/14/481)

 

# SQL Relay文档首页（中文翻译）

[http://blog.sina.com.cn/s/blog\_550ffb0b0100lvck.html](http://blog.sina.com.cn/s/blog_550ffb0b0100lvck.html)

# sqlrelay的安装配置和应用

[http://www.okpython.com/viewthread.php?tid=3831](http://www.okpython.com/viewthread.php?tid=3831)

 

 

# SQL Relay + Python

[http://www.docunext.com/blog/2008/07/sql-relay-python.html](http://www.docunext.com/blog/2008/07/sql-relay-python.html)

 

## sqlrelay 的安装配置和应用

[http://www.linuxsir.org/main/node/144](http://www.linuxsir.org/main/node/144)

 

api for python

[http://sqlrelay.sourceforge.net/sqlrelay/programming/python.html](http://sqlrelay.sourceforge.net/sqlrelay/programming/python.html)

 

 

install in freebsd

cd ./databases/py-sqlrelay