Nginx代理Oracle数据库连接

开始

使用本地1500端口反向代理 10.120.1.78:9800 得Oracle连接。

nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# stream 代理,代理oracle连接
stream {
log_format proxy '$remote_addr [$time_local] '
'$protocol $status $bytes_sent $bytes_received '
'$session_time "$upstream_addr" '
'"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"';

access_log logs/tcp-access.log proxy ;
error_log logs/tcp_error.log;

upstream oracle{
server 10.120.1.78:9800 weight=1 max_fails=2 fail_timeout=30s;
}
server {
listen 1500 so_keepalive=on; #so_keepalive,会话保持,防止查询飘走;
proxy_connect_timeout 3600s; #设置那么大,是为了防止动不动就断开连接
proxy_timeout 3600s;
proxy_pass oracle;
}
}
作者

zhang

发布于

2022-04-21

更新于

2023-09-19

许可协议

CC BY-NC-SA 4.0

Your browser is out-of-date!

Update your browser to view this website correctly.&npsb;Update my browser now

×