Supervisord kann nicht gestartet werden, Tornado-server
Habe ich 6 Stunden versucht, herauszufinden, warum es nicht funktioniert. Weiß wirklich nicht, warum. Vielen Dank im Voraus!
HINWEIS: die folgende Einstellung funktioniert auch einwandfrei unter ubuntu-server, aber nicht auf meinem lokalen MacOSX
Hier ist mein supervisord.conf:
;local conf
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
[supervisord]
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=debug ; (log level;default info; others: debug,warn,trace)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
[include]
files = conf.d/*.conf
Hier mein tornado.conf unter conf.d Ordner:
[group:tornadoes]
programs=tornado-8000,tornado-8001,tornado-8002,tornado-8003
[program:tornado-8000]
command=python /Users/horace/server/server.py --port=8000
directory=/var/www
user=www-data
autorestart=true
redirect_stderr=true
stdout_logfile=/var/log/tornado.log
loglevel=info
[program:tornado-8001]
command=python /Users/horace/server/server.py --port=8001
directory=/var/www
user=www-data
autorestart=true
redirect_stderr=true
stdout_logfile=/var/log/tornado.log
loglevel=info
[program:tornado-8002]
command=python /Users/horace/server/server.py --port=8002
directory=/var/www
user=www-data
autorestart=true
redirect_stderr=true
stdout_logfile=/var/log/tornado.log
loglevel=info
[program:tornado-8003]
command=python /Users/horace/server/server.py --port=8003
directory=/var/www
user=www-data
autorestart=true
redirect_stderr=true
stdout_logfile=/var/log/tornado.log
loglevel=info
Nach dem ausführen
sudo supervisord -n -edebug
Habe ich diese logs.
Anmerkung: ich sah die "ImportError: Kein Modul mit dem Namen tornado.httpserver" Fehler. Aber wenn ich versuche zu laufen, die server.py aus dem Ordner mit "
python server.py --port=8000
Startet der server ohne Probleme. Das ist wirklich verwirrend für mich, warum supervisord kann nicht beginnen.
/Library/Python/2.7/site-packages/supervisor/options.py:286: UserWarning: Supervisord is running as root and it is searching for its configuration file in default locations (including its current working directory); you probably want to specify a "-c" argument specifying an absolute path to a configuration file for improved security.
'Supervisord is running as root and it is searching '
2012-09-16 14:29:40,866 CRIT Supervisor running as root (no user in config file)
2012-09-16 14:29:40,866 WARN Included extra file "/Users/horace/supervisor/conf.d/tornado.conf" during parsing
2012-09-16 14:29:40,866 INFO Increased RLIMIT_NOFILE limit to 1024
2012-09-16 14:29:40,889 INFO RPC interface 'supervisor' initialized
2012-09-16 14:29:40,889 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2012-09-16 14:29:40,889 INFO supervisord started with pid 6367
2012-09-16 14:29:41,895 INFO spawned: 'tornado-8000' with pid 6370
2012-09-16 14:29:41,897 INFO spawned: 'tornado-8001' with pid 6371
2012-09-16 14:29:41,899 INFO spawned: 'tornado-8002' with pid 6372
2012-09-16 14:29:41,902 INFO spawned: 'tornado-8003' with pid 6373
2012-09-16 14:29:41,915 DEBG 'tornado-8000' stdout output:
supervisor: error trying to setuid to 0 (Could not set groups of effective user)
2012-09-16 14:29:41,915 DEBG 'tornado-8001' stdout output:
supervisor: error trying to setuid to 0 (Could not set groups of effective user)
2012-09-16 14:29:41,917 DEBG 'tornado-8002' stdout output:
supervisor: error trying to setuid to 0 (Could not set groups of effective user)
2012-09-16 14:29:41,919 DEBG 'tornado-8003' stdout output:
supervisor: error trying to setuid to 0 (Could not set groups of effective user)
2012-09-16 14:29:41,974 DEBG 'tornado-8000' stdout output:
Traceback (most recent call last):
File "/Users/horace/server/server.py", line 4, in <module>
import tornado.httpserver
ImportError: No module named tornado.httpserver
2012-09-16 14:29:41,974 DEBG 'tornado-8001' stdout output:
Traceback (most recent call last):
File "/Users/horace/server/server.py", line 4, in <module>
import tornado.httpserver
ImportError: No module named tornado.httpserver
2012-09-16 14:29:41,974 DEBG 'tornado-8002' stdout output:
Traceback (most recent call last):
File "/Users/horace/server/server.py", line 4, in <module>
import tornado.httpserver
ImportError: No module named tornado.httpserver
2012-09-16 14:29:41,974 DEBG 'tornado-8003' stdout output:
Traceback (most recent call last):
File "/Users/horace/server/server.py", line 4, in <module>
import tornado.httpserver
ImportError: No module named tornado.httpserver
2012-09-16 14:29:48,133 DEBG fd 10 closed, stopped monitoring <POutputDispatcher at 4345929384 for <Subprocess at 4345718256 with name tornado-8001 in state STARTING> (stdout)>
2012-09-16 14:29:48,133 INFO exited: tornado-8001 (exit status 1; not expected)
2012-09-16 14:29:48,133 DEBG fd 7 closed, stopped monitoring <POutputDispatcher at 4345929312 for <Subprocess at 4345718112 with name tornado-8000 in state STARTING> (stdout)>
2012-09-16 14:29:48,133 INFO exited: tornado-8000 (exit status 1; not expected)
2012-09-16 14:29:48,133 DEBG received SIGCHLD indicating a child quit
2012-09-16 14:29:48,135 DEBG 'tornado-8002' stdout output:
Traceback (most recent call last):
File "/Users/horace/server/server.py", line 4, in <module>
import tornado.httpserver
ImportError: No module named tornado.httpserver
2012-09-16 14:29:48,136 DEBG 'tornado-8003' stdout output:
Traceback (most recent call last):
File "/Users/horace/server/server.py", line 4, in <module>
import tornado.httpserver
ImportError: No module named tornado.httpserver
2012-09-16 14:29:48,136 INFO gave up: tornado-8000 entered FATAL state, too many start retries too quickly
2012-09-16 14:29:48,136 INFO gave up: tornado-8001 entered FATAL state, too many start retries too quickly
2012-09-16 14:29:48,137 DEBG fd 14 closed, stopped monitoring <POutputDispatcher at 4346496280 for <Subprocess at 4345718400 with name tornado-8003 in state STARTING> (stdout)>
2012-09-16 14:29:48,137 INFO exited: tornado-8003 (exit status 1; not expected)
2012-09-16 14:29:48,137 DEBG fd 12 closed, stopped monitoring <POutputDispatcher at 4346495200 for <Subprocess at 4345718328 with name tornado-8002 in state STARTING> (stdout)>
2012-09-16 14:29:48,137 INFO exited: tornado-8002 (exit status 1; not expected)
2012-09-16 14:29:48,137 DEBG received SIGCHLD indicating a child quit
2012-09-16 14:29:49,139 INFO gave up: tornado-8002 entered FATAL state, too many start retries too quickly
2012-09-16 14:29:49,139 INFO gave up: tornado-8003 entered FATAL state, too many start retries too quickly
UPDATE: ich weiß nicht, warum, aber ich habe den server gestartet von:
su root
dann starten Sie die supervisord. Läuft alles korrekt.
Aber weiß immer noch nicht, warum unter meinem normalen Benutzer-horace, ich kann nicht beginnen. (importieren der tornado.httpserver-Modul)
sudo supervisord
Weiss jemand den Grund? Danke.
- Ist
tornado
in Ihren globalen python-Pfad? Oder einfach in den Ordner der app? - Sie haben die tornado-Ordner in der Benutzer/Horace/server-Ordner?
- ja. ich habe alle tornado server.py Dateien im server-Ordner. und ich KANN ihn manuell starten mit
- können Sie ihn manuell starten als Benutzer www-data?
- ich kann. mit dem gleichen Befehl: python server.py --port=8000.
- Können Sie start-tornado aus einem beliebigen Ordner in Ihrem system? Ich meine, können Sie starten Sie es mit folgenden Befehl
/path/to/your/server.py
?.. - Versucht. Ich kann. Ich kann es starten, von überall
Du musst angemeldet sein, um einen Kommentar abzugeben.
Haben Sie versucht, die Einstellung
environment=PYTHONPATH="..."
variable?edit:
supervisor.conf:
app1.Betreuer:
Ihre supervisord Konfigurationsdatei sieht ziemlich gut aus.
Was fehlte war für mich läuft Vorgesetzten innerhalb des virtualenv auf dem server.
Habe ich den virtualenv source-Verzeichnis/bin/activate Zeile vor der Ausführung von supervisord -c my_conf_file, und das hat geklappt.