Nginx tcp proxy module试用
前文Nginx TCP Proxy模块的编译安装描述了如何编译tcp proxy module。现在来实验一下如何用。
首先要创建一个日志目录,因为t该模块的日志默认不在/var/log/nginx目录下
check syntax: *check interval=milliseconds [fall=count] [rise=count] [timeout=milliseconds] [type=tcp|ssl_hello|smtp|mysql|pop3|imap]* default: *none, if parameters omitted, default parameters are interval=30000 fall=5 rise=2 timeout=1000* context: *upstream* description: Add the health check for the upstream servers. At present, the check method is a simple tcp connect. The parameters' meanings are: * *interval*: the check request's interval time. * *fall*(fall_count): After fall_count check failures, the server is marked down. * *rise*(rise_count): After rise_count check success, the server is marked up. * *timeout*: the check request's timeout. * *type*: the check protocol type: 1. *tcp* is a simple tcp socket connect and peek one byte. 2. *ssl_hello* sends a client ssl hello packet and receives the server ssl hello packet. 3. *http* sends a http request packet, receives and parses the http response to diagnose if the upstream server is alive. 4. *smtp* sends a smtp request packet, receives and parses the smtp response to diagnose if the upstream server is alive. The response begins with '2' should be an OK response. 5. *mysql* connects to the mysql server, receives the greeting response to diagnose if the upstream server is alive. 6. *pop3* receives and parses the pop3 response to diagnose if the upstream server is alive. The response begins with '+' should be an OK response. 7. *imap* connects to the imap server, receives the greeting response to diagnose if the upstream server is alive.