2018-06-07 consul + consul-template 界面修改配置文件(单文件无需模板)

supervisor 配置文件,指定consul-template 配置文件路径:

[program:consul_template]
command=/md0/consul_template/consul-template -config /md0/consul_template/config.json 
directory=/md0/consul_template/
user=root
autorestart = true
redirect_stderr = true
stdout_logfile = /var/log/consul_template.log
stderr_logfile = /var/log/consul_template_error.log

consul-template 版本:

./consul-template -v
consul-template v0.19.4 (68b1da2)

cat config.json 指定模板为consul界面内容,指定目标文件为/md0/prometheus-2.2.1.linux-amd64/prometheus.yml, 并指定代理服务器地址

consul {
  address = "127.0.0.1:8500"
  ssl {
    enabled = false
    verify = false
  }
}

pid_file = "/var/run/consul-template.pid"
log_level = "DEBUG"

template {   
source = "./prometheus.ctmpl"  
destination = "/md0/prometheus-2.2.1.linux-amd64/prometheus.yml"  
command = "curl -X POST http://localhost:9090/-/reload"  
}

关联 consul kv 界面内容:

{{key "prometheus"}}
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,923评论 18 139
  • 在互联网应用领域,服务的动态性需求十分常见,这就对服务的自动发现和可动态扩展提出了很高的要求。 微服务系统动辄上万...
    Liberalman阅读 8,115评论 23 80
  • 上一篇提到,项目用的分布式服务发现与注册组件是consul,这篇文章主要来讲下consul组件在项目中的应用以及相...
    aoho阅读 11,402评论 1 13
  • 一、安装 Consul Consul 下载地址:https://www.consul.io/downloads.h...
    FlySheep_ly阅读 5,412评论 0 3
  • 打开蓝牙 扫描其他蓝牙设备 查询本地蓝牙适配器的配对蓝牙设备 建立 RFCOMM 通道 通过服务发现连接到其他设备...
    Il_mondo阅读 2,608评论 0 0