首页 文章 精选 留言 我的

精选列表

搜索[保险反欺诈],共7941篇文章
优秀的个人博客,低调大师

Nginx反代MySQL案例

案例:一个朋友要用Nginx代理MySQL(MySQL局域网),不用×××,不用NAT映射等,好吧,做个笔记。 Nginx版本:1.9.x(持tcp的负载均衡,nginx_tcp_proxy_module(姚伟斌阿里团队也可以实现)) Nginx官方模块:ngx_stream_core_module --with-stream_ssl_module(ssl协议支持,比如MySQL ssl) 官网:http://nginx.org/en/docs/stream/ngx_stream_core_module.html 1、查看现有编译 --user=nginx--group=nginx--prefix=/usr/local/nginx--with-http_stub_status_module--with-http_ssl_module--with-http_realip_module--with-http_flv_module--with-http_mp4_module--with-http_gzip_static_module 2、重新编译: http://nginx.org/download/ --user=nginx--group=nginx--prefix=/usr/local/nginx--with-http_stub_status_module--with-http_ssl_module--with-http_realip_module--with-http_flv_module--with-http_mp4_module--with-http_gzip_static_module--with-stream--with-stream_ssl_module 注意:--with-stream --with-stream_ssl_module 3、配置、检测、重启nginx: 配置: stream{ upstreammysql{ zonemyapp164k; serverlocalhost:3306weight=1max_fails=3fail_timeout=30s; #server192.168.1.221:3306weight=1max_fails=2fail_timeout=30s; } server{ listen2188; proxy_connect_timeout1s; proxy_timeout3s; proxy_passmysql; } } 检测: [root@autoCentos67X64conf]#nginx-t nginx:theconfigurationfile/usr/local/nginx/conf/nginx.confsyntaxisok nginx:configurationfile/usr/local/nginx/conf/nginx.conftestissuccessful [root@autoCentos67X64conf]# 启动: [root@autoCentos67X64conf]#netstat-atupn|grepnginx tcp000.0.0.0:21880.0.0.0:*LISTEN2359/nginx [root@autoCentos67X64conf]# 4、验证:(转载请保留:renzhiyuan.blog.51cto.com) [root@log~]#mysql-uroot-prenzhiyuan-h192.168.1.11-P2188 WelcometotheMySQLmonitor.Commandsendwith;or\g. YourMySQLconnectionidis3 Serverversion:5.6.21-logMySQLCommunityServer(GPL) Copyright(c)2000,2013,Oracleand/oritsaffiliates.Allrightsreserved. OracleisaregisteredtrademarkofOracleCorporationand/orits affiliates.Othernamesmaybetrademarksoftheirrespective owners. Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement. mysql> 注意:2188可是Nginx的端口,代理(负载)后端的MySQL。其它玩法大家可自己研究。

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

用户登录
用户注册