Trivial question w.r.t. 'apigateway'

145 views
Skip to first unread message

singh....@gmail.com

unread,
Jun 30, 2017, 10:52:41 PM6/30/17
to Go kit
Hello All, 

I am an absolute noob at micro-service, so please be kind.

After working through other examples I wanted to understand how to get 'consul' to work my micro-service. I tried to closely follow 'apigateway' example. Except that when doing Curl via command line, it kept giving me "no endpoints available" error. So I stepped out of my code tried compiling apigateway example. Here is my output and the step I have taken

-- Terminal #1 : Run consul as follows 
  consul agent -dev

==> Starting Consul agent...
==> Consul agent running!
           Version: 'v0.8.4'
           Node ID: 'cb1f6030-a220-4f92-57dc-7baaabdc3823'
         Node name: 'thisbeit'
        Datacenter: 'dc1'
            Server: true (bootstrap: false)
       Client Addr: 127.0.0.1 (HTTP: 8500, HTTPS: -1, DNS: 8600)
      Cluster Addr: 127.0.0.1 (LAN: 8301, WAN: 8302)
    Gossip encrypt: false, RPC-TLS: false, TLS-Incoming: false

==> Log data will now stream in as it occurs:

    2017/06/30 22:47:06 [DEBUG] Using unique ID "cb1f6030-a220-4f92-57dc-7baaabdc3823" from host as node ID
...
..
...
2017/06/30 22:51:54 [DEBUG] http: Request GET /v1/health/service/stringsvc?passing=1 (63.272µs) from=127.0.0.1:57466


-- Terminal #2 : 
  go build apigateway.go
  ./main -consul.addr :8500
ts=2017-07-01T02:47:47.467376008Z caller=instancer.go:43 service=addsvc tags=[] instances=0
ts=2017-07-01T02:47:47.468086306Z caller=instancer.go:43 service=stringsvc tags=[] instances=0
ts=2017-07-01T02:47:47.468230827Z caller=main.go:159 transport=HTTP addr=:8000


-- Terminal #3 : 
  curl -XPOST -d'{"s":"cubes"}' http://localhost:8000/stringsvc/count 
OR
  curl -XPOST -d'{"s":"cubes"}' http://localhost:8000/stringsvc/uppercase


Both lines on terminal #3 report the following error : 
no endpoints available (previously: no endpoints available; no endpoints available)




Please help me. What am I missing?

Thank you,
Mayank


Peter Bourgon

unread,
Jul 1, 2017, 10:22:39 AM7/1/17
to singh....@gmail.com, Go kit
Are you actually running any stringsvc instances?
> --
> You received this message because you are subscribed to the Google Groups
> "Go kit" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to go-kit+un...@googlegroups.com.
> To post to this group, send email to go-...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/go-kit/142969ee-5f0c-4f5e-8b13-9ed58c480076%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

singh....@gmail.com

unread,
Jul 1, 2017, 4:29:12 PM7/1/17
to Go kit, singh....@gmail.com, pe...@bourgon.org
Hi Peter, 

Thank you for the quick reply.

This is rather embarrassing ..

1. For my own example code, yes, I was running server/client/consul .. and then curl 

My client code keeps returning 'no endpoint found'. 

2. For 'apigateway' .. the answer (embarrassingly) is no. 
I just executed the code shown in my post. 
So help me here, how do I run server such that it can handle my curl request.
I ought to adapt the stringsvc example and write one of my own?


I think my knowledge is falling short here on how to use 'consul', with load-balancing.
I understand you are busy, if you have any pointers for me to read/code, please let me know.

Thank you,
Mayank

singh....@gmail.com

unread,
Jul 1, 2017, 8:38:20 PM7/1/17
to Go kit, singh....@gmail.com, pe...@bourgon.org
Peter .... I got it working. Thank you.
Your terse comment send me hunting in the right direction.

I will post update on my git repo soon.

Thank you again .. for Go-Kit! :)

Peter Bourgon

unread,
Jul 2, 2017, 5:29:13 AM7/2/17
to singh....@gmail.com, Go kit

kafr...@gmail.com

unread,
Mar 10, 2018, 3:11:03 PM3/10/18
to Go kit

I also encountered the same problem. How can I solve it?

在 2017年7月2日星期日 UTC+8上午8:38:20,singh....@gmail.com写道:
Reply all
Reply to author
Forward
0 new messages