MarkLogic Server enables you to write web applications by connecting sets of XML or JSON content to HTTP servers that can access server-side XQuery, JavaScript, and REST programs. These applications can return XHTML, XML, or JSON content to a browser or other HTTP-enabled client application.
HTTP servers are defined at the group level and are accessible by all hosts within the group. Each HTTP server provides access to a set of XQuery programs that reside within a specified directory structure. Each host in the group must have access to the directory structure or mirror the directory structure along with the program files. An HTTP server executes the server-side programs against the database to which it is connected.
HTTP servers follow the MarkLogic Server security model, as do WebDAV, ODBC, and XDBC servers. The server authenticates access to those programs using user IDs and passwords stored in the security database for that HTTP server. (Each HTTP server is connected to a database, and each database is in turn connected to a security database in which security objects such as users are stored.)
HTTP servers execute code, either from a specified location on the file system or from a Modules database.
Granular access control to the system and to the data is achieved through the use of privileges and permissions. For details on configuring security objects in MarkLogic Server, see Security Administration. For conceptual information on the MarkLogic Server security model, see Security Guide.
Use the following procedures to create and manage HTTP servers:
To create a new server, complete the following steps:
- Click the Groups icon in the left tree menu.
- Click the group in which you want to define the HTTP server (for example, Default).
- Click the App Servers icon on the left tree menu.
- Click the Create HTTP tab at the top right. The Create HTTP Server page will display:
- In the Server Name field, enter a shorthand name for this HTTP server. MarkLogic Server will use this name to refer to this server on display screens in the Admin Interface.
- In the Root directory field, enter the name of the directory in which you will store your programs. If the Modules field is set to a database, then the root must be a directory URI in the specified modules database.
If the Modules field is set to file system, then the root directory is either a fully-qualified pathname or is relative to the directory in which MarkLogic Server is installed. The following table shows the default installation directory for each platform:
Platform |
Program Directory |
Microsoft Windows |
C:\Program Files\MarkLogic |
Red Hat Linux |
/opt/MarkLogic |
Mac OS X |
~/Library/MarkLogic |
Unless you specify a shared drive, all hosts in the group will need to have a copy of the programs in the directory specified above.
Do not create HTTP server root directories named Docs, Data or Admin. These directories are reserved by MarkLogic Server for other purposes. Creating HTTP server root directories with these names can result in unpredictable behavior of the server and may also complicate the software upgrade process.
- In the Port field, enter the port number through which you want to make this HTTP server available.
The port number must not be assigned to any other HTTP, ODBC, XDBC, or WebDAV server.
- In the Modules field, select the database to use as the modules database for your documents, or leave it at the default of storing your modules on the file system. For information on what a modules database is, see Modules Database.
- In the Database field and select the database to be accessed by this HTTP server. Multiple HTTP, ODBC, XDBC, and WebDAV servers can access the same database.
- Scroll to the Authentication field. Select an authentication scheme, as described in Types of Authentication in the Security Guide. The default is digest, which uses encrypted passwords.
If you select application-level authentication, you will also need to fill in a Default User. Any one accessing the HTTP server is automatically logged in as the Default User until the user logs in explicitly.
If you use an admin user (admin) as the Default User (an authorized administrator with the admin
role), then everyone who uses this App Server is automatically a user with the admin
role, which effectively turns off security for this App Server.
- Scroll to the Privilege field near the bottom of the screen. This field represents the privilege needed to access (login to) the server. You may leave this field blank.
A user accessing the HTTP server must have the execute privilege selected in order to access the HTTP server. If you chose application-level authentication above, you should ensure that the default user has the selected privilege.
- Set any other properties for this App Server, as appropriate to your needs:
- Last Login and Display Last Login are described in Storing and Monitoring the Last User Login Attempt.
- Backlog specifies the maximum number of pending connections allowed on the HTTP server socket.
- Threads specifies the maximum number of App Server threads allocated to this port by each server in the cluster.
- Request Timeout specifies the maximum number of seconds before a socket receives a timeout for the first request.
- Keep Alive timeout specifies the maximum number of seconds before a socket receives a timeout for subsequent requests over the same connection.
- Session Timeout specifies the maximum number of seconds before an inactive session times out.
- Max Time Limit specifies the upper bound for any request's time limit. No request may set its time limit (for example with xdmp:set-request-time-limit) higher than this number. The time limit, in turn, is the maximum number of seconds allowed for servicing a query request. The App Server gives up on queries which take longer, and returns an error.
- Default Time Limit specifies the default value for any request's time limit, when otherwise unspecified. A request can change its time limit using
xdmp:set-request-time-limit
. The time limit, in turn, is the maximum number of seconds allowed for servicing a query request. The App Server gives up on queries which take longer, and returns an error.
- Static Expires adds an "expires" HTTP header for static content to expire after this many seconds.
- Pre-commit Trigger Limit specifies the maximum number of pre-commit triggers a single statement against this App Server can invoke. For more information on triggers, see Using Triggers to Spawn Actions in the Application Developer's Guide.
- Pre-commit Trigger Depth specifies the maximum depth (how many triggers can cause other triggers to fire, which in turn cause others to fire, and so on) for pre-commit triggers that are executed against this App Server. For more information on triggers, see Using Triggers to Spawn Actions in the Application Developer's Guide.
- Collation specifies the default collation for queries run in this appserver. This will be the collation used for string comparison and sorting if none is specified in the query. For details, see Encodings and Collations in the Search Developer's Guide.
- Concurrent Request Limit specifies the maximum number of requests any user may have running at a specific time. 0 indicates no maximum. For details, see Managing Concurrent User Requests.
- Log Errors specifies whether to log uncaught errors for this App Server to the ErrorLog.txt file. This is useful to log exceptions that might occur on an App Server for later debugging.
- Debug Allow specifies whether to allow requests against this App Server to be stopped for debugging, using the MarkLogic Server debugging APIs.
- Profile Allow specifies whether to allow requests against this App Server to be profiled, using the MarkLogic Server profiling APIs. For details, see Profiling Requests to Evaluate Performance in the Query Performance and Tuning guide.
- Default XQuery Version specifies the default XQuery language for this App Server if an XQuery module does explicitly declare its language version.
- Multi Version Concurrency Control specifies how strict queries behave about getting the latest timestamp. This only affects query statements, not update statements. For details about queries and transactions in MarkLogic Server, see Understanding Transactions in MarkLogic Server in the Application Developer's Guide.
- The Error Handler and URL Rewriter fields are described in Controlling App Server Access, Output, and Errors in the Application Developer's Guide.
- The properties associated with SSL support are described in Configuring SSL on App Servers in the Security Guide.
- Scroll to the top or bottom and click OK.
The HTTP server is now created. Creating an HTTP server is a hot admin task; the changes take effect immediately. For information and setup instructions for managing user sessions and/or keeping track of login attempts, see Managing User Requests and Monitoring Login Attempts.
For each HTTP Server, you can set various default output options. These output options affect how data returned from the App Server is serialized. You can also set these options at the query level to override any default options. You can set serialization options to override the App Server defaults in XQuery with the declare option
XQuery prolog, and in XSLT using the <xsl:output>
instruction. For details on setting the serialization options in XQuery, see Declaring Options in the XQuery and XSLT Reference Guide. For XSLT output details, see the XSLT specification (http://www.w3.org/TR/xslt20#serialization).
To specify defaults for the App Server, complete the following steps:
- Click the Groups icon in the left tree menu.
- Click the group which contains the HTTP server you want to view (for example, Default).
- Click the App Servers icon on the left tree menu.
- Select the App Server to edit.
- Select the Output Options link in the left tree menu. The Output Options Configuration page displays.
- Set any options that you want to control for this App Server.
- Click OK to save your changes.
For more details about App Server output, see Controlling App Server Access, Output, and Errors in the Application Developer's Guide.
To view the settings for a particular HTTP server, complete the following steps:
- Click the Groups icon in the left tree menu.
- Click the group which contains the HTTP server you want to view (for example, Default).
- Click the App Servers icon on the left tree menu.
- Locate the HTTP server for which you want to view settings, either in the tree menu or on the summary page.
- Click the icon for the HTTP server.
- View the settings.
To delete the settings for an HTTP server, complete the following steps:
- Click the Groups icon in the left tree menu.
- Click the group which contains the HTTP server you want to delete (for example, Default).
- Click the App Servers icon on the left tree menu.
- Locate the HTTP server you want to delete, either in the tree menu or on the summary page.
- Click the icon for the HTTP server.
- Click Delete.
- A confirmation message displays. Confirm the delete and click OK.
Deleting an HTTP server is a cold admin task; the server restarts to reflect your changes.
You can cancel a request in the App Server Status page of the Admin Interface (Groups > group_name > App Servers > app_server_name > Status tab).
To cancel a long-running request (for example, a long-running query statement or update statement), perform the following steps:
- Click the Group menu item in the Admin Interface.
- Navigate to the App Server in which the request was issued, either from the tree menu or from the summary page.
- Click the Status tab.
- Click the Show More button.
- At the bottom right of the App Server Status page, click the cancel button on the row for the query you want to cancel.
- Click OK on the Cancel Request confirmation page. If the request is already completed when the confirmation page occurs, the page will indicate that the request cannot be found.
The request is canceled and the App Server Status page appears again.