kong配置調整方式


kong logs/error.log內確實發現大量日志

2021/01/25 16:46:05 [warn] 166110#0: *3522559308 a client request body is buffered to a temporary file /usr/local/kong/client_body_temp/0000015840, client: , server: kong, 

115.238.164.130 - - [25/Jan/2021:16:46:31 +0800] "POST " 502 157 "-" "python-requests/2.9.1"


a client request body is buffered to a temporary file /usr/local/kong/client_body_temp/0000015840, client: , server: kong
該報警要調整nginx 的client_body_buffer_size,默認為client_body_buffer_size 8k|16k;

因為kong是在nginx上封裝的,因此改kong的配置和nginx不完全一樣

按常規思路直接修改konga生成的nginx.conf是不生效的

而kong reload后nginx.conf會被重置

因為kong生成的nginx.conf文件主配置是在kong start時加載 /etc/kong/kong.conf 和一些信息,生成的,因此調整需更改

/etc/kong/kong.conf 調大client_body_buffer_size

client_body_buffer_size = 500k    # Defines the buffer size for reading the
                                 # request body. If the client request body is
                                 # larger than this value, the body will be
                                 # buffered to disk. Note that when the body is
                                 # buffered to disk Kong plugins that access or
                                 # manipulate the request body may not work, so
                                 # it is advisable to set this value as high as
                                 # possible (e.g., set it as high as
                                 # `client_max_body_size` to force request
                                 # bodies to be kept in memory). Do note that
                                 # high-concurrency environments will require
                                 # significant memory allocations to process
                                 # many concurrent large request bodies.

測試 類似 nginx -t

kong check
configuration at /etc/kong/kong.conf is valid

重新加載 類似 nginx -s reload

kong reload

如此 配置生效,問題解決


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM