Managing Sessions
Describes how to configure session parameters for the Control System and REST clients.
About this task
Enabling Session Replication for the Control System
About this task
When a client establishes a connection with an apiserver (node on which the Control System is installed), the session information is returned in the response. If you have set up multiple apiservers, you can configure the system to store the session information in a database for resending with further requests. For example, in the event of a node failure, you can send the session information with further requests so that the client uses the same session and does not re-authenticate when routed to a different apiserver.
To configure the host for session replication, perform the following steps on all the nodes running the apiserver:
Procedure
Configuring Sessions for REST Clients
About this task
This section describes how to get a session cookie, which can be used on subsequent requests. This cookie, valid for up to 30 minutes by default, contains the session ID and can be used to verify the identity of further API calls.
To get and save a cookie, which you can then use with subsequent requests, for:
- Basic authentication, submit a request similar to the following:
curl -X POST -c <cookiefile-location> https://<webserver-host>:8443/login -d 'username=root&password=mapr' - SPNEGO, submit a request similar to the following:
curl --negotiate -u : -b <cookiefile-location> -c <cookiefile-location> https://<web server node>:8443/rest/<API call> -k -v
The contents of the cookie file may look similar to the following:
cat /tmp/cookiejar.txt
# Netscape HTTP Cookie File
# https://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
#HttpOnly_<webserver-hostname> FALSE / TRUE 1509486224 MAPR.APISERVER.JSESSIONID node014ukard563rhu1ns8umn2s6uft3709.node0
#HttpOnly_<webserver-hostname> FALSE / FALSE 0 MAPR.APISERVER.SESSIONID
Configuring Session Timeout
About this task
session-timeout
parameter in the /opt/mapr/apiserver/conf/web.xml file. The value
for this parameter is in minutes. The session-timeout parameter in
the web.xml file is applicable for all clients. If no REST API
calls are made for 30 minutes (default value) by a client, then the apiserver will
terminate the session for that client. web.xml file is NOT related to
the Session Rate setting in the Control System. The Session Rate setting in the
Control System sets the idle timeout parameter for the Control System
ONLY. If there is no activity on the Control System within this timeout
period, the client sends a logout request to log out from the Control
System.