隨筆-25  評論-6  文章-0  trackbacks-0
          tomcat5.5的管理功能非常強,只要你配置好了tomcat-user.xml.

          主要是增加一個具有系統(tǒng)管理權(quán)限的用戶,比如增加一個用戶名和密碼都是suxiaoyong的用戶,只需要在在最后一行增加

          代碼
          <user username="suxiaoyong" password="suxiaoyong" roles="admin,manager"/>


          其他的用戶都可以刪掉了

          然后,我們可以進入http://localhost:8080/manager/status 來查看服務(wù)器的各種狀態(tài).

          也可以通過url來直接對應(yīng)用進行監(jiān)控

          命令格式
          代碼
          http://{ host }:{ port }/manager/{ command }?{ parameters }


          部署一個應(yīng)用

          代碼
          http://localhost:8080/manager/deploy?path=/foo

          http://localhost:8080/manager/deploy?path=/foo

          http://localhost:8080/man......o&war=file:/path/to/foo

          http://localhost:8080/manager/deploy?war=foo

          http://localhost:8080/man......ath=/bartoo&war=bar.war


          列出已經(jīng)部署的應(yīng)用

          代碼
          http://localhost:8080/manager/list


          重新加載一個應(yīng)用


          比如你更新了class或者lib的話,需要重新加載系統(tǒng)

          代碼
          http://localhost:8080/manager/reload?path=/examples


          查看jvm和系統(tǒng)信息

          代碼
          http://localhost:8080/manager/serverinfo


          查看可用的安全角色

          代碼
          http://localhost:8080/manager/roles


          查看某個應(yīng)用默認的session超時時間和當(dāng)前活躍的session數(shù)

          代碼
          http://localhost:8080/manager/sessions?path=/examples


          啟動一個應(yīng)用

          比如有時候重新啟動數(shù)據(jù)庫后可能需要重新啟動應(yīng)用

          代碼
          http://localhost:8080/manager/start?path=/examples


          關(guān)閉一個應(yīng)用

          關(guān)閉后,任何發(fā)往該應(yīng)用的請求都將轉(zhuǎn)向404錯誤的頁面

          代碼
          http://localhost:8080/manager/stop?path=/examples

          ?
          undeploy

          慎用,將刪除應(yīng)用的目錄及其war文件

          ant腳本,更多的詳見tomcat5.5的文檔

          代碼
          <project name="My Application" default="compile" basedir=".">

          ?<!-- Configure the directory into which the web application is built -->
          ?<property name="build" ? ?value="${ basedir }/build"/>

          ?<!-- Configure the context path for this application -->
          ?<property name="path" ? ? value="/myapp"/>

          ?<!-- Configure properties to access the Manager application -->
          ?<property name="url" ? ? ?value="http://localhost:8080/manager"/>
          ?<property name="username" value="myusername"/>
          ?<property name="password" value="mypassword"/>

          ?<!-- Configure the custom Ant tasks for the Manager application -->
          ?<taskdef name="deploy" ? ?classname="org.apache.catalina.ant.DeployTask"/>
          ?<taskdef name="list" ? ? ?classname="org.apache.catalina.ant.ListTask"/>
          ?<taskdef name="reload" ? ?classname="org.apache.catalina.ant.ReloadTask"/>
          ?<taskdef name="resources" classname="org.apache.catalina.ant.ResourcesTask"/>
          ?<taskdef name="roles" ? ? classname="org.apache.catalina.ant.RolesTask"/>
          ?<taskdef name="start" ? ? classname="org.apache.catalina.ant.StartTask"/>
          ?<taskdef name="stop" ? ? ?classname="org.apache.catalina.ant.StopTask"/>
          ?<taskdef name="undeploy" ?classname="org.apache.catalina.ant.UndeployTask"/>

          ?<!-- Executable Targets -->
          ?<target name="compile" description="Compile web application">
          ? ?<!-- ... construct web application in ${ build } subdirectory, and
          ? ? ? ? ? ?generated a ${ path }.war ... -->
          ?</target>

          ?<target name="deploy" description="Install web application"
          ? ? ? ? ?depends="compile">
          ? ?<deploy url="${ url }" username="${ username }" password="${ password }"
          ? ? ? ? ? ?path="${ path }" war="${ build }${ path }.war"/>
          ?</target>

          ?<target name="reload" description="Reload web application"
          ? ? ? ? ?depends="compile">
          ? ?<reload ?url="${ url }" username="${ username }" password="${ password }"
          ? ? ? ? ? ?path="${ path }"/>
          ?</target>

          ?<target name="undeploy" description="Remove web application">
          ? ?<undeploy url="${ url }" username="${ username }" password="${ password }"
          ? ? ? ? ? ?path="${ path }"/>
          ?</target>

          </project>


          posted on 2006-06-12 10:28 MyJavaWorld 閱讀(465) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 辽阳市| 营口市| 伊春市| 若尔盖县| 赤水市| 永兴县| 固安县| 灵宝市| 城固县| 常熟市| 宁陵县| 名山县| 苗栗县| 樟树市| 广元市| 隆安县| 赤水市| 文化| 昭苏县| 绿春县| 会泽县| 镇平县| 康平县| 盐池县| 略阳县| 四会市| 灌南县| 朔州市| 随州市| 辉南县| 元阳县| 龙井市| 崇左市| 弥勒县| 昌平区| 黎川县| 华蓥市| 轮台县| 霸州市| 左云县| 得荣县|