一、场景:
sql server数据库服务器没有公网IP地址,只有内网IP,开发工程师需要使用Microsoft SQL Server Management Studio 18工具远程连接数据库。
二、解决方案:
在centos服务器里边,安装haproxy,通过haproxy来转发sql server数据库端口,实现开发工程师远程连接数据库。
三、具体步骤:
1、安装haproxy
yum install -y haproxy
2、配置连接sql server
/etc/haproxy/haproxy.cfg配置文件内容如下
global
maxconn 1500
nbproc 1
daemon
defaults
mode tcp
retries 3
option abortonclose
maxconn 32000
timeout connect 300000ms
timeout client 300000ms
timeout server 300000ms
log 127.0.0.1 local0 err
listen sqlDB_01
bind 0.0.0.0:1544
mode tcp
#balance source
server s1 172.16.1.10:1544 weight 1 maxconn 2000 inter 60s
3、启动
systemctl start haproxy