-
Notifications
You must be signed in to change notification settings - Fork 11
Servers
- /servers POST GET
- /servers/{server-id} PUT POST GET DELETE
Methods:
- POST - create and get up new server mongo-orchestration uses specific values for some parameters for best performance:
{"noprealloc": True, "smallfiles": True, "oplogSize": 10}
default values of other params according mongodb specs
Example:
{
"name": "mongod", // [required] - name of process (mongod, mongos)
"preset": "basic.json", // [optional] - configuration file on server, e.g., configurations/servers/basic.json
"id": "single_mongod", // [optional] - id of cluster, otherwise uuid will be generated for id
"procParams": {"port": 3333}, // [optional] (default: {}) - specific configuration options http://docs.mongodb.org/manual/reference/configuration-options/
"sslParams": { "sslCAFile" : "~/ca.pem" }, // [optional] - SSL options http://docs.mongodb.org/manual/administration/ssl/
"auth_key": "secret", // [optional] - authentication key
"timeout": 300, // (default: 320) specify how long, in seconds, a command can take before server times out.
"login": "admin", // [optional] - username for the admin collection
"password": "adminpass", // [optional] - password
"autostart": true, // [optional] (default: true) - autostart instance
"version": "26-release" // [optional] - release to use, as defined in configuration file
}
If preset
is specified, parameters are first loaded from the server-side configuration file,
e.g., configurations/servers/basic.json
,
and then updated with any other supplied parameters.
The update is a deep merge so that individual leaf values can be overridden by supplied parameters.
The procParams
key has special handling for "setParameter" so you can specify the parameters themselves as json objects: { "procParams": { "setParameter": { "enableTestCommands": 1 } } }
Minimal example:
{
"preset": "basic.json", // [optional] - configuration file on server, e.g., configurations/servers/basic.json
}
In this minimal example, all parameters are supplied from the server-side configuration file.
If id
is not specified in the configuration file, a uuid is generated for the id
.
The version
field allows you to specify what release defined in the --config
file to use when starting the Server. The config file must be provided to server.py
on startup, and only releases defined within the file are valid to use. If this field is omitted, then Mongo Orchestration will choose the first release in the config file. If no config file was given, then Mongo Orchestration will start whatever binary is on the user's PATH. See also: /releases.
available response representations:
- 200 - Returned if create server was successful (return server object) Example:
{
"id": "single_mongod",
"orchestration": "servers",
"procInfo": {"alive": True,
"name": "/usr/bin/mongod",
"optfile": "/tmp/mongo-a6Y0JH",
"params": {"auth": True,
"dbpath": "/tmp/mongo-MgMvCd",
"keyFile": "/tmp/mongo-MgMvCd/key",
"nojournal": True,
"noprealloc": True,
"oplogSize": 10,
"port": 3333,
"smallfiles": True},
"pid": 8819},
"serverInfo": {"bits": 64,
"debug": False,
"gitVersion": "d6764bf8dfe0685521b8bc7b98fd1fab8cfeb5ae",
"maxBsonObjectSize": 16777216,
"ok": 1.0,
"sysInfo": "Linux ip-10-2-29-40 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_49",
"version": "2.2.1",
"versionArray": [2, 2, 1, 0]},
"statuses": {"locked": False, "mongos": False, "primary": True},
"uri": "localhost:3333",
"mongodb_uri": "mongodb://localhost:3333"}
-
500 - Returned if the Server could not be created.
-
GET - Get a listing of all Server ids
available response representations:
- 200 - This should always be the reponse code. Example:
["server_1", "server_2", "server_3"]
- 500 - Returned if the Server could not be created.
Methods:
-
PUT - Create a new server with given
server-id
.
This functions in much the same way as a POST
request to /servers
, except that the caller is providing the id
of the server as part of the URI instead of the request body. The response from the server is identical to one from a POST
to /servers
.
- POST - Issue a command to the server.
The request body is of the form {"action": "<COMMAND NAME>"}
.
Currently available commands are as follows:
- start
- stop
- restart
- freeze
- stepdown
available response representations:
-
200 - The command was issued successfully
-
404 - No server exists with the given
server-id
-
500 - Error
-
GET - info about server
available response representations:
- 200 - application/json
Example:
{
"id": "ad19921c-6ab9-44f7-9be9-19fd5e89561d",
"uri": "192.168.1.0:2233",
"mongodb_uri": "mongodb://192.168.1.0:2233",
"statuses": {"primary": true, "mongos": false, "locked": false},
"serverInfo": {"sysInfo": "Linux ip-10-2-29-40 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_49",
"version": "2.2.0", "debug": false, "maxBsonObjectSize": 16777216, "bits": 64,
"gitVersion": "f5e83eae9cfbec7fb7a071321928f00d1b0c5207"},
"procInfo": {"name": "mongod", "params": {}}
}
-
404 - Returned if the server does not exist
-
DELETE - remove server with all data (log file, db files, ...)
available response representations:
- 204 - Returned if delete was successful
- 400 - Returned if delete was fail
- 404 - Returned if the server does not exist