Open sunfmin opened 7 years ago
因为Amazon的Elasticsearch服务限制住了不让这个Lambda访问。设置允许Lambda出口的IP就可以了。
level=info ts=2017-05-16T08:42:54.082644615Z caller=<autogenerated>:1 origin=handler msg="db auto-migration done." 2017/05/16 08:42:54.082861 Connecting to elasticsearch: http://search-dev-xxdsaf2e2rfsdfawer.ap-southeast-1.es.amazonaws.com , ESEnableSniff: false 2017/05/16 08:42:54.129364 (c *Client) startupHealthcheck, err: <nil>, res: "HTTP/1.1 403 Forbidden\r\nContent-Length: 90\r\nConnection: keep-alive\r\nContent-Type: application/json\r\nX-Amzn-Requestid: a733d0f6-3a13-11e7-9696-aba2ea1d59ed\r\n\r\n" 2017/05/16 08:42:55.135005 (c *Client) startupHealthcheck, err: <nil>, res: "HTTP/1.1 403 Forbidden\r\nContent-Length: 90\r\nConnection: keep-alive\r\nContent-Type: application/json\r\nX-Amzn-Requestid: a7cd78eb-3a13-11e7-9696-aba2ea1d59ed\r\n\r\n" 2017/05/16 08:42:56.140572 (c *Client) startupHealthcheck, err: <nil>, res: "HTTP/1.1 403 Forbidden\r\nContent-Length: 90\r\nConnection: keep-alive\r\nContent-Type: application/json\r\nX-Amzn-Requestid: a866d2bc-3a13-11e7-9696-aba2ea1d59ed\r\n\r\n" 2017/05/16 08:42:57.146637 (c *Client) startupHealthcheck, err: <nil>, res: "HTTP/1.1 403 Forbidden\r\nContent-Length: 90\r\nConnection: keep-alive\r\nContent-Type: application/json\r\nX-Amzn-Requestid: a900539d-3a13-11e7-9696-aba2ea1d59ed\r\n\r\n" 2017/05/16 08:42:58.172473 (c *Client) startupHealthcheck, err: <nil>, res: "HTTP/1.1 403 Forbidden\r\nContent-Length: 90\r\nConnection: keep-alive\r\nContent-Type: application/json\r\nX-Amzn-Requestid: a99ce1c3-3a13-11e7-9696-aba2ea1d59ed\r\n\r\n" 2017/05/16 08:42:59.178494 (c *Client) startupHealthcheck, err: <nil>, res: "HTTP/1.1 403 Forbidden\r\nContent-Length: 90\r\nConnection: keep-alive\r\nContent-Type: application/json\r\nX-Amzn-Requestid: aa3662a4-3a13-11e7-9696-aba2ea1d59ed\r\n\r\n" 2017/05/16 08:43:00.184020 (c *Client) startupHealthcheck, err: <nil>, res: "HTTP/1.1 403 Forbidden\r\nContent-Length: 90\r\nConnection: keep-alive\r\nContent-Type: application/json\r\nX-Amzn-Requestid: aacfe389-3a13-11e7-9696-aba2ea1d59ed\r\n\r\n" 2017/05/16 08:43:01.190084 (c *Client) startupHealthcheck, err: <nil>, res: "HTTP/1.1 403 Forbidden\r\nContent-Length: 90\r\nConnection: keep-alive\r\nContent-Type: application/json\r\nX-Amzn-Requestid: ab693d5a-3a13-11e7-9696-aba2ea1d59ed\r\n\r\n" 2017/05/16 08:43:02.196252 (c *Client) startupHealthcheck, err: <nil>, res: "HTTP/1.1 403 Forbidden\r\nContent-Length: 90\r\nConnection: keep-alive\r\nContent-Type: application/json\r\nX-Amzn-Requestid: ac02be3b-3a13-11e7-9696-aba2ea1d59ed\r\n\r\n" 2017/05/16 08:43:03.202325 (c *Client) startupHealthcheck, err: <nil>, res: "HTTP/1.1 403 Forbidden\r\nContent-Length: 90\r\nConnection: keep-alive\r\nContent-Type: application/json\r\nX-Amzn-Requestid: ac9c3f20-3a13-11e7-9696-aba2ea1d59ed\r\n\r\n" 2017/05/16 08:43:04.226636 (c *Client) startupHealthcheck, err: <nil>, res: "HTTP/1.1 403 Forbidden\r\nContent-Length: 90\r\nConnection: keep-alive\r\nContent-Type: application/json\r\nX-Amzn-Requestid: ad38a631-3a13-11e7-9696-aba2ea1d59ed\r\n\r\n" 2017/05/16 08:43:05.232299 (c *Client) startupHealthcheck, err: <nil>, res: "HTTP/1.1 403 Forbidden\r\nContent-Length: 90\r\nConnection: keep-alive\r\nContent-Type: application/json\r\nX-Amzn-Requestid: add22716-3a13-11e7-9696-aba2ea1d59ed\r\n\r\n" 2017/05/16 08:43:06.238363 (c *Client) startupHealthcheck, err: <nil>, res: "HTTP/1.1 403 Forbidden\r\nContent-Length: 90\r\nConnection: keep-alive\r\nContent-Type: application/json\r\nX-Amzn-Requestid: ae6ba7f7-3a13-11e7-9696-aba2ea1d59ed\r\n\r\n" 2017/05/16 08:43:07.243939 (c *Client) startupHealthcheck, err: <nil>, res: "HTTP/1.1 403 Forbidden\r\nContent-Length: 90\r\nConnection: keep-alive\r\nContent-Type: application/json\r\nX-Amzn-Requestid: af0501c8-3a13-11e7-9696-aba2ea1d59ed\r\n\r\n" 2017/05/16 08:43:08.249621 (c *Client) startupHealthcheck, err: <nil>, res: "HTTP/1.1 403 Forbidden\r\nContent-Length: 90\r\nConnection: keep-alive\r\nContent-Type: application/json\r\nX-Amzn-Requestid: af9e82ad-3a13-11e7-9696-aba2ea1d59ed\r\n\r\n" 2017/05/16 08:43:09.249942 (c *Client) startupHealthcheck: []string{"http://search-dev-xxdsaf2e2rfsdfawer.ap-southeast-1.es.amazonaws.com"} no Elasticsearch node available goroutine 473 [running]: runtime/debug.Stack(0xc420d0b5a0, 0x7f49be0ace80, 0xc420471100) /usr/local/go/src/runtime/debug/stack.go:24 +0x7b github.com/ant0ine/go-json-rest/rest.(*RecoverMiddleware).MiddlewareFunc.func1.1(0x7f49b765d400, 0x7f49b7635fe0, 0xc420cf4a50) /go/src/github.com/ant0ine/go-json-rest/rest/recover.go:41 +0x70 panic(0x7f49be0ace80, 0xc420471100) /usr/local/go/src/runtime/panic.go:489 +0x2e7 github.com/theplant/ec/products/internal/actions.connect(0xc420d2e280, 0x16) /go/src/github.com/theplant/ec/products/internal/actions/context.go:48 +0x467 github.com/theplant/ec/products/internal/actions.NewDefaultClient(0xc420cf48b3, 0x2, 0xc420cf48bd, 0x5, 0x7f49b7158740, 0xc420d2e280, 0x0) /go/src/github.com/theplant/ec/products/internal/actions/context.go:103 +0x9d github.com/theplant/ec/products/internal.NewSearchContext(0xc420cf31a0, 0xc420d0b888, 0x7f49b6bd775e, 0xc420259e00) /go/src/github.com/theplant/ec/products/internal/products.go:920 +0x4b github.com/theplant/ec/products/internal.(*Impl).GetFilterGroups(0xc420cdcbc0, 0xc420cf31a0, 0xc420cd4900, 0xc420d2e280, 0x0, 0x0, 0xc420d2e280) /go/src/github.com/theplant/ec/products/internal/products.go:118 +0x34 github.com/theplant/ec/products.(*DefaultProductService).GetFilterGroups(0xc42000f2c0, 0xc420d2e280, 0x0, 0x0, 0x5) /go/src/github.com/theplant/ec/products/api.go:49 +0x4d github.com/theplant/pim/api/products.FilterGroups(0x7f49b7635fa0, 0xc420cf30c0, 0xc420cf3060) /go/src/github.com/theplant/pim/api/products/handlers.go:113 +0x9d github.com/ant0ine/go-json-rest/rest.(*router).AppFunc.func1(0x7f49b7635fa0, 0xc420cf30c0, 0xc420cf3060) /go/src/github.com/ant0ine/go-json-rest/rest/router.go:56 +0xa9 github.com/ant0ine/go-json-rest/rest.(*ContentTypeCheckerMiddleware).MiddlewareFunc.func1(0x7f49b7635fa0, 0xc420cf30c0, 0xc420cf3060) /go/src/github.com/ant0ine/go-json-rest/rest/content_type_checker.go:38 +0x202 github.com/ant0ine/go-json-rest/rest.(*GzipMiddleware).MiddlewareFunc.func1(0x7f49b7635fe0, 0xc420cf4a50, 0xc420cf3060) /go/src/github.com/ant0ine/go-json-rest/rest/gzip.go:31 +0x13f github.com/ant0ine/go-json-rest/rest.(*RecoverMiddleware).MiddlewareFunc.func1(0x7f49b7635fe0, 0xc420cf4a50, 0xc420cf3060) /go/src/github.com/ant0ine/go-json-rest/rest/recover.go:57 +0x8c github.com/ant0ine/go-json-rest/rest.(*PoweredByMiddleware).MiddlewareFunc.func1(0x7f49b7635fe0, 0xc420cf4a50, 0xc420cf3060) /go/src/github.com/ant0ine/go-json-rest/rest/powered_by.go:26 +0xb0 github.com/ant0ine/go-json-rest/rest.(*RecorderMiddleware).MiddlewareFunc.func1(0x7f49b7636020, 0xc420cf3080, 0xc420cf3060) /go/src/github.com/ant0ine/go-json-rest/rest/recorder.go:22 +0xa8 github.com/ant0ine/go-json-rest/rest.(*TimerMiddleware).MiddlewareFunc.func1(0x7f49b7636020, 0xc420cf3080, 0xc420cf3060) /go/src/github.com/ant0ine/go-json-rest/rest/timer.go:20 +0x12c github.com/ant0ine/go-json-rest/rest.(*AccessLogApacheMiddleware).MiddlewareFunc.func1(0x7f49b7636020, 0xc420cf3080, 0xc420cf3060) /go/src/github.com/ant0ine/go-json-rest/rest/access_log_apache.go:88 +0x56 github.com/ant0ine/go-json-rest/rest.adapterFunc.func1(0x7f49b76351e0, 0xc4201560e0, 0xc420c66800) /go/src/github.com/ant0ine/go-json-rest/rest/middleware.go:70 +0x134 net/http.HandlerFunc.ServeHTTP(0xc420ce0b90, 0x7f49b76351e0, 0xc4201560e0, 0xc420c66800) /usr/local/go/src/net/http/server.go:1942 +0x46 net/http.(*ServeMux).ServeHTTP(0xc420cdf7a0, 0x7f49b76351e0, 0xc4201560e0, 0xc420c66800) /usr/local/go/src/net/http/server.go:2238 +0x132 net/http.serverHandler.ServeHTTP(0xc420c0ae70, 0x7f49b76351e0, 0xc4201560e0, 0xc420c66800) /usr/local/go/src/net/http/server.go:2568 +0x94 net/http.(*conn).serve(0xc42027d220, 0x7f49b7635ce0, 0xc420cdc9c0) /usr/local/go/src/net/http/server.go:1825 +0x630 created by net/http.(*Server).Serve /usr/local/go/src/net/http/server.go:2668 +0x2dc
因为Amazon的Elasticsearch服务限制住了不让这个Lambda访问。设置允许Lambda出口的IP就可以了。