Sun ONE logo      上一個      目錄      索引      下一個     

Sun ONE Web Server 6.1 管理員指南

附錄 A
指令行公用程式

本附錄包含關於使用 HttpServerAdmin 指令行公用程式的說明。


HttpServerAdmin (虛擬伺服器管理)

HttpServerAdmin 是一個指令行公用程式,其執行的管理功能與 Server Manager 和 Class Manager 中虛擬伺服器使用者介面所執行的管理功能相同。如果您喜歡使用指令行介面設定虛擬伺服器,請使用 HttpServerAdmin


備註

若要使用 HttpServerAdmin 指令行公用程式,必須擁有系統的超級使用者權限。


HttpServerAdmin 指令行公用程式位於 server_root/bin/https/httpadmin/bin 目錄中。

您需要將環境變數 IWS_SERVER_HOME 設定為您環境下的伺服器根目錄,然後才可以執行 HttpServerAdmin

例如,在 UNIX/Linux 系統中:

setenv IWS_SERVER_HOME /usr/sun/servers

在 Windows 系統中:

  1. 在 [控制台] 上,選擇 [系統]。
  2. 按一下 [環境] 標籤。
  3. 在 [變數] 欄位中鍵入 IWS_SERVER_HOME,在 [值] 欄位中鍵入伺服器根的路徑。
  4. 按一下 [設定]。
  5. 按一下 [確定]。

  6. 備註

    為了執行所有指令,您需要對儲存虛擬伺服器資訊的檔案 server.xml 具有寫入許可權。


HttpServerAdmin 語法

HttpServerAdmin 語法如下所示:

HttpServerAdmin command_name command_options -d server_root -sinst http_instance

可以透過鍵入以下指令,取得指令參數的線上解釋:

./HttpServerAdmin -h

有四個可能的 command_name 參數值:

每個指令均具有自己的指令選項集。如需更多資訊,請參閱本章中描述各個指令的小節。

不考量指令參數的值,在表 A-1 中顯示的參數可以套用於 HttpServerAdmin 指令的所有用法。

表 A-1  HttpServerAdmin 參數

參數

-d server_root

(必需的)。此參數指定伺服器根 (即安裝伺服器的位置) 的路徑。

-sinst http_instance

(必需的)。此參數指定 HttpServerAdmin 影響哪些實例。

control 指令

使用 control 指令啟動、停止及停用類別與虛擬伺服器。如果您未指定虛擬伺服器,則指定會啟動、停止或停用類別中的每個虛擬伺服器。

選項

表 A-2 中顯示的選項與 control 指令配合使用,控制類別與虛擬伺服器。

表 A-2  control 指令選項

選項

-start

啟動指定的虛擬伺服器,或者啟動類別中所有的虛擬伺服器 (如果未指定任何虛擬伺服器)。

-stop

停止指定的虛擬伺服器,或者停止類別中所有的虛擬伺服器 (如果未指定任何虛擬伺服器)。

-disable

停用指定的虛擬伺服器,或者停用類別中所有的虛擬伺服器 (如果未指定任何虛擬伺服器)。

語法

HttpServerAdmin control -cl classname, -control_option [-id virtual_server] -d server_root -sinst http_instance

參數

將這些參數與指令選項配合使用,控制虛擬伺服器

表 A-3  control 指令參數

參數

-cl classname

指定虛擬伺服器類別

-id virtual_server

(選擇性的) 指定您正在控制的虛擬伺服器 ID。

範例

HttpServerAdmin control -cl myclass -start -id myvirtualserver -d /usr/sun/servers -sinst https-sun.com

HttpServerAdmin control -cl myclass -stop -id myvirtualserver -d /usr/sun/servers -sinst https-sun.com

HttpServerAdmin control -cl myclass -disable -id myvirtualserver -d /usr/sun/servers -sinst https-sun.com

create 指令

使用 create 指令建立虛擬伺服器的類別、虛擬伺服器以及偵聽套接字。

選項

表 A-4 中顯示的選項與 create 指令配合使用,來建立類別、偵聽套接字、虛擬伺服器和資源。

表 A-4  create 指令選項

選項

-c

建立虛擬伺服器類別。

-l

建立偵聽套接字。

-v

建立虛擬伺服器。

-r

建立資源。

這些選項中的每一個均具有自己的參數,在以下小節中將會介紹這些參數。

建立虛擬伺服器類別

使用 create 指令的此選項來建立虛擬伺服器類別。

語法

HttpServerAdmin create -c -cl classname -docroot document_root [-obj obj.conf_file] [-acptlang accept_language] -d server_root -sinst http_instance

參數

表 A-5 中顯示的參數與 create -c 指令選項配合使用,來建立類別。

表 A-5  建立虛擬伺服器類別參數

參數

-cl classname

您要建立的類別名稱。

-docroot document_root

類別的文件根。它必須是絕對路徑。

-obj obj.conf_file

(可選) 類別的 obj.conf 檔案。如果您未指定參數,則伺服器會將 obj.conf 檔案建立為 classname.obj.conf。如果您要為類別的 obj.conf 檔案指定其他名稱,請在此處指定。

-acptlang accept_language

(可選) 如果您未指定此參數,則 acptlang 依預設將不起作用。

範例

HttpServerAdmin create -c -cl myclass1 -docroot /docs -d /export/sun/servers -sinst https-sun.com

建立偵聽套接字

使用 create 指令的此選項來建立偵聽套接字。

語法

HttpServerAdmin create -l -ip ip_address -port port_number -sname server_name -id default_virtual_server [-sec security] [-acct number_of_accept_threads] -d server_root -sinst http_instance

參數

表 A-6 中顯示的參數與 create -l 指令選項配合使用,建立偵聽套接字。

表 A-6  建立偵聽套接字參數

參數

-ip ip_address

偵聽套接字的 IP 位址。

-port port_number

偵聽套接字的連接埠號。

-sname server_name

要與偵聽套接字關聯的伺服器名稱。

-id default_virtual_server

預設虛擬伺服器的 ID。此虛擬伺服器必須存在,您才可以使用它建立偵聽套接字。

-acct number_of_accept_threads

(可選) 偵聽套接字的接受執行緒數。

-sec on

(可選) 如果已經指定,請使用 on 來啟用偵聽套接字的安全性。如果沒有指定,則不會啟用安全性。

範例

HttpServerAdmin create -l -id ls3 -ip 0.0.0.0 -port 1333 -sname austen -defaultvs vs2 -sec on -acct 4 -d /export/carey/server6 -sinst https-austen.com

建立虛擬伺服器

使用 create 指令的此選項來建立虛擬伺服器。

請注意,如果您未將某些選擇性參數的值包括在內,則會提供預設值。在建立虛擬伺服器之後,您隨時可以變更預設值。

語法

HttpServerAdmin create -v -id virtual_server -cl classname -urlh urlhosts [-state state][-docroot document_root] [-mime mime_types_file] [-aclid acl_ID] -d server_root -sinst http_instance

參數

表 A-7 中顯示的參數與 create -v 指令選項配合使用,建立虛擬伺服器。

表 A-7  建立偵聽套接字參數

參數

-id virtual_server

您正在建立的虛擬伺服器 ID。

-cl classname

虛擬伺服器將作為其成員的那個類別。

-urlh URL_hosts

虛擬伺服器的 URL 主機。您可以指定多個 URL 主機,主機之間以逗號分隔。

-state state

(可選) 有效值為 on、off、disable。

-docroot document_root

(可選) 如果您想要為虛擬伺服器指定文件根,請使用此參數。您必須使用絕對路徑名稱。

-mime mime_types_file

(可選) 虛擬伺服器的 MIME 類型檔案之名稱。

-aclid acl_ID

(可選) server.xml 檔案中使用的 ACL 檔案 ID <ACLID>

範例

HttpServerAdmin create -v -id vs3 -cl class1 -urlh annh -d /export/sun/server6 -sinst https-sun.com

HttpServerAdmin create -v -id vs4 -cl class1 -urlh annh,annh2 -state off -mime mime.types -d /export/sun/server6 -sinst https-sun.com

建立 JDBC 連線池

使用 create -r 指令,透過指令行介面建立新的 JDBC 連線池。

語法

HttpServerAdmin -create -r -jdbcconnectionpool -poolname jdbcpoolname -classname classname [-steadypoolsize steadypoolsize] [-maxpoolsize maxpoolsize] [-poolresizequantity poolresizequantity] [-idletimeout idletimeout] [-maxwaittime maxwaittime] [-connectionvalidation true/false] [-connectionvalidationmethod connectionvalidationmethod] [-validationtablename validationtablename] [-failall true/false] [-desc description] [[-property propertyname=value],...]

選項

下表概述了使用 create -r 指令選項建立連線池所需要的全部選項。

表 A-8  建立連線池參數

參數

poolname jdbcpoolname

JDBC 連線池的池名稱。

classname classname

執行資料來源的供應商特定類別名稱。

steadypoolsize steadypoolsize

必須在池中維護的最小連線數。

maxpoolsize maxpoolsize

池中允許的最大連線數。

poolresizequantity poolresizequantity

接近 steadypoolsize 值時,重調池所依據的批次大小。

idletimeout idletimeout

連線可以在池中閒置的最大時間 (以秒表示)。

maxwaittime maxwaittime

呼叫者在取得連線逾時之前要等待的時間。

connectionvalidation true/false

指定連線在傳送至應用程式之前是否會得到驗證。

connectionvalidationmethod connectionvalidationmethod

可以用來驗證資料庫連線的方法。合法值為 auto-commitmeta-datatable

validationtablename validationtablename

connectionvalidationmethod 設定為 table 時的表格名稱。

failall true/false

指定如果決定單一連線無效,是否要使池中的所有連線無效,然後重新建立連線。

desc description

池描述。

property propertyname=value

指定標準與專用 JDBC 連線池特性的名稱值對。

範例

HttpServerAdmin create -r -jdbcconnectionpool -poolname testpool -classname "oracle.jdbc.pool.OracleDataSource" -property "URL=jdbc:oracle:thin:@dbhost:1521:ORCL,user=scott,password=tiger" -d /opt/Sun/S1WS6.1 -sinst testinstance

建立 JDBC 資源

使用 create -r 指令,透過指令行介面建立新的 JDBC 資源。

語法

HttpServerAdmin -create -r -jdbc -jndiname jndiname -poolname poolname [-desc description] [-enabled true/false]

選項

下表概述了使用 create -r 指令選項建立新的 JDBC 資源所需要的全部選項。

表 A-9  建立 JDBC 資源參數

參數

jndiname jndiname

資源的 JNDI 名稱。

poolname poolname

JDBC 連線池的池名稱。

desc description

池描述。

enabled true/false

指定是啟用還是停用資源。

如果停用 JDBC 資源,則沒有應用程式元件可以與之連線,但是其配置仍保留在伺服器實例中。

範例

HttpServerAdmin create -r -jdbc -jndiname "jdbc/testjdbcresource" -poolname testpool -d /opt/Sun/S1WS6.1 -sinst testinstance

建立自訂資源

使用 create -r 指令,透過指令行介面建立新的自訂資源。

語法

HttpServerAdmin -create -r -custom -jndiname jndiname -resourcetype resourcetype -factoryclass factoryclassname [-enabled true/false] [-desc description] [[-property propertyname=value],...]

選項

下表概述了使用 create -r 指令選項建立新的 JDBC 資源所需要的全部選項。

表 A-10  建立自訂資源參數

參數

jndiname jndiname

資源的 JNDI 名稱。

resourcetype resourcetype

資源類型。

factoryclassname factoryclassname

物件工廠的類別名稱。

enabled true/false

指定是啟用還是停用資源。

desc description

池描述。

property propertyname=value

指定自訂資源特性的名稱值對。

範例

HttpServerAdmin create -r -custom -jndiname "testcustomresource" -resourcetype "java.lang.String" -factoryclass "com.mycom.test.StringFactory" -d /opt/Sun/S1WS6.1 -sinst testinstance

建立外部 JNDI 資源

使用 create -r 指令,透過指令行介面建立新的外部 JNDI 資源。

語法

HttpServerAdmin -create -r -external -jndiname jndiname -jndilookupname jndilookupname -restype restype -factoryclass factoryclass [-enabled true/false] [-desc description] [[-property propertyname=value],...]

選項

下表概述了使用 create -r 指令選項建立新的外部 JNDI 資源所需要的全部選項。

表 A-11  建立外部 JNDI 資源參數

參數

jndiname jndiname

資源的 JNDI 名稱。

jndilookupname jndilookupname

資源的 JNDI 查找名稱。

restype restype

資源類型。

factoryclass factoryclass

物件工廠的類別名稱。

enabled true/false

指定是啟用還是停用資源。

desc description

池描述。

property propertyname=value

指定自訂資源特性的名稱值對。

範例

HttpServerAdmin create -r -external -jndiname "testexternalresource" -jndilookupname "rmiconverter" -restype "samples.rmi.simple.ejb.ConverterHome" -factoryclass "com.sun.jndi.cosnaming.CNCtxFactory" -property "java.naming.provider.url=iiop://localhost:3700" -d /opt/Sun/S1WS6.1 -sinst testinstance

建立郵件資源

使用 create -r 指令,透過指令行介面建立新的郵件資源。

語法

HttpServerAdmin -create -r -mail -jndiname jndiname -host host -user user -from from [-storeprotocol storeprotocol] [-storeprotocolclass storeprotocolclass] [-transportprotocol transportprotocol] [-transportprotocolclass transportprotocolclass] [-enabled true/false] [-desc description] [[-property propertyname=value]...]

選項

下表概述了使用 create -r 指令選項建立新的郵件資源所需要的全部選項。

表 A-12  建立郵件資源參數

參數

jndiname jndiname

資源的 JNDI 名稱。

host host

郵件伺服器主機名稱。

user user

郵件伺服器使用者名稱。

from from

郵件伺服器用來指示訊息寄件者的電子郵件位址。

storeprotocol storeprotocol

指定儲存協定服務,其可以連線至郵件伺服器、擷取訊息以及將訊息儲存在資料夾中。範例值為 imappop3

storeprotocolclass storeprotocolclass

指定儲存的服務供應程式執行類別。

此類別的位址為︰

  • http://java.sun.com/products/javamail/
  • http://java.sun.com/products/javabeans/glasgow/jaf.html

transportprotocol transportprotocol

指定傳送訊息的傳輸協定服務。

transportprotocolclass transportprotocolclass

指定傳輸的服務供應程式執行類別。

此類別的位址為︰

  • http://java.sun.com/products/javamail/
  • http://java.sun.com/products/javabeans/glasgow/jaf.html

enabled true/false

決定在執行期間是否啟用此資源。合法值為 onoffyesno10truefalse

desc description

資源的描述。

property propertyname=value

指定自訂資源特性的名稱值對。

範例

HttpServerAdmin create -r -mail -jndiname "localmail" -host localhost -user mailid -from mailid@mailhost -d /opt/Sun/S1WS6.1 -sinst testinstance

delete 指令

使用 delete 指令刪除虛擬伺服器的類別、虛擬伺服器以及偵聽套接字。

選項

表 A-13 中顯示的選項與 delete 指令配合使用,來刪除類別。

表 A-13  delete 指令選項

選項

-c

刪除指定的虛擬伺服器類別。

-l

刪除指定的偵聽套接字 ID

-v

刪除指定的虛擬伺服器。

-r

刪除指定的資源。

刪除類別

使用 delete 指令的此選項來刪除虛擬伺服器類別。

語法

HttpServerAdmin delete -c -cl classname -d server_root -sinst http_instance

參數

表 A-13 中顯示的參數與 delete 指令配合使用,來刪除類別。

表 A-14  刪除類別參數

參數

-c l class

您要刪除的類別名稱。

範例

HttpServerAdmin delete -c -cl class1 -d /export/sun/server6 -sinst https-sun.com

刪除偵聽套接字

使用 delete 指令的此選項來刪除偵聽套接字。

語法

HttpServerAdmin delete -l -id listen_socket -d server_root -sinst http_instance

參數

表 A-13 中顯示的參數與 delete 指令配合使用,來刪除類別。

表 A-15  刪除類別參數

參數

-id listen_socket

您要刪除的偵聽套接字之 ID。

範例

HttpServerAdmin delete -l -id ls3 -d /export/sun/server6 -sinst https-sun.com

刪除虛擬伺服器

使用 delete 指令的此選項來刪除虛擬伺服器。

語法

HttpServerAdmin delete -v -id virtual_server -cl classname -d server_root -sinst http_instance

參數

表 A-13 中顯示的參數與 delete 指令配合使用,來刪除虛擬伺服器。

表 A-16  刪除虛擬伺服器參數

參數

-id virtual_server

您要刪除的虛擬伺服器 ID。

-cl class

虛擬伺服器的所屬類別。

範例

HttpServerAdmin delete -v -id vs3 -cl class1 -d /export/sun/server6 -sinst https-sun.com

刪除 JDBC 連線池

使用 delete 指令的此選項來刪除連線池。

語法

HttpServerAdmin delete -r jdbcconnectionpoolname

參數

表 A-13 中顯示的參數與 delete 指令配合使用,來刪除連線池。

表 A-17  刪除連線池參數

參數

connectionpoolname

您要刪除的連線池之名稱。

範例

HttpServerAdmin delete -r connpool

刪除 JNDI 資源

使用 delete 指令的此選項來刪除 JNDI 資源。

語法

HttpServerAdmin delete -r jndiname

參數

表 A-13 中顯示的參數與 delete 指令配合使用,來刪除 JNDI 資源。

表 A-18  刪除 JNDI 資源參數

參數

jndiname

您要刪除的資源之 JNDI 名稱。

範例

HttpServerAdmin delete -r testresource

list 指令

使用 list 指令列示虛擬伺服器的類別、虛擬伺服器、偵聽套接字以及資源。

語法

HttpServerAdmin list -command_option -d server_root -sinst http_instance

選項

表 A-19  list 指令選項

選項

-c

列示所有虛擬伺服器類別。

-l

列示所有偵聽套接字。

-v

列示所有虛擬伺服器。

-r

列示指定的資源。

範例

HttpServerAdmin list -c -d /export/sun/server6 -sinst https-sun.com

HttpServerAdmin list -l -d /export/sun/server6 -sinst https-sun.com

資訊的清單顯示在指令視窗中。



上一個      目錄      索引      下一個     


Copyright 2004 Sun Microsystems, Inc. 版權所有。