美文网首页
telegraf连接influxdb提示:connection

telegraf连接influxdb提示:connection

作者: GUIN蚂蚁 | 来源:发表于2019-10-21 16:34 被阅读0次

    telegraf和influxdb都是运行在docker 上面,influxdb没有显示http链接信息,以下是telegraf的日志:

    # docker run -v /root/telegraf:/etc/telegraf/telegraf.conf -v /var/run:/var/run telegraf
    
    2019-10-21T08:30:30Z I! Starting Telegraf 1.12.3
    2019-10-21T08:30:30Z I! Using config file: /etc/telegraf/telegraf.conf
    2019-10-21T08:30:30Z I! Loaded inputs: diskio kernel mem processes swap system cpu disk
    2019-10-21T08:30:30Z I! Loaded aggregators: 
    2019-10-21T08:30:30Z I! Loaded processors: 
    2019-10-21T08:30:30Z I! Loaded outputs: influxdb
    2019-10-21T08:30:30Z I! Tags enabled: host=d73cf0686f67
    2019-10-21T08:30:30Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"d73cf0686f67", Flush Interval:10s
    2019-10-21T08:30:30Z W! [outputs.influxdb] when writing to [http://127.0.0.1:8086]: database "telegraf" creation failed: Post http://127.0.0.1:8086/query: dial tcp 127.0.0.1:8086: connect: connection refused
    2019-10-21T08:30:50Z E! [outputs.influxdb] when writing to [http://127.0.0.1:8086]: Post http://127.0.0.1:8086/write?consistency=any&db=telegraf: dial tcp 127.0.0.1:8086: connect: connection refused
    2019-10-21T08:30:50Z E! [agent] Error writing to outputs.influxdb: could not write any address
    2019-10-21T08:31:00Z E! [outputs.influxdb] when writing to [http://127.0.0.1:8086]: Post http://127.0.0.1:8086/write?consistency=any&db=telegraf: dial tcp 127.0.0.1:8086: connect: connection refused
    2019-10-21T08:31:00Z E! [agent] Error writing to outputs.influxdb: could not write any address
    2019-10-21T08:31:10Z E! [outputs.influxdb] when writing to [http://127.0.0.1:8086]: Post http://127.0.0.1:8086/write?consistency=any&db=telegraf: dial tcp 127.0.0.1:8086: connect: connection refused
    2019-10-21T08:31:10Z E! [agent] Error writing to outputs.influxdb: could not write any address
    
    

    为什么telegraf一直请求不到influxdb呢?这个煞笔问题我自己的锅,改一下telegraf配置ip地址就好了。
    因为两个服务都是在在docker上运行的,所以telegraf请求的ip地址不能填localhost或者127.0.0.1。
    需要填docker分配的地址或者本机的ip地址,建议选后者。

    相关文章

      网友评论

          本文标题:telegraf连接influxdb提示:connection

          本文链接:https://www.haomeiwen.com/subject/magtvctx.html