📄 guide-admin.xtp
字号:
need to configure the host, or add <ahref="host-tags.xtp#host-alias"><host-alias></a> tags, you can addthem to a <code>hosts/bar.com/host.xml</code> file.</p><p>Deploying a web-application is also straightforward by addinga .war file to <code>webapps/foo.war</code> or<code>webapps/ROOT.war</code>. <code>webapps/ROOT</code> is a specialweb-app which handles the root URL, "/".</p><p>In a standard Unix deployment, your configuration files go in<code>/etc/resin</code> and typically includes the<code>resin.xml</code> and the <code>app-default.xml</code>.<code>app-default.xml</code> contains standard configuration like thestatic file servlet, JSP, PHP servlets, as well as the standardmime-type mappings.</p><p>The Resin jars, JNI libraries and licenses go in<code>/usr/lib/resin</code>, typically ownedby root. The <code>resin</code> directory itself will normally be asymbolic link to the Resin version, so you can upgrade easily.</p><example title="Example: Unix dynamic virtual host">/etc/resin/ resin.xml - main Resin configuration file app-default.xml - default servlet configuration admin-users.xml - /resin-admin users/etc/init.d/resin - startup script/usr/lib/resin/ - ${resin.home} lib/*.jar - Resin's Java classes libexec/*.so - native JNI libraries libexec64/*.so - JNI for 64-bit systems licenses/* - Resin Pro licenses win32/*.dll - Win32 JNI win64/*.dll - Win64 JNI /var/www/ - ${resin.root} admin/ - Resin database and cache storage doc/admin/ - /resin-admin source ivy2/ - ivy2 jar repository lib/ - Shared application jars log/ - watchdog and Resin debug logging hosts/foo.com/ - dynamic host contents log/ - access logging per virtual host host.xml - optional host-specific configuration webapps/ROOT/ - web-app content index.php - web-app content WEB-INF/ - web-app classes and configuration web.xml - servlet-standard configuration resin-web.xml - Resin-specific configuration lib/*.jar - application jars classes/**/*.class - application classes work/ - work directory for JSP, PHP, etc.</example><example title="Example: /etc/resin/resin.xml"><resin xmlns="http://caucho.com/ns/resin" xmlns:resin="http://caucho.com/ns/resin/core"> <root-directory>/var/www</root-directory> <cluster id=""> <server id="" address="127.0.0.1" port="6800"> <http port="8080"/> </server> <resin:import path="/etc/resin/app-default.xml"/> <host-default> <resin:import path="host.xml" optional="true"/> <web-app-deploy path="webapps"/> </host-default> <host-deploy path="hosts"/> </cluster></resin></example></s2><s2 title="Apache Upgrade"><p>In an Apache upgrade, you have an existing site that you'reupgrading to use Quercus or just evaluating the performanceimprovement for an existing side. The content is placedin <code>/var/www/htdocs</code> directory, and there's only a singlevirtual host and single root web-app.</p><p>For Apache-style sites with multiple virtual hosts, you can add new<a href="host-tags.xtp#host"><host></a> tags for each host, and adda <a href="host-tags.xtp#root-directory"><root-directory></a> toset the host's root.</p><example title="Example: Unix Apache upgrade">/etc/resin/ resin.xml - main Resin configuration file app-default.xml - default servlet configuration/etc/init.d/resin - startup script/usr/local/share/resin/ - ${resin.home} lib/*.jar - Resin's Java classes ... /var/www/ - ${resin.root} admin/ - Resin database and cache storage log/ - watchdog and Resin debug logging logs/ - HTTP access logging htdocs/ index.php - web-app content WEB-INF/ - web-app classes and configuration resin-web.xml - Resin-specific configuration lib/*.jar - application jars classes/**/*.class - application classes work/ - work directory for JSP, PHP, etc.</example><example title="Example: /etc/resin/resin.xml"><resin xmlns="http://caucho.com/ns/resin" xmlns:resin="http://caucho.com/ns/resin/core"> <root-directory>/var/www</root-directory> <cluster id=""> <server id="" address="127.0.0.1" port="6800"> <http port="8080"/> </server> <resin:import path="/etc/resin/app-default.xml"/> <host id=""> <web-app id="" root-directory="htdocs"/> </host> </cluster></resin></example></s2><s2 title="Java App-Server directory structure"><p>A common Java app-server deployment structure looks like amixture of the full dynamic host configuration and the Apache-stylestatic configuration. The virtual hosts are configured staticallylike Apache, but webapps are created dynamically by dropping .warfiles in a <code>webapps</code> directory.</p><example title="Example: Java app-server structure">/etc/resin/ resin.xml - main Resin configuration file app-default.xml - default servlet configuration/etc/init.d/resin - startup script/usr/local/share/resin/ - ${resin.home} lib/*.jar - Resin's Java classes ... /var/www/ - ${resin.root} admin/ - Resin database and cache storage log/ - watchdog and Resin debug logging logs/ - HTTP access logging webapps/ ROOT/ - web-app for "/" index.php - web-app content WEB-INF/ - web-app classes and configuration resin-web.xml - Resin-specific configuration lib/*.jar - application jars classes/**/*.class - application classes work/ - work directory for JSP, PHP, etc. wiki/ - web-app for "/wiki" ... drupal/ - web-app for "/wiki" index.php</example><example title="Example: /etc/resin/resin.xml"><resin xmlns="http://caucho.com/ns/resin" xmlns:resin="http://caucho.com/ns/resin/core"> <root-directory>/var/www</root-directory> <cluster id=""> <server id="" address="127.0.0.1" port="6800"> <http port="8080"/> </server> <resin:import path="/etc/resin/app-default.xml"/> <host id=""> <web-app-deploy path="webapps"/> </host> </cluster></resin></example></s2></s1><s1 title="Threads, Memory and Sockets"><p>A Resin server needs to have enough memory, threads, and sockets tohandle the user load. For the most part, the defaults provide a goodstarting point, but it's a good idea to become familiar with theprimary resources.</p><ul><li><b>memory</b> - divided into heap, thread stack, PermGen space,and some specialized JVM/JNI space. With a 32-bit machine, you arelikely to run into virtual memory limits. Even with a 64-bit machine,you need enough swap to handle your virtual memory size.</li><li><b>sockets</b> - a TCP connection to the browser. Each user usesone or sockets as long as the browser is connected. Sockets use up<b>file descriptors</b> on Unix, which are also used by databaseconnections, and open files. The <em>netstat</em> command isimportant for threading.</li><li><b>threads</b> - an program execution, taking up CPU and virtualmemory (for the thread stack). Active requests use CPU, while evenblocked threads take up memory.</li></ul><s2 title="Memory"><p>Memory is the most important configuration item for the machine.You need enough virtual memory to handle heap, stack, and permanentmemory, and enough physical memory to avoid swapping. If the JVMruns out of memory, it may throw <code>OutOfMemoryError</code> andforce a restart of the server.</p><ul><li><b>heap</b> - Java memory used for all application objects. Heapmemory is garbage collected periodically, causing the JVM to stop orslow while finding unused memory. The maximum heap is set by the<code>-Xmx512m</code> command-line argument in <ahref="server-tags.xtp#jvm-arg"><jvm-arg></a>.</li><li><b>PermGen (permanent generation)</b> is JVM memory for permanentdata like Java class code, JNI code, shared libraries, mmapped memory(jars), and the JVM itself. Configured by<code>-XX:PermGen=128M</code>. The JVM default usually needsto be increased.</li><li><b>thread stack</b> - Each thread takes up virtual memory for itsexecution stack. Since the default is 1M and having 1000 threads isfairly common, you can use 1G of virtual memory just for the threadstack. The thread stack is configured by <code>-Xss1m</code></li><li><b>virtual memory</b> is total memory allocated to the JVM by theoperating system. VM = heap + stack + PermGen. For a 32-bit system,you might have as little as 2Gfor all the heap, stack, and PermGen. You also need to haveenough <b>swap</b> memory to handle your virtual memory, especially ifyou have a large heap, lots of threads, or even lots of largejars.</li></ul></s2></s1><s1 title="Notifications"><p>Resin can notify you by email when it detects something wrong with theserver. The main mechanism is adding a new logging handler sending mailfor warning and severe messages. When a log entry is added at the WARNINGor SEVERE level, Resin will send a mail containing the log information. Youcan then look at the administration console to debug any problems.</p><p>The configuration is described in the <a href="config-log.xtp#mail">logging configuration</a> section.</p><example title="Example: resin.xml with mail logging"><resin xmlns="http://caucho.com/ns/resin"> <log-handler name="" level="warning" uri="mail:"> <init> <to>admin@foo.com</to> <properties> mail.smtp.host=127.0.0.1 mail.smtp.port=25 </properties> </init> </log-handler> </resin></example></s1> </body></document>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -