golang開發的一個mysql串連代理池,支援多種語言用戶端(PHP範例)

來源:互聯網
上載者:User
這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。

golang mysql pool proxy(MPP)

golang開發的一個mysql串連代理池, HTTP返回查詢結果。

特性(迭代更新支援)

  • golang查詢mysql, 支援串連池, HTTP返回資料,通過POST傳遞sql語句 (已實現)

  • 增加了postgre資料庫的支援 (已實現)

  • 支援查詢資料緩衝 (已實現)

  • 支援多種語言(發送POST請求即可) (已實現)

  • 讀寫分離

  • SQL防注入

  • 支援HTTPS (已實現)

  • 考慮支援分布式HTTP server

  • 加入log檔案支援 (已實現)

編譯啟動方式(linux), windows照樣

cd project_path
go build
mv golang_mysql_proxy_pool mpp
./mpp

返回資料類似 {"code":0,"rows":"123@123.com","status":"success"} 的 json 格式

屬性說明

code 0 is for success     1 is for wrong query     2 is for wrong get data     3 is for wrong uukey status success or failrows query data

怎麼使用?

example/mpp_cls.php檔案是PHP語言的用戶端,有目前現有的所有功能的範例,請參考

聯絡詳情可查看github

測試

WIN7, go version go1.4.2 windows/386, PHP 5.6, MYSQL5.6, 1萬條mysql資料 example目錄

沒使用MPP的檔案, php no_use_mpp.php -----Use time: 1.2660720348358-------
使用MPP的檔案, php use_mpp.php -----Use time: 0.26302088737488-------

源碼地址: https://github.com/r00tjimmy/golang_mysql_proxy_pool

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.