【实践】consul中如何禁止updates检查

x33g5p2x  于2021-12-20 转载在 其他  
字(1.3k)|赞(0)|评价(0)|浏览(563)

问题描述:

在使用consul过程中,经常会进行版本检查,日志如下:

==> Failed to check for updates: Get https://checkpoint-api.hashicorp.com/v1/check/consul?arch=amd64&os=linux&signature=33c85560-784e-27cf-802d-6ae0ec8d197f&version=1.1.0: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

如何禁止哪?

解决方案:

在版本v1.0.5之后,提供了新的配置选项disable_update_check 可禁止检查

但仅在企业版中有效

参见

https://github.com/hashicorp/consul/blob/v1.1.0/CHANGELOG.md#105-february-7-2018

方案二:

修改代码

diff --git a/agent/config/flags.go b/agent/config/flags.go
index 3bad0ea..02b8200 100644
--- a/agent/config/flags.go
+++ b/agent/config/flags.go
@@ -70,6 +70,7 @@ func AddFlags(fs *flag.FlagSet, f *Flags) {
        add(&f.Config.Ports.DNS, "dns-port", "DNS port to use.")
        add(&f.Config.DNSDomain, "domain", "Domain to use for DNS interface.")
        add(&f.Config.EnableScriptChecks, "enable-script-checks", "Enables health check scripts.")
+       add(&f.Config.DisableUpdateCheck, "disable_update_check", "Disable consul update check.")
        add(&f.Config.EncryptKey, "encrypt", "Provides the gossip encryption key.")
        add(&f.Config.Ports.HTTP, "http-port", "Sets the HTTP API port to listen on.")
        add(&f.Config.StartJoinAddrsLAN, "join", "Address of an agent to join at start time. Can be specified multiple times.")

相关文章