-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
418 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
#mysql-proxy | ||
简介:mysqlproxy 通过c扩展实现了mysql协议,应用层逻辑用php+swoole编写,业务代码只需要将配置文件的ip和端口改成proxy的ip和端口即可、 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,73 @@ | ||
<?php | ||
|
||
/* | ||
* 是否开启记录日志功能,开启后每次查询都会发送给REDIS_HOST所在的redis,用于生成web管理界面 统计慢查询等 | ||
* 开启后会降低30%左右的性能 | ||
*/ | ||
define("RECORD_QUERY", false); | ||
/* | ||
* 记录客户端sql查询的redis机器 | ||
*/ | ||
define("REDIS_HOST", "127.0.0.1"); | ||
define("REDIS_PORT", "6379"); | ||
|
||
/* | ||
* redis key | ||
*/ | ||
define("REDIS_SLOW", "sqlslow"); | ||
define("REDIS_BIG", "sqlbig"); | ||
|
||
|
||
/* | ||
* swoole table的key | ||
*/ | ||
define("MYSQL_CONN_KEY", "proxy_conn_key"); | ||
define("MYSQL_CONN_REDIS_KEY", "proxy_connection"); | ||
|
||
/* | ||
* 错误码定义 | ||
*/ | ||
define("ERROR_CONN", 10001); | ||
define("ERROR_AUTH", 10002); | ||
define("ERROR_QUERY", 10003); | ||
define("ERROR_PREPARE", 10004); | ||
|
||
// no use | ||
$shequ_test = array( | ||
'chelun' => array(//test is tes db | ||
'master' => array( | ||
'host' => '10.10.1.23', | ||
'port' => 3306, | ||
'user' => 'chelun_test', | ||
'password' => '4OX36HnN', | ||
'database' => 'chelun', | ||
'charset' => 'utf8mb4', | ||
), | ||
'slave' => array( | ||
array( | ||
'host' => '10.10.1.23', | ||
'port' => 3306, | ||
'user' => 'chelun_test', | ||
'password' => '4OX36HnN', | ||
'database' => 'chelun', | ||
'charset' => 'utf8mb4', | ||
), | ||
), | ||
), | ||
'chelun_home' => array(//test is tes db | ||
'master' => array( | ||
'host' => '10.10.1.23', | ||
'port' => 3306, | ||
'user' => 'chelun_test', | ||
'password' => '4OX36HnN', | ||
'database' => 'chelun_home', | ||
'charset' => 'utf8mb4', | ||
), | ||
'slave' => array( | ||
array( | ||
'host' => '10.10.1.23', | ||
'port' => 3306, | ||
'user' => 'chelun_test', | ||
'password' => '4OX36HnN', | ||
'database' => 'chelun_home', | ||
'charset' => 'utf8mb4', | ||
), | ||
), | ||
) | ||
, 'spider' => array(//test is tes db | ||
|
||
/* | ||
* swoole server通用配置信息 | ||
*/ | ||
define("WORKER_NUM", 1); | ||
//task 用于上报查询用 | ||
define("TASK_WORKER_NUM", 1); | ||
//SWOOLE server的 日志 | ||
define("SWOOLE_LOG", "/tmp/sqlproxy.log"); | ||
//是否守护进程方式运行 | ||
define("DAEMON", 0); | ||
//mysql proxy绑定的端口 | ||
define("PORT", "9536"); | ||
|
||
|
||
/* | ||
* mysql数据源配置 | ||
*/ | ||
$config = array( | ||
'eguanjia' => array( | ||
'master' => array( | ||
'host' => '10.10.1.23', | ||
'host' => '10.10.2.73', | ||
'port' => 3306, | ||
'user' => 'chelun_test', | ||
'password' => '4OX36HnN', | ||
'database' => 'spider', | ||
'charset' => 'utf8mb4', | ||
'user' => 'root', | ||
'password' => 'woshiguo35', | ||
'database' => 'eguanjia', | ||
'charset' => 'utf8', | ||
), | ||
'slave' => array( | ||
array( | ||
'host' => '10.10.1.23', | ||
'host' => '10.10.2.73', | ||
'port' => 3306, | ||
'user' => 'chelun_test', | ||
'password' => '4OX36HnN', | ||
'database' => 'spider', | ||
'charset' => 'utf8mb4', | ||
'user' => 'root', | ||
'password' => 'woshiguo35', | ||
'database' => 'eguanjia', | ||
'charset' => 'utf8', | ||
), | ||
), | ||
) | ||
); | ||
define("MYSQL_CONF", $config); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule PHP-X
added at
a2f95f
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1"> | ||
<code-assistance-data xmlns="http://www.netbeans.org/ns/make-project-private/1"> | ||
<code-model-enabled>true</code-model-enabled> | ||
</code-assistance-data> | ||
<data xmlns="http://www.netbeans.org/ns/make-project-private/1"> | ||
<activeConfTypeElem>0</activeConfTypeElem> | ||
<activeConfIndexElem>0</activeConfIndexElem> | ||
</data> | ||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/> | ||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2"> | ||
<group/> | ||
</open-files> | ||
</project-private> |
Oops, something went wrong.