Supervisor: 둜그 디렉터리가 μ—†μœΌλ©΄ 좩돌이 λ°œμƒν•©λ‹ˆλ‹€.

에 λ§Œλ“  2015λ…„ 07μ›” 03일  Β·  4μ½”λ©˜νŠΈ  Β·  좜처: Supervisor/supervisor

문제 #120 의 μ˜κ²¬μ—μ„œ 보고됨:

그것이 λ§ˆμŠ€ν„° λΈŒλžœμΉ˜μ—μ„œ μ–΄λ–»κ²Œ λ“  ν•΄κ²°λ˜μ—ˆλŠ”μ§€ λͺ¨λ₯΄κ² μ§€λ§Œ 버전 3.1.1μ—μ„œ λˆ„κ΅°κ°€ μ‹€μˆ˜λ‘œ 우리 μ„œλ²„μ—μ„œ 둜그 디렉토리λ₯Ό μ œκ±°ν–ˆκ³  κ°λ…μžλŠ” λ‹¨μˆœνžˆ μž‘μ—…μ„ μ€‘λ‹¨ν•˜κ³  둜그 디렉토리가 μ—†μŠ΅λ‹ˆλ‹€.

logging

κ°€μž₯ μœ μš©ν•œ λŒ“κΈ€

fd22ca89ff353fbe92845e9d2517645e6cf149acμ—μ„œ μˆ˜μ •λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 이 μˆ˜μ • 사항은 Supervisor 3.2에 포함될 κ²ƒμž…λ‹ˆλ‹€.

λ³΅μ œν•˜κ³  μˆ˜μ •λ˜μ—ˆλŠ”μ§€ ν™•μΈν•˜λŠ” 방법은 λ‹€μŒκ³Ό κ°™μŠ΅λ‹ˆλ‹€. μ΅œμ†Œ supervisord.conf :

[supervisord]
logfile = /tmp/supervisord.log

[inet_http_server]
port = 127.0.0.1:9001

[supervisorctl]
serverurl = http://127.0.0.1:9001

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[program:cat]
command = /bin/cat
stdout_logfile = /thelogdir/foo.txt
autostart = false

둜그 디렉토리가 μžˆμ–΄μ•Ό ν•©λ‹ˆλ‹€. 그렇지 μ•ŠμœΌλ©΄ supervisord κ°€ μ‹œμž‘μ„ κ±°λΆ€ν•©λ‹ˆλ‹€. 둜그 디렉토리λ₯Ό λ§Œλ“€κ³  ν•΄λ‹Ή κ΅¬μ„±μœΌλ‘œ ν¬κ·ΈλΌμš΄λ“œμ—μ„œ supervisord λ₯Ό μ‹œμž‘ν•©λ‹ˆλ‹€.

$ mkdir /thelogdir
$ supervisord --version
3.2.0.dev0
$ supervisord -n -c /path/to/supervisord.conf
2015-08-18 14:38:52,503 INFO Increased RLIMIT_NOFILE limit to 1024
2015-08-18 14:38:52,516 INFO RPC interface 'supervisor' initialized
2015-08-18 14:38:52,516 CRIT Server 'inet_http_server' running without any HTTP authentication checking
2015-08-18 14:38:52,516 INFO supervisord started with pid 49508

supervisord κ°€ 계속 μ‹€ν–‰λ˜λŠ” λ™μ•ˆ 둜그 디렉토리λ₯Ό μ œκ±°ν•©λ‹ˆλ‹€.

$ rmdir /thelogdir

ν”„λ‘œμ„ΈμŠ€λ₯Ό μ‹œμž‘ν•˜μ‹­μ‹œμ˜€.

$ supervisorctl -c /path/to/supervisord.conf 
cat                              STOPPED   Not started
supervisor> start cat
cat: ERROR (spawn error)
supervisor> status
cat                              FATAL     unknown error making dispatchers for 'cat': ENOENT

λͺ¨λ“  4 λŒ“κΈ€

λ‚˜λŠ” λ˜ν•œμ΄ 행동을보고 μ§œμ¦μ΄λ‚¬λ‹€. κ°€λŠ₯ν•œ 경우 logdir을 λ§Œλ“œλŠ” 것이 μ˜¬λ°”λ₯Έ λ™μž‘μ΄λΌκ³  μƒκ°ν•˜λ©° μ΅œμ†Œν•œ λ‹€λ₯Έ μž‘μ—…μ΄ μΆ©λŒν•˜λ„λ‘ ν—ˆμš©ν•΄μ„œλŠ” μ•ˆ λ©λ‹ˆλ‹€.

λ‚˜λŠ” λ˜ν•œμ΄ 행동을보고 μ§œμ¦μ΄λ‚¬λ‹€.

μ–Έμ œ λ°œμƒν•©λ‹ˆκΉŒ? μ›λž˜ μ˜κ²¬μ€ ꡬ체적이지 μ•ŠμŠ΅λ‹ˆλ‹€. [program:x] μ„Ήμ…˜μ˜ stdout_logfile μ—μ„œ μ‘΄μž¬ν•˜μ§€ μ•ŠλŠ” 둜그 디렉토리λ₯Ό μ§€μ •ν•˜λ©΄ 좩돌이 λ°œμƒν•©λ‹ˆκΉŒ? μ–΄λ–€ Supervisor 버전을 μ‚¬μš©ν•˜κ³  μžˆμŠ΅λ‹ˆκΉŒ?

κ°€λŠ₯ν•œ 경우 logdir을 λ§Œλ“œλŠ” 것이 μ˜¬λ°”λ₯Έ λ™μž‘μ΄λΌκ³  μƒκ°ν•©λ‹ˆλ‹€.

μ €λŠ” 이와 같은 λ™μž‘μ„ ν•˜λŠ” λ‹€λ₯Έ ν”„λ‘œκ·Έλž¨μ„ μ‚¬μš©ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. supervisord λŠ” μ–΄λ–€ μ‚¬μš©μžκ°€ 디렉토리λ₯Ό μ†Œμœ ν•΄μ•Ό ν•˜λŠ”μ§€ λ˜λŠ” μ–΄λ–€ κΆŒν•œμ΄ μžˆμ–΄μ•Ό ν•˜λŠ”μ§€ λͺ¨λ₯΄κΈ° λ•Œλ¬Έμ— μžλ™μœΌλ‘œ 둜그 디렉토리λ₯Ό μƒμ„±ν•˜κΈ°μ— μΆ©λΆ„ν•œ 정보가 μ—†μŠ΅λ‹ˆλ‹€. λ‚˜λŠ” 이 λͺ¨λ“  것에 λŒ€ν•œ λ§Žμ€ μ˜΅μ…˜μ„ λŠ˜λ¦¬μ§€ μ•Šκ³  ν•  수 μžˆλŠ” μœ μΌν•œ 방법은 둜그 디렉토리가 μ‘΄μž¬ν•˜μ§€ μ•Šμ„ λ•Œ λͺ…ν™•ν•œ 였λ₯˜ λ©”μ‹œμ§€λ₯Ό ν‘œμ‹œν•˜λŠ” 것이라고 μƒκ°ν•©λ‹ˆλ‹€.

μ΅œμ†Œν•œ λ‹€λ₯Έ μž‘μ—…μ„ λ°©ν•΄ν•΄μ„œλŠ” μ•ˆ λ©λ‹ˆλ‹€.

stdout_logfile λ˜λŠ” stderr_logfile κ°€ μ‘΄μž¬ν•˜μ§€ μ•ŠλŠ” 디렉토리λ₯Ό μ§€μ •ν•˜λŠ” [program:x] μ„Ήμ…˜μ„ μΆ”κ°€ν•˜λ©΄ supervisord 좩돌이 λ°œμƒν•˜μ§€ μ•ŠλŠ”λ‹€λŠ” 데 λ™μ˜ν•©λ‹ˆλ‹€.

[program:x] μ„Ήμ…˜μ˜ stdout_logfile이 μ‘΄μž¬ν•˜μ§€ μ•ŠλŠ” 둜그 디렉토리λ₯Ό μ§€μ •ν•˜λ©΄ 좩돌이 λ°œμƒν•©λ‹ˆκΉŒ? μ–΄λ–€ Supervisor 버전을 μ‚¬μš©ν•˜κ³  μžˆμŠ΅λ‹ˆκΉŒ?

예. λ‚˜λ₯Ό μœ„ν•΄ 3.1.3에 λͺ‡ 가지 λ¬Έμ œκ°€ μžˆμŠ΅λ‹ˆλ‹€.

fd22ca89ff353fbe92845e9d2517645e6cf149acμ—μ„œ μˆ˜μ •λ˜μ—ˆμŠ΅λ‹ˆλ‹€. 이 μˆ˜μ • 사항은 Supervisor 3.2에 포함될 κ²ƒμž…λ‹ˆλ‹€.

λ³΅μ œν•˜κ³  μˆ˜μ •λ˜μ—ˆλŠ”μ§€ ν™•μΈν•˜λŠ” 방법은 λ‹€μŒκ³Ό κ°™μŠ΅λ‹ˆλ‹€. μ΅œμ†Œ supervisord.conf :

[supervisord]
logfile = /tmp/supervisord.log

[inet_http_server]
port = 127.0.0.1:9001

[supervisorctl]
serverurl = http://127.0.0.1:9001

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[program:cat]
command = /bin/cat
stdout_logfile = /thelogdir/foo.txt
autostart = false

둜그 디렉토리가 μžˆμ–΄μ•Ό ν•©λ‹ˆλ‹€. 그렇지 μ•ŠμœΌλ©΄ supervisord κ°€ μ‹œμž‘μ„ κ±°λΆ€ν•©λ‹ˆλ‹€. 둜그 디렉토리λ₯Ό λ§Œλ“€κ³  ν•΄λ‹Ή κ΅¬μ„±μœΌλ‘œ ν¬κ·ΈλΌμš΄λ“œμ—μ„œ supervisord λ₯Ό μ‹œμž‘ν•©λ‹ˆλ‹€.

$ mkdir /thelogdir
$ supervisord --version
3.2.0.dev0
$ supervisord -n -c /path/to/supervisord.conf
2015-08-18 14:38:52,503 INFO Increased RLIMIT_NOFILE limit to 1024
2015-08-18 14:38:52,516 INFO RPC interface 'supervisor' initialized
2015-08-18 14:38:52,516 CRIT Server 'inet_http_server' running without any HTTP authentication checking
2015-08-18 14:38:52,516 INFO supervisord started with pid 49508

supervisord κ°€ 계속 μ‹€ν–‰λ˜λŠ” λ™μ•ˆ 둜그 디렉토리λ₯Ό μ œκ±°ν•©λ‹ˆλ‹€.

$ rmdir /thelogdir

ν”„λ‘œμ„ΈμŠ€λ₯Ό μ‹œμž‘ν•˜μ‹­μ‹œμ˜€.

$ supervisorctl -c /path/to/supervisord.conf 
cat                              STOPPED   Not started
supervisor> start cat
cat: ERROR (spawn error)
supervisor> status
cat                              FATAL     unknown error making dispatchers for 'cat': ENOENT
이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰