master
์ง์ ์ ๋ฌธ์ ๊ฐ ์์์ ํ์ธํ์ต๋๋ค.celery -A proj report
์ ๊ฒฐ๊ณผ๋ฅผ ํฌํจํ์ต๋๋ค.software -> celery:4.1.0 (latentcall) kombu:4.1.0 py:3.5.2
billiard:3.5.0.3 redis:2.10.6
platform -> system:Linux arch:64bit, ELF imp:CPython
loader -> celery.loaders.app.AppLoader
settings -> transport:redis results:disabled
CACHES: {
'default': { 'BACKEND': 'django_redis.cache.RedisCache',
'LOCATION': 'redis://localhost:6379/1',
'TIMEOUT': 3600}}
CELERY_TASK_COMPRESSION: 'gzip'
CELERY_TASK_IGNORE_RESULT: True
CELERY_ACCEPT_CONTENT: ['pickle', 'json', 'msgpack', 'yaml']
CELERY_BROKER_URL: 'redis://localhost:6379/0'
DEBUG: False
INSTALLED_APPS:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.admin',
'django.contrib.sitemaps',
'django.contrib.staticfiles',
'django.contrib.humanize',
'django.contrib.redirects',
'django.contrib.gis',
'django_extensions',
)
Ubuntu 16.04์์.
sudo service <your-celery-service-name> start
๋ฅผ ํตํด ์
๋ฌ๋ฆฌ ์์sudo service <your-celery-service-name> reload
๋ฅผ ํตํด ์
๋ฌ๋ฆฌ๋ฅผ ๋ค์๋ก๋ ํด๋ณด์ญ์์ค.์ ๋ฌ๋ฆฌ๋ ์ ์์ ์ผ๋ก ๋ค์๋ก๋๋์ด์ผํฉ๋๋ค.
์ ๋ฌ๋ฆฌ ๋ ์ ์์ ์ผ๋ก ์ฌ ์ฅ์
๋ค์๋ก๋ ์์ฒญ (๋ฐ ์ดํ ์์ ์คํจ)์ ์คํ ํ ํ sudo journalctl -xe
์ ์ถ๋ ฅ์ ์
์์ ์ธ ๋ด์ฉ์ด ํ์๋์ง ์๋ ๊ฒ ๊ฐ์ต๋๋ค.
Nov 15 04:33:04 ip-172-31-44-219 sudo[12972]: ubuntu : TTY=pts/0 ; PWD=/home/ubuntu ; USER=root ; COMMAND=/usr/sbin/service myproj-celery reload
Nov 15 04:33:04 ip-172-31-44-219 sudo[12972]: pam_unix(sudo:session): session opened for user root by ubuntu(uid=0)
Nov 15 04:33:04 ip-172-31-44-219 systemd[1]: Reloading myproj celery worker.
-- Subject: Unit myproj-celery.service has begun reloading its configuration
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit myproj-celery.service has begun reloading its configuration
Nov 15 04:33:07 ip-172-31-44-219 sh[12979]: celery multi v4.1.0 (latentcall)
Nov 15 04:33:07 ip-172-31-44-219 sh[12979]: > Stopping nodes...
Nov 15 04:33:07 ip-172-31-44-219 sh[12979]: > worker1@ip-172-31-44-219: TERM -> 12962
Nov 15 04:33:07 ip-172-31-44-219 sh[12979]: > Waiting for 1 node -> 12962.....
Nov 15 04:33:07 ip-172-31-44-219 sh[12979]: > worker1@ip-172-31-44-219: OK
Nov 15 04:33:07 ip-172-31-44-219 sh[12979]: > Restarting node worker1@ip-172-31-44-219: OK
Nov 15 04:33:07 ip-172-31-44-219 sh[12979]: > Waiting for 1 node -> None...
Nov 15 04:33:07 ip-172-31-44-219 sh[12992]: celery multi v4.1.0 (latentcall)
Nov 15 04:33:07 ip-172-31-44-219 sh[12992]: > worker1@ip-172-31-44-219: DOWN
Nov 15 04:33:07 ip-172-31-44-219 systemd[1]: Reloaded myproj celery worker.
-- Subject: Unit myproj-celery.service has finished reloading its configuration
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit myproj-celery.service has finished reloading its configuration
--
-- The result is done.
Nov 15 04:33:07 ip-172-31-44-219 sudo[12972]: pam_unix(sudo:session): session closed for user root
CELERYD_PID_FILE="/var/run/celery/%N.pid"
๊ฐ ์๋ ค์ง์ง ์์ ๊ฒ์ด ๋ฌธ์ ์
๋๊น? ์๋ฏธ, ์ฐ๋ฆฌ๋ Systemd์ ( PIDFile=
) PID ํ์ผ์ ์ค์ ์์น๋ฅผ ์ ์ ์์ต๋๋ค. ์๋ํ๋ฉด ๊ทธ๊ฒ์ ์
๋ฌ๋ฆฌ ์์ฒด์ ์ํด ์์ฑ ๋์๊ธฐ ๋๋ฌธ์
๋๋ค.
systemd ๋ฐ celery ํ์ผ์ ๊ฒ์ ํ ์ ์์ต๋๊น?
systemd์ PID๋ฅผ ์ ์ฅํ ์์น๋ฅผ ์๋ฆด ์ ์์ง๋ง ์ด์ค์ผ์ดํํด์ผํฉ๋๋ค.
celery multi restart w1 -A proj --pidfile=/tmp/celery_%%n.pid
์ด์ค ํผ์ผํธ๋ฅผ ์ฃผ๋ชฉํ์ญ์์ค.
์ฐ์ ๊ฐ์ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
๋๋ systemd config๋ฅผ ํธ์งํ์ฌ ํด๊ฒฐํฉ๋๋ค.
๋ค์ ์์ = ํญ์
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
์ฐ์ ๊ฐ์ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
๋๋ systemd config๋ฅผ ํธ์งํ์ฌ ํด๊ฒฐํฉ๋๋ค.
๋ค์ ์์ = ํญ์