unable to update a service entry using register api

270 views
Skip to first unread message

Kunal Pariani

unread,
Mar 3, 2016, 6:45:27 PM3/3/16
to Consul
Hello,
I seem to be getting this weird error while trying to update the address of an existing service with consul. Any ideas ? My JSON looks 

root@LB-demo:~# curl -X POST --data config.json http://localhost:8500/v1/catalog/register
Request decode failed: invalid character 'c' looking for beginning of value
root@LB-demo:~#
root@LB-demo:~#
root@LB-demo:~# cat config.json {
  "services": [
    {
      "id": "service1",
      "name": "service1",
      "address": "172.17.0.5"
    }
  ]
}

Also is there a way to specify this address ("address": "172.17.0.5") while specifying the service definition in my docker-compose.yml file ?

Thanks

Michael Daffin

unread,
Mar 5, 2016, 3:10:42 PM3/5/16
to Consul

Your problem is you are sending a post request with 'config.json' as the body not the contents of that file. I believe in order to tell curl to read the file prefix it with an @

curl -X POST --data @config.json http://localhost:8500/v1/catalog/register

However you may hit another problem. Recently I was trying to do something similar, register a check remotely using catalog/register end point and although the request worked and the check registered with a few seconds the agent anti entropy kick in and removed the check. I think you will find a similar issue as with the IP address reverting to what the agent was configured with.


--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/consul/issues
IRC: #consul on Freenode
---
You received this message because you are subscribed to the Google Groups "Consul" group.
To unsubscribe from this group and stop receiving emails from it, send an email to consul-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/consul-tool/40a9da87-37c0-4a2c-986e-24d1948e8926%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

James Phillips

unread,
Mar 10, 2016, 9:38:01 PM3/10/16
to consu...@googlegroups.com
Hi guys,

You'll want to register services using the agent API - https://www.consul.io/docs/agent/http/agent.html#agent_service_register. The agent will take care of syncing it up with the catalog for you. In Consul the source of truth about service registrations is with the agents. Hope that helps!

-- James

Kunal Pariani

unread,
Mar 11, 2016, 1:05:19 AM3/11/16
to consu...@googlegroups.com
Thanks for this.

You received this message because you are subscribed to a topic in the Google Groups "Consul" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/consul-tool/hN_tWGYAnZ0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to consul-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/consul-tool/CAGoWc05dqrg6E-48qx3LGUM-VLN7DyN3KhSSjtHVmUM9y-fJpw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages