Spring cloud config client が Could not locate PropertySource: 400 Bad Request になるときの対処方法
spring cloud config を試しているときにハマったののメモ。
spring cloud config のチュートリアルは server を 8888 番ポートで listen させろと書いてある。
コレに従って進めていくと、Could not locate PropertySource: 400 Bad Request
というエラーになって困った。
ngrep を実施して様子を見ていると以下のようなログが取れた。
##########
T 127.0.0.1:50448 -> 127.0.0.1:8888 [AP]
GET /a-bootiful-client/default HTTP/1.1.
Host: 127.0.0.1:8888.
User-Agent: curl/7.54.0.
Accept: */*.
.
##
T 127.0.0.1:8888 -> 127.0.0.1:50448 [AP]
HTTP/1.1 400 Bad Request.
Content-type: text/plain.
Connection: Keep-Alive.
Content-length: 58.
.
400 Bad Request
'json' or 'msgpack' parameter is required
curl http://localhost:8888
でリクエストした場合には以下のようになっていた。
#####
T ::1:50441 -> ::1:8888 [AP]
GET /a-bootiful-client/default HTTP/1.1.
Host: localhost:8888.
User-Agent: curl/7.54.0.
Accept: */*.
.
##
T ::1:8888 -> ::1:50441 [AP]
HTTP/1.1 200 .
X-Application-Context: application:8888.
Content-Type: application/json;charset=UTF-8.
Transfer-Encoding: chunked.
Date: Wed, 11 Oct 2017 06:07:25 GMT.
.
97.
{"name":"a-bootiful-client","profiles":["default"],"label":null,"version":"94427c7a809dbb3550d6db2902eccd4f93eec63d","state":null,"propertySources":[]}.
同じ http://localhost:8888/ を読んでいるが、返しているサーバーが違うようだ。
'json' or 'msgpack' parameter is required
というメッセージで検索してみると、fluentd の in_http に含まれるエラーメッセージだということがわかる。
昔、手元のマシンで td-agent を起動してそのままになっていた結果、in_http が 8888 番ポートを見続けていたようだ。
curl http://127.0.0.1:8888
するとたしかに in_http に行ってることが確認できた。
同じ http://localhost:8888 へのリクエストでも、違う process にリクエストがいくことがあるので注意が必要だということがわかった。
対応は sudo pkill -f td-agent
です!
Published: 2017-10-11(Wed) 06:19