首页 文章 精选 留言 我的

精选列表

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

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 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册