Redash 㧠502 Bad Gateway ãçºçããã¨ãã«è¦ç´ãã¹ã Gunicorn ã®ã¿ã¤ã ã¢ã¦ã
æ¥åã§ä½¿ãåãã¦ãã Redash ã§ãããã¯ã¨ãªã¼ã®çµæããã¦ã³ãã¼ãããã¨ãã502 Bad Gatewayããçºçãã¦ããã®ã§èª¿æ»ã»å¯¾å¿ããã¡ã¢
çºçãã¦ããç¾è±¡
è¡æ°ç´28,000è¡ãåæ°ç´70ã®çµæãè¿ãã¯ã¨ãªã¼ã Excel ãã¦ã³ãã¼ããããã¨ãã㨠nginx ã® ã502 Bad Gatewayãã¨ã©ã¼ãçºçããã¡ã¤ã«ããã¦ã³ãã¼ãã§ããªããæ¡ä»¶ãçµã£ã¦åå¾è¡æ°ãæ¸ããã¨ãã¦ã³ãã¼ãã§ããã
調æ»
nginx ã®ã¨ã©ã¼ãã°ã«ã¯ä»¥ä¸ã®ãããªã¡ãã»ã¼ã¸ãè¨é²ããã¦ããã
... upstream prematurely closed connection while reading response header from upstream, client: xxx.xxx.xxx.xxx ...
ã¾ããserver
ã³ã³ããã®ãã°ã«ã¯ãã¯ã¼ã«ã¼ãã¿ã¤ã ã¢ã¦ããããããªãã°ãè¨é²ããã¦ãã(詳細ã¯å²æ)
ããã§ã®ãã¯ã¼ã«ã¼ã㯠Celery ä¸ã§åã Redash ã®ã¯ã¼ã«ã¼ã§ã¯ãªããRedash ãã¢ããªã±ã¼ã·ã§ã³ãµã¼ãã¼ã¨ãã¦ä½¿ç¨ãã¦ãã Gunicorn ã®ã¯ã¼ã«ã¼ã®ãã¨ã
対å¿
ã¨ã©ã¼ãã°ãã Gunicorn ãã¿ã¤ã ã¢ã¦ããã¦ããã¨æ¨æ¸¬ããè¨å®ã調æ»ããã
çµæã¨ãã¦ãã¿ã¤ã ã¢ã¦ãã®ãªãã·ã§ã³ããããããã¯ããã©ã«ã㧠30
ç§ã«ãªã£ã¦ãããã¨ãããã£ãã
ã¾ããGunicorn ã®ãªãã·ã§ã³ã¯ã³ãã³ãã©ã¤ã³å¼æ°ã¨ãã¦ä¸ãã以å¤ã«ãã以ä¸ã®ããã«ç°å¢å¤æ°ã§æ¸¡ããã¨ãã§ããã
$ GUNICORN_CMD_ARGS="--bind=127.0.0.1 --workers=3" gunicorn app:app
Redash ã¯ç¾å¨ Docker ç°å¢ãæ¨å¥¨ãã¦ãããããã³ãã³ãã©ã¤ã³ãªãã·ã§ã³ã®å¤æ´ã¯ã¯ã¤ã¡ã¼ã¸ã®åæ§ç¯ãå¿ è¦ã«ãªã£ã¦ãã¾ããç¸æ§ãæªãã
ãã®ç¹ãGUNICORN_CMD_ARGS
ç°å¢å¤æ°ã使ãã° docker-compose.yml
ã®å¤æ´ã®ã¿ã§ãªãã·ã§ã³ãé©ç¨ã§ããã
ããããè¸ã¾ãã¦ã以ä¸ã®è¨å®ã docker-compose.yml
ã® server
ãµã¼ãã¹å
ã environment
ã«è¿½å ããã
GUNICORN_CMD_ARGS: "--timeout 90"
90ç§ã¨ããè¨å®ã¯é©å½ã
docker-compose.yml
ãç·¨éå¾ãdocker-compose down
ãdocker-compose up -d
ã§ã³ã³ãããåèµ·åã
ã¨ã©ã¼ãåºã¦ããã¯ã¨ãªããã©ã¦ã¶ã§è¡¨ç¤ºããã¯ã¨ãªã¼çµæã Excel ãã¦ã³ãã¼ãããã¨ããããã¦ã³ãã¼ãæåã
ã¾ã¨ã
Redash ã§ãã¡ã¤ã«ãã¦ã³ãã¼ãæã« 502 ã¨ã©ã¼ãçºçããéã¯ãGunicorn ã®ã¿ã¤ã ã¢ã¦ããè¦ç´ããã¨ã§è§£æ±ºãããã¨ãããã
ãã®è¨äºã§ã¯ Docker ç°å¢ã§åä½ãã¦ãã Redash ãæ±ã£ã¦ããããã¬ã¬ã·ã¼(Ubuntu ã«ç´æ¥å°å ¥)ã»ããã¢ããã§ãä¼¼ããããªå¯¾å¿ãã§ããã¯ãã