1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318
|
<HTML><HEAD>
<TITLE>Server Administration -- AOLserver's Control Port Interface</TITLE>
<LINK rel=Previous href="acc-ch.htm">
<LINK rel=ToC href="toc.htm">
<LINK rel=Index href="master.htm">
<LINK rel=Next href="acc-ch2.htm">
</HEAD><BODY BGCOLOR="#ffffff"><A NAME="topofpage"></A>
<TABLE WIDTH=100%>
<TR>
<TD ALIGN=LEFT>
<A NAME="topofpage"></A> <IMG SRC="as-c-sm.gif">
</TD>
<TD ALIGN=RIGHT>
<A href="acc-ch.htm"><IMG BORDER="0" src=navbprev.gif alt="[ Previous ]"></A>
<A href=toc.htm> <IMG BORDER="0" src=navbhome.gif alt="[ Contents ]"></A>
<A href=master.htm> <IMG BORDER="0" src=navbhelp.gif alt="[ Index ]"></A>
<A href="acc-ch2.htm"> <IMG BORDER="0" src=navbnext.gif alt="[ Next ]"></A>
<A name="7983"> </A>
</TD>
</TR>
</TABLE>
<a name="12755">
</a><h3>AOLserver's Control Port Interface</h3>
<p><a name="20806">
</a>AOLserver includes a control port interface that can be enabled with the nscp module. This control port interface allows you to telnet to a specified host and port where you can administer the server and execute database commands while the server is running.</p>
<p><a name="20814">
</a>The control port interface is a Tcl interface. Within it, you can execute Tcl commands (including AOLserver's Tcl API commands), operating system commands, SQL commands, and even edit files with the vi editor. AOLserver's Tcl commands allow you to define users, groups and permission records, as well as execute database commands.</p>
<p><a name="20761">
</a>To administer a server with the control port interface while it is running, the nscp module must be loaded into the server. To set permissions for the server, the nsperm module must also be loaded. To execute database commands while the server is running, you must also configure database services for the server, including database drivers and pools.</p>
<a name="20928">
</a><h4>Configuring the Control Port Interface</h4>
<p><a name="21152">
</a>An example configuration for the control port interface is shown below. Three sections of the configuration file are included. The nscp module is loaded into the /modules section for server1. The /module/nscp section defines the control port parameters, and the /module/nscp/users section defines the users who can log into the control port.</p>
<pre> <a name="21236"></a>ns_section "ns/server/server1/modules"
<a name="21237"></a>ns_param nscp nscp.so
<a name="21238"></a>
<a name="21239"></a>ns_section "ns/server/server1/module/nscp"
<a name="21241"></a>ns_param port 9999
<a name="21244"></a>ns_param address 127.0.0.1
<a name="21247"></a>ns_param binary bin/nscp
<a name="21248"></a>
<a name="21249"></a>ns_section "ns/server/server1/module/nscp/users"
<a name="21256"></a>ns_param user "nsadmin:t2GqvvaiIUbF2:"
</pre><p><p><a name="21328">
</a>Some things to notice about the configuration are:</p>
<ul><li>The port parameter defines the port that the interface will listen on. The default is 9999.<a name="21329">
</a>
<p><li>The address parameter defines the hostname to bind to. The default is 127.0.0.1 so that you can only connect to the control port if you are already logged on to the computer where the server is running.<a name="21332">
</a>
<p><li>The binary parameter defines where to find the nscp binary, which resides in the bin directory by default.<a name="21333">
</a>
<p><li>The user parameter defines users who can log into the control port. There are three semicolon-separated fields. The first is username (nsadmin); the second is a standard unix-hashed password; the third is the path to a GNU readline 4.0 standard inputrc file. The inputrc file specifies key bindings; by default AOLserver ships with one that binds keys to the tcsh shell default settings. The inputrc file will only work properly if the nscp module is compiled with the GNU Readline library. By default, not all of the default tcsh.inputrc file is supported.<a name="21340">
</a>
<p></ul><p><a name="21376">
</a>See <a href="con-ch.htm#103550">Chapter 4</a> for complete information on configuration.</p>
<a name="20855">
</a><h4>Using the Control Port Interface</h4>
<p><a name="20913">
</a>To use the control port interface, follow these steps:</p>
<ol>
<li>Telnet to the address and port number defined in the /module/nscp section for the server. For example:
<a name="21380">
</a><p>
<pre> <a name="21382"></a><b>telnet localhost 9999
</b></pre><p><dl>
<dt>The session responds with:<a name="21383">
</a>
<p></dl>
<pre> <a name="21386"></a>Trying 127.0.0.1...
<a name="21387"></a>Connected to localhost.
<a name="21388"></a>Escape character is '^]'.
<a name="21389"></a>Welcome to the AOLserver control port!
<a name="21390"></a>login:
</pre><p><li>At the login prompt, type a valid username. The username must be one of the usernames defined in the /module/nscp/users section of the configuration file. For example:
<a name="21642">
</a><p>
<pre> <a name="21760"></a>login: <b>nsadmin
</b></pre><p><dl>
<dt>The session responds with:<a name="21674">
</a>
<p></dl>
<pre> <a name="21767"></a>password:
</pre><p><li>At the password prompt, type the password associated with the username you specified.
<a name="21789">
</a><p>
<dl>
<dt>The session responds with:<a name="21802">
</a>
<p></dl>
<pre> <a name="21790"></a>Checking authorization
<a name="21791"></a>Login successful!
<a name="21792"></a>214 commands
<a name="21793"></a>sourcing /modules/nscp/tcsh.inputrc
<a name="21794"></a>server1>
</pre><p><dl>
<dt>Note that the inputrc file is sourced when the session starts.<a name="21795">
</a>
<p></dl>
<li>At the server1 prompt, you may type any of the following types of commands:
<a name="21787">
</a><p>
<ul>
<li><b>Tcl commands:</b> See the <i>AOLserver Tcl Developer's Guide</i> for detailed information on the available Tcl commands. For example, you can type the <b>ns_info</b> command to find out various information about the server:<a name="21805">
</a>
<p></ul>
<pre> <a name="21806"></a> server1> <b>ns_info pageroot
</b> <a name="21816"></a> /disk5/ohenry/servers/server1/pages
</pre><p><ul>
<li><b>Operating system commands:</b> Operating system commands must be preceded by an exclamation point (!). For example:<a name="21809">
</a>
<p></ul>
<pre> <a name="21812"></a> server1> <b>!who
</b> <a name="21825"></a> ohenry ttyq1 Apr 27 07:57
<a name="21826"></a> ohenry ttyq2 Apr 27 08:41
<a name="21827"></a> ohenry ttyq3 Apr 27 15:01
<dl>
<dt>or:<a name="21813">
</a>
<p></dl>
<a name="21810"></a> server1> <b>!csh
</b> <a name="21811"></a> %
</pre><p><ul>
<li><b>vi Editor: </b>You can type vi at the prompt to invoke the vi editor. Inside the editor, you can type whatever commands you like. When you save and exit, the commands will be executed.<a name="21814">
</a>
<p><li><b>exit:</b> Type exit at the prompt to close the connection to the control port.<a name="21815">
</a>
<p></ul>
<pre> <a name="21839"></a> server1> <b>exit
</b></pre><p><li>You can enter SQL commands by entering DB mode. Enter DB mode by executing the <b>ns_cport</b> <b>db</b> command and specifying a database pool. SQL commands can span multiple lines and must be terminated by a semicolon. To return to Tcl mode to enter Tcl commands, enter a semicolon by itself. For example:
<a name="25400">
</a><p>
<pre> <a name="27279"></a> server1> <b>ns_cport db devpool
</b> <a name="27301"></a> DB mode started.
<a name="27302"></a> Enter SQL statements terminated with a semicolon.
<a name="27303"></a> To return to Tcl mode, type a semicolon on a line by itself.
<a name="27304"></a> server1> <b>select * from names;
</b> <a name="27305"></a> first last age
<a name="27306"></a> ------------------------
<a name="27307"></a> Al Smith 23
<a name="27308"></a> Hugh James 30
<a name="27309"></a> server1> <b>insert into names
</b> <a name="27310"></a><b> =>(first, last, age)
</b> <a name="27311"></a><b> =>values
</b> <a name="27312"></a><b> =>('Anita', 'Bass', 38)
</b> <a name="27313"></a><b> =>;
</b> <a name="27314"></a> server1> <b>;
</b> <a name="27315"></a> DB mode exited; now processing Tcl commands.
<a name="27316"></a> server1>
</pre><p><dl>
<dt>If you type <b>ns_cport</b> <b>db</b> with no pool name, a list of pools is displayed. For example:<a name="27223">
</a>
<p></dl>
<pre> <a name="27331"></a> server1> <b>ns_cport db
</b> <a name="27332"></a> Please specify one of the following db pools:
<a name="27224"></a> devpool: Development database
<a name="27225"></a> salespool: Sales database
<a name="27226"></a> server1> <b>ns_cport db devpool
</b></pre><p><ul>
<li><a name="29045">
</a>
<p></ul>
<li>You can get help in the control port by typing a question mark, '?' in the following ways:
<a name="29068">
</a><p>
<ul>
<li>If you type a question mark by itself, some brief help is provided as shown below:<a name="29121">
</a>
<p></ul>
<pre> <a name="29124"></a>server1> <b>?
</b> <a name="29156"></a>? Show this help text
<a name="29157"></a>?[string] Do an apropos search on [string] of AOLserver
<a name="29158"></a> commands
<a name="29238"></a>![command] Execute [command]; for example, !/bin/sh
runs a shell
<a name="29239"></a>vi Run vi and then execute the buffer, if saved
<a name="29161"></a>exit Exit the control port
<a name="29162"></a>[tclcommand] Execute [tclcommand] within AOLserver
<a name="29163"></a>ns_menu An easy-to-use menu with basic administration
<a name="29164"></a> commands
<a name="29138"></a>ns_cport db [pool] Evaluate SQL statements directly commands
<a name="29309"></a>
</pre><p><ul>
<li>If you type a question mark followed by a string, a search for the string is performed of the Tcl man pages, and matching commands are displayed. For example:<a name="29250">
</a>
<p></ul>
<pre> <a name="29277"></a>server1> <b>?write
</b> <a name="29278"></a>ns_rwlock - Create, destroy, and manipulate
read/write locks
<a name="29279"></a>ns_write - Write raw content back to the client
<a name="29280"></a>ns_writecontent - Write content to a file
<a name="29281"></a>ns_writefp - Write file contents to the connection
<a name="29271"></a>
</pre><p><li>Some other features of the control port interface are:
<a name="29097">
</a><p>
<ul>
<li><b>Repeat commands:</b> There is a history mechanism; you can use the up-arrow and down-arrow keys, or the ^P and ^N keystrokes to scroll through previous commands.<a name="29098">
</a>
<p><li><b>Tab completion:</b> If you type part of a command (such as ns_logr) and then press the tab key, the rest of the command (ns_logroll) will be filled in for you. If there are multiple possibilites for the end of the command, press the tab key twice to get a list of them.<a name="29099">
</a>
<p></ul>
</ol>
<a name="27900">
</a><h4>Administering AOLserver in the Control Port</h4>
<p><a name="27925">
</a>An interactive interface for administering AOLserver is available when you execute the <b>ns_menu</b> command in the control port interface. </p>
<a name="27944">
</a><h4>Top Level Menu</h4>
<p><a name="27953">
</a>When you type ns_menu in the control port interface, the following menu is displayed:</p>
<pre> <a name="27966"></a>server1> <b>ns_menu
</b> <a name="27967"></a>1. Logging
<a name="27968"></a>2. Thread info
<a name="27969"></a>3. Caching
<a name="27970"></a>4. Change password
<a name="27971"></a>5. Restart server
<a name="27972"></a>Your choice [1-5]:
</pre><p><p><a name="27994">
</a>Type a menu number between 1 and 5 at the prompt. Each choice corresponds to a sub-menu. The sub-menus are described below.</p>
<a name="28007">
</a><h4>Logging Option</h4>
<p><a name="28016">
</a>If you type 1 at the top level menu, the logging menu is displayed:</p>
<pre> <a name="28045"></a>1. Tail
<a name="28046"></a>2. Adjust
<a name="28039"></a>Your choice [1-2]:
</pre><p><p><a name="28121">
</a>The logging menu allows you to view the server log and adjust the logging level of the available logging realms. The menu options are described below:</p>
<ul><li><b>Tail:</b> Choosing this option performs a "tail -f" of the server log in the background so that you can see it while using the control port.<a name="28059">
</a>
<p><li><b>Adjust:</b> Choosing this option shows you a menu of available logging realms (see the ns_modlogcontrol Tcl function). You can select one of the logging realms and adjust the logging level to increase or decrease the amount of logging information you get. For example:<a name="28108">
</a>
<p><pre> <a name="28148"></a>Available realms:
<a name="28149"></a>nsd.pidfile
<a name="28150"></a>nsd.dns
<a name="28151"></a>nsd.adp
<a name="28152"></a>nsd.sched
<a name="28153"></a>nslog
<a name="28154"></a>nsd.return
<a name="28155"></a>nsd.socket
<a name="28156"></a>nsperm
<a name="28157"></a>nsd.tcl
<a name="28158"></a>nsd.fastpath
<a name="28159"></a>nsd.cache
<a name="28160"></a>nsd.db
<a name="28161"></a>nsd.mime
<a name="28162"></a>nscp
<a name="28163"></a>nsd
<a name="28164"></a>nsd.geturl
<a name="28165"></a>Your choice: <b>nsd
</b> <a name="28166"></a>The current logging level for realm nsd is 'notice'
<a name="28167"></a>Possible logging levels are:
<a name="28168"></a>fatal bug error warning notice debug
<a name="28169"></a>Enter new level: <b>debug
</b> <a name="28170"></a>Done.
</pre><p></ul><a name="28324">
</a><h4>Thread Info Option</h4>
<p><a name="28325">
</a>If you type 2 at the top level menu, information about the state of the server is displayed. For example:</p>
<pre> <a name="28439"></a>Min threads: 2
<a name="28440"></a>Max threads: 20
<a name="28441"></a>Current threads: 2
<a name="28442"></a>Idle threads: 2
<a name="28443"></a>Stopping threads: 0
</pre><p><a name="28500">
</a><h4>Caching Option</h4>
<p><a name="28517">
</a>If you type 3 at the top level menu, the caching menu is displayed:</p>
<pre> <a name="28525"></a>1. View stats
<a name="28554"></a>Your choice [1-1]:
</pre><p><p><a name="28583">
</a>The menu option is described below: </p>
<ul><li><b>View stats:</b> Choosing this option shows the currently-registered caches and displays statistics about the one you select. For example:<a name="28655">
</a>
<p><pre> <a name="28609"></a>Currently registered caches are:
<a name="28610"></a>adp
<a name="28611"></a>fastpath
<a name="28612"></a>Your choice: <b>fastpath
</b> <a name="28613"></a>Max size: 5120000 Current size: 34213
<a name="28614"></a>entries: 32 flushed: 0 hits: 20 misses: 20 hitrate: 50
</pre><p></ul><a name="28682">
</a><h4>Change Password Option</h4>
<p><a name="28718">
</a>If you type 4 at the top level menu, you can change a user's nsperm password. (Note that a user's nsperm password is not necessarily the same as the user's control port password.) For example:</p>
<pre> <a name="28727"></a>This will change a user's password in the nsperm module.
<a name="28728"></a>Enter user name: <b>nsadmin
</b> <a name="28729"></a>Enter user's old password or the nsadmin password:
<a name="28730"></a>Enter new password:
<a name="28731"></a>Re-enter new password:
</pre><p><p><a name="28733">
</a>Passwords are not echoed to the screen. To change the password of a user other than yourself, enter the nsadmin password when prompted for the user's old password.</p>
<a name="28695">
</a><h4>Restart Server Option</h4>
<p><a name="28775">
</a>If you type 5 at the top level menu, the server is restarted. This option only works if the nsd binary exists in the directory [ns_info home]/bin/nsd.</p>
<TABLE BORDER="2" CELLPADDING="1" width="100%">
<TR><TD COLSPAN=3><P ALIGN=Center>
<IMG SRC="bluebult.gif">
<A HREF="#topofpage">
<FONT SIZE=-1>Top of Page</FONT></A>
<IMG SRC="bluebult.gif">
</TD></TR>
<TR><TD COLSPAN=3><P ALIGN=Center>
<A href="acc-ch.htm">
<IMG BORDER="0" src=navbprev.gif alt="[ Previous ]"></A>
<A href=toc.htm>
<IMG BORDER="0" src=navbhome.gif alt="[ Contents ]"></A>
<A href=master.htm>
<IMG BORDER="0" src=navbhelp.gif alt="[ Index ]"></A>
<A href="acc-ch2.htm">
<IMG BORDER="0" src=navbnext.gif alt="[ Next ]"></A>
<BR align=center>
<FONT size=-1>Copyright © 1998-99 America Online,
Inc.</FONT>
</TD></TR></TABLE></BODY></HTML>
|