{"id":998,"date":"2018-08-30T20:01:37","date_gmt":"2018-08-30T12:01:37","guid":{"rendered":"https:\/\/blog.jsjs.org\/?p=998"},"modified":"2018-08-30T20:01:37","modified_gmt":"2018-08-30T12:01:37","slug":"supervisor-%e7%ae%a1%e7%90%86-tomcat-%e5%b8%b8%e8%a7%81%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"https:\/\/blog.jsjs.org\/?p=998","title":{"rendered":"supervisor \u7ba1\u7406 tomcat \u5e38\u89c1\u95ee\u9898"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"1supervisorctl-httplocalhost9001-refused-connection\">1.supervisorctl\u00a0<a href=\"http:\/\/localhost:9001\/\" rel=\"noreferrer noopener\" target=\"_blank\">http:\/\/localhost:9001<\/a>\u00a0refused connection<\/h2>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"1\u6253\u5f00\u5982\u4e0b\u7684\u914d\u7f6e\">1.\u6253\u5f00\u5982\u4e0b\u7684\u914d\u7f6e\uff1a<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>[inet_http_server]         ; inet (TCP) server disabled by default\nport=0.0.0.0:9001        ; (ip_address:port specifier, *:port for all iface)\nusername=user              ; (default is no username (open server))\npassword=123               ; (default is no password (open server))<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"2tomcat-\u542f\u52a8\u62a5\u9519fatal-exited-too-quickly\">2.tomcat \u542f\u52a8\u62a5\u9519\uff1aFATAL Exited too quickly<\/h2>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"1\u8fd9\u662f\u56e0\u4e3a\u542f\u52a8-tomcat\u7684\u65b9\u5f0f\u4e0d\u5bf9\u5728linux\u547d\u4ee4\u884c\u6a21\u5f0f\u4e0b\u6211\u4eec\u542f\u52a8\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b\u811a\u672c\">1.\u8fd9\u662f\u56e0\u4e3a\u542f\u52a8 tomcat\u7684\u65b9\u5f0f\u4e0d\u5bf9\uff0c\u5728linux\u547d\u4ee4\u884c\u6a21\u5f0f\u4e0b\u6211\u4eec\u542f\u52a8\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b\u811a\u672c<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/apache-tomcat-7.0.70\/bin\/startup.sh<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"2\u5728supervisor\u7684\u542f\u52a8\u547d\u4ee4\u4e2d\u4e0d\u80fd\u4f7f\u7528\u8fd9\u79cd\u65b9\u5f0f\u4e86\u8981\u4f7f\u7528\u5982\u4e0b\u65b9\u5f0f\">2.\u5728supervisor\u7684\u542f\u52a8\u547d\u4ee4\u4e2d\u4e0d\u80fd\u4f7f\u7528\u8fd9\u79cd\u65b9\u5f0f\u4e86\u8981\u4f7f\u7528\u5982\u4e0b\u65b9\u5f0f\uff1a<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>command=\/root\/tools\/apache-tomcat-7.0.70\/bin\/catalina.sh run<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"3\u5b8c\u6574\u914d\u7f6e\u6587\u4ef6\">3.\u5b8c\u6574\u914d\u7f6e\u6587\u4ef6\uff1a<\/h2>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"1supervisor-\u914d\u7f6e\u6587\u4ef6\">1.supervisor \u914d\u7f6e\u6587\u4ef6<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>; Sample supervisor config file.\n\n<\/code><\/pre>\n\n\n<p>[unix_http_server]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\nfile=\/var\/tmp\/supervisor.sock   ; (the path to the socket file)\n;chmod=0700                 ; sockef file mode (default 0700)\n;chown=nobody:nogroup       ; socket file uid:gid owner\n;username=user              ; (default is no username (open server))\n;password=123               ; (default is no password (open server))\n\n<\/p>\n\n\n<p>[inet_http_server]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">         ; inet (TCP) server disabled by default\nport=0.0.0.0:9001        ; (ip_address:port specifier, *:port for all iface)\nusername=user              ; (default is no username (open server))\npassword=123               ; (default is no password (open server))\n\n<\/p>\n\n\n<p>[supervisord]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\nlogfile=\/var\/log\/supervisor\/supervisord.log  ; (main log file;default $CWD\/supervisord.log)\nlogfile_maxbytes=50MB       ; (max main logfile bytes b4 rotation;default 50MB)\nlogfile_backups=10          ; (num of main logfile rotation backups;default 10)\nloglevel=info               ; (log level;default info; others: debug,warn,trace)\npidfile=\/var\/run\/supervisord.pid ; (supervisord pidfile;default supervisord.pid)\nnodaemon=false              ; (start in foreground if true;default false)\nminfds=1024                 ; (min. avail startup file descriptors;default 1024)\nminprocs=200                ; (min. avail process descriptors;default 200)\n;umask=022                  ; (process file creation umask;default 022)\n;user=chrism                 ; (default is current user, required if root)\n;identifier=supervisor       ; (supervisord identifier, default is &#8216;supervisor&#8217;)\n;directory=\/tmp              ; (default is not to cd during start)\n;nocleanup=true              ; (don&#8217;t clean up tempfiles at start;default false)\n;childlogdir=\/tmp            ; (&#8216;AUTO&#8217; child log dir, default $TEMP)\n;environment=KEY=value       ; (key value pairs to add to environment)\n;strip_ansi=false            ; (strip ansi escape codes in logs; def. false)\n\n; the below section must remain in the config file for RPC\n; (supervisorctl\/web interface) to work, additional interfaces may be\n; added by defining them in separate rpcinterface: sections\n<\/p>\n\n\n<p>[rpcinterface:supervisor]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\nsupervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface\n\n<\/p>\n\n\n<p>[supervisorctl]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\n#serverurl=unix:\/\/\/var\/tmp\/supervisor.sock ; use a unix:\/\/ URL  for a unix socket\nserverurl=http:\/\/localhost:9001 ; use an http:\/\/ url to specify an inet socket\n#username=chris              ; should be same as http_username if set\n#password=123                ; should be same as http_password if set\nprompt=mysupervisor         ; cmd line prompt (default &#8220;supervisor&#8221;)\nhistory_file=~\/.sc_history  ; use readline history if available\n\n; The below sample program section shows all possible program subsection values,\n; create one or more &#8216;real&#8217; program: sections to be able to control them under\n; supervisor.\n\n;[program:theprogramname]\n;command=\/bin\/cat              ; the program (relative uses PATH, can take args)\n;process_name=%(program_name)s ; process_name expr (default %(program_name)s)\n;numprocs=1                    ; number of processes copies to start (def 1)\n;directory=\/tmp                ; directory to cwd to before exec (def no cwd)\n;umask=022                     ; umask for process (default None)\n;priority=999                  ; the relative start priority (default 999)\n;autostart=true                ; start at supervisord start (default: true)\n;autorestart=true              ; retstart at unexpected quit (default: true)\n;startsecs=10                  ; number of secs prog must stay running (def. 1)\n;startretries=3                ; max # of serial start failures (default 3)\n;exitcodes=0,2                 ; &#8216;expected&#8217; exit codes for process (default 0,2)\n;stopsignal=QUIT               ; signal used to kill process (default TERM)\n;stopwaitsecs=10               ; max num secs to wait b4 SIGKILL (default 10)\n;user=chrism                   ; setuid to this UNIX account to run the program\n;redirect_stderr=true          ; redirect proc stderr to stdout (default false)\n;stdout_logfile=\/a\/path        ; stdout log path, NONE for none; default AUTO\n;stdout_logfile_maxbytes=1MB   ; max # logfile bytes b4 rotation (default 50MB)\n;stdout_logfile_backups=10     ; # of stdout logfile backups (default 10)\n;stdout_capture_maxbytes=1MB   ; number of bytes in &#8216;capturemode&#8217; (default 0)\n;stdout_events_enabled=false   ; emit events on stdout writes (default false)\n;stderr_logfile=\/a\/path        ; stderr log path, NONE for none; default AUTO\n;stderr_logfile_maxbytes=1MB   ; max # logfile bytes b4 rotation (default 50MB)\n;stderr_logfile_backups=10     ; # of stderr logfile backups (default 10)\n;stderr_capture_maxbytes=1MB   ; number of bytes in &#8216;capturemode&#8217; (default 0)\n;stderr_events_enabled=false   ; emit events on stderr writes (default false)\n;environment=A=1,B=2           ; process environment additions (def no adds)\n;serverurl=AUTO                ; override serverurl computation (childutils)\n\n; The below sample eventlistener section shows all possible\n; eventlistener subsection values, create one or more &#8216;real&#8217;\n; eventlistener: sections to be able to handle event notifications\n; sent by supervisor.\n\n;[eventlistener:theeventlistenername]\n;command=\/bin\/eventlistener    ; the program (relative uses PATH, can take args)\n;process_name=%(program_name)s ; process_name expr (default %(program_name)s)\n;numprocs=1                    ; number of processes copies to start (def 1)\n;events=EVENT                  ; event notif. types to subscribe to (req&#8217;d)\n;buffer_size=10                ; event buffer queue size (default 10)\n;directory=\/tmp                ; directory to cwd to before exec (def no cwd)\n;umask=022                     ; umask for process (default None)\n;priority=-1                   ; the relative start priority (default -1)\n;autostart=true                ; start at supervisord start (default: true)\n;autorestart=unexpected        ; restart at unexpected quit (default: unexpected)\n;startsecs=10                  ; number of secs prog must stay running (def. 1)\n;startretries=3                ; max # of serial start failures (default 3)\n;exitcodes=0,2                 ; &#8216;expected&#8217; exit codes for process (default 0,2)\n;stopsignal=QUIT               ; signal used to kill process (default TERM)\n;stopwaitsecs=10               ; max num secs to wait b4 SIGKILL (default 10)\n;user=chrism                   ; setuid to this UNIX account to run the program\n;redirect_stderr=true          ; redirect proc stderr to stdout (default false)\n;stdout_logfile=\/a\/path        ; stdout log path, NONE for none; default AUTO\n;stdout_logfile_maxbytes=1MB   ; max # logfile bytes b4 rotation (default 50MB)\n;stdout_logfile_backups=10     ; # of stdout logfile backups (default 10)\n;stdout_events_enabled=false   ; emit events on stdout writes (default false)\n;stderr_logfile=\/a\/path        ; stderr log path, NONE for none; default AUTO\n;stderr_logfile_maxbytes=1MB   ; max # logfile bytes b4 rotation (default 50MB)\n;stderr_logfile_backups        ; # of stderr logfile backups (default 10)\n;stderr_events_enabled=false   ; emit events on stderr writes (default false)\n;environment=A=1,B=2           ; process environment additions\n;serverurl=AUTO                ; override serverurl computation (childutils)\n\n; The below sample group section shows all possible group values,\n; create one or more &#8216;real&#8217; group: sections to create &#8220;heterogeneous&#8221;\n; process groups.\n\n;[group:thegroupname]\n;programs=progname1,progname2  ; each refers to &#8216;x&#8217; in [program:x] definitions\n;priority=999                  ; the relative start priority (default 999)\n\n; The [include] section can just contain the &#8220;files&#8221; setting.  This\n; setting can list multiple files (separated by whitespace or\n; newlines).  It can also contain wildcards.  The filenames are\n; interpreted as relative to this file.  Included files *cannot*\n; include files themselves.\n\n<\/p>\n\n\n<p>[include]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\nfiles = \/etc\/supervisord.d\/*.ini\n<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>1<\/li><li>2<\/li><li>3<\/li><li>4<\/li><li>5<\/li><li>6<\/li><li>7<\/li><li>8<\/li><li>9<\/li><li>10<\/li><li>11<\/li><li>12<\/li><li>13<\/li><li>14<\/li><li>15<\/li><li>16<\/li><li>17<\/li><li>18<\/li><li>19<\/li><li>20<\/li><li>21<\/li><li>22<\/li><li>23<\/li><li>24<\/li><li>25<\/li><li>26<\/li><li>27<\/li><li>28<\/li><li>29<\/li><li>30<\/li><li>31<\/li><li>32<\/li><li>33<\/li><li>34<\/li><li>35<\/li><li>36<\/li><li>37<\/li><li>38<\/li><li>39<\/li><li>40<\/li><li>41<\/li><li>42<\/li><li>43<\/li><li>44<\/li><li>45<\/li><li>46<\/li><li>47<\/li><li>48<\/li><li>49<\/li><li>50<\/li><li>51<\/li><li>52<\/li><li>53<\/li><li>54<\/li><li>55<\/li><li>56<\/li><li>57<\/li><li>58<\/li><li>59<\/li><li>60<\/li><li>61<\/li><li>62<\/li><li>63<\/li><li>64<\/li><li>65<\/li><li>66<\/li><li>67<\/li><li>68<\/li><li>69<\/li><li>70<\/li><li>71<\/li><li>72<\/li><li>73<\/li><li>74<\/li><li>75<\/li><li>76<\/li><li>77<\/li><li>78<\/li><li>79<\/li><li>80<\/li><li>81<\/li><li>82<\/li><li>83<\/li><li>84<\/li><li>85<\/li><li>86<\/li><li>87<\/li><li>88<\/li><li>89<\/li><li>90<\/li><li>91<\/li><li>92<\/li><li>93<\/li><li>94<\/li><li>95<\/li><li>96<\/li><li>97<\/li><li>98<\/li><li>99<\/li><li>100<\/li><li>101<\/li><li>102<\/li><li>103<\/li><li>104<\/li><li>105<\/li><li>106<\/li><li>107<\/li><li>108<\/li><li>109<\/li><li>110<\/li><li>111<\/li><li>112<\/li><li>113<\/li><li>114<\/li><li>115<\/li><li>116<\/li><li>117<\/li><li>118<\/li><li>119<\/li><li>120<\/li><li>121<\/li><li>122<\/li><li>123<\/li><li>124<\/li><li>125<\/li><li>126<\/li><li>127<\/li><li>128<\/li><li>129<\/li><li>130<\/li><\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"2tomcat-\u542f\u52a8\u6587\u4ef6-tomcatini\">2.tomcat \u542f\u52a8\u6587\u4ef6 tomcat.ini<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>[program:tomcat]\ncommand=\/root\/tools\/apache-tomcat-7.0.70\/bin\/catalina.sh run\nstdout_logfile=\/root\/tools\/apache-tomcat-7.0.70\/logs\/catalina.out\nautostart=true\nautorestart=true\nstartsecs=5\npriority=1\nstopasgroup=true\nkillasgroup=true<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"4\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6\">4.\u52a0\u8f7d\u914d\u7f6e\u6587\u4ef6<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>supervisord -c \/etc\/supervisord.conf<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1.supervisorctl\u00a0http:\/\/localhost:9001\u00a0refused connection 1.\u6253\u5f00\u5982\u4e0b\u7684\u914d\u7f6e\uff1a 2.tomcat \u542f\u52a8\u62a5\u9519\uff1aFATAL Exited too quickly 1.\u8fd9\u662f\u56e0\u4e3a\u542f\u52a8 tomcat\u7684\u65b9\u5f0f\u4e0d\u5bf9\uff0c\u5728linux\u547d\u4ee4\u884c\u6a21\u5f0f\u4e0b\u6211\u4eec\u542f\u52a8\u53ef\u4ee5\u4f7f\u7528\u5982\u4e0b\u811a\u672c 2.\u5728supervisor\u7684\u542f\u52a8\u547d\u4ee4\u4e2d\u4e0d\u80fd\u4f7f\u7528\u8fd9\u79cd\u65b9\u5f0f\u4e86\u8981\u4f7f\u7528\u5982\u4e0b\u65b9\u5f0f\uff1a 3.\u5b8c\u6574\u914d\u7f6e\u6587\u4ef6\uff1a 1.supervisor \u914d\u7f6e\u6587\u4ef6 file=\/var\/tmp\/supervisor.sock ; (the path to the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[1],"tags":[],"class_list":["post-998","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts\/998","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=998"}],"version-history":[{"count":0,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=\/wp\/v2\/posts\/998\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=998"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=998"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.jsjs.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=998"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}