upsync_dump_path
Specifies the file path where the upstream server configuration will be dumped.
Description
The upsync_dump_path directive is used within the context of the upstream block in NGINX for configuring upstream server synchronization from external services like Consul or etcd. When upstream servers are dynamically modified via the defined synchronization mechanism, the current server configuration is automatically dumped to the specified path in the file system. This allows for easier management and audit of upstream server settings without the need to reload the entire NGINX configuration. If set, NGINX will write the configuration at the specified file path every time a change is detected in the upstream servers' configuration, ensuring that the latest server settings are accurately recorded and available for future reference or debugging.
The parameter for upsync_dump_path is a string representing the file path to which the configuration will be saved. It is important that the NGINX worker process has permissions to write to the specified path in order to successfully create or overwrite the configuration file at that location. Misconfiguration of file permissions can lead to errors or failure to update, resulting in outdated server configurations and potential downtime.
Config Example
http {
upstream backend {
upsync 127.0.0.1:8500/v1/kv/upstreams/test/ upsync_timeout=6m upsync_interval=500ms;
upsync_dump_path /usr/local/nginx/conf/servers/servers_test.conf;
include /usr/local/nginx/conf/servers/servers_test.conf;
}
server {
listen 80;
location / {
proxy_pass http://backend;
}
}
}Ensure that the NGINX worker process has write permissions to the specified file path.
If the specified path does not exist, NGINX will fail to dump the configuration unless it can create the file; make sure the parent directory exists.
Repeated updates to the file may lead to file descriptor exhaustion if not managed properly.