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
如此 配置生效,问题解决