How to feal KV Configuration Changes in Real Time

At present, every time the kv configuration is modified in the UI interface, the service must be restarted to obtain new configuration information. Is there any way to immediately sense the changed configuration without restarting?

Hi @tangaopeng,

Welcome to the HashiCorp Forums!

You can use the consul-template project to achieve what you are looking for.

The following Learn Guide shows a complete example of how configuration is rendered and service is restarted.

You can combine this with the KV example here: Service Configuration with Consul Template | Consul - HashiCorp Learn

I hope this helps.

Hi @tangaopeng,

How is your service obtaining its configuration from Consul?

You can either use consul-template, as @Ranjandas suggested, or if your application is directly accessing the Consul API you can use blocking queries to be notified when a KV is updated.