-
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 a new Server with a randomly-assigned id.
mongo-orchestration uses specific values for some parameters for quick start up:
{"noprealloc": True, "smallfiles": True, "oplogSize": 100}
The default values of other parameters are set per configuration file defaults.
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.
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.
The procParams
key has special handling for "setParameter" so you can specify the parameters themselves as json objects: { "procParams": { "setParameter": { "enableTestCommands": 1 } } }
available response representations:
-
200 - Returned if the Server was created successfully.
Example:
{
"id": "77e59133-504f-4354-b89a-1211a8888b53",
"links": [
{
"href": "/v1/servers/77e59133-504f-4354-b89a-1211a8888b53",
"method": "DELETE",
"rel": "delete-server"
},
{
"href": "/v1/servers/77e59133-504f-4354-b89a-1211a8888b53",
"method": "GET",
"rel": "get-server-info"
},
{
"actions": [
"start",
"stop",
"restart",
"freeze"
],
"href": "/v1/servers/77e59133-504f-4354-b89a-1211a8888b53",
"method": "POST",
"rel": "server-command",
"template": {
"action": "<action name>"
}
},
{
"href": "/v1",
"method": "GET",
"rel": "service"
},
{
"href": "/v1/releases",
"method": "GET",
"rel": "get-releases"
},
{
"href": "/v1/servers",
"method": "GET",
"rel": "get-servers"
},
{
"href": "/v1/servers",
"method": "POST",
"rel": "self"
},
{
"href": "/v1/replica_sets",
"method": "GET",
"rel": "get-replica-sets"
},
{
"href": "/v1/sharded_clusters",
"method": "GET",
"rel": "get-sharded-clusters"
}
],
"mongodb_uri": "mongodb://localhost:1029",
"orchestration": "servers",
"procInfo": {
"alive": true,
"name": "mongod",
"optfile": "/var/folders/v9/spc2j6cx3db71l__k89_8ng80000gp/T/mongo-FDSMK1",
"params": {
"dbpath": "/var/folders/v9/spc2j6cx3db71l__k89_8ng80000gp/T/mongo-FPp5_Z",
"ipv6": true,
"journal": true,
"logappend": true,
"noprealloc": true,
"oplogSize": 100,
"port": 1029,
"setParameter": {
"enableTestCommands": 1
},
"smallfiles": true
},
"pid": 90323
},
"serverInfo": {
"OpenSSLVersion": "OpenSSL 0.9.8za 5 Jun 2014",
"allocator": "tcmalloc",
"bits": 64,
"compilerFlags": "-Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -pipe -Werror -O3 -Wno-unused-function -Wno-unused-private-field -Wno-deprecated-declarations -Wno-tautological-constant-out-of-range-compare -Wno-unused-const-variable -mmacosx-version-min=10.6",
"debug": false,
"gitVersion": "afae7c082b1b4eff8401f660124e161137fe1d2b",
"javascriptEngine": "V8",
"loaderFlags": "-fPIC -pthread -Wl,-bind_at_load -mmacosx-version-min=10.6",
"maxBsonObjectSize": 16777216,
"ok": 1.0,
"sysInfo": "Darwin llpro 13.4.0 Darwin Kernel Version 13.4.0: Sun Aug 17 19:50:11 PDT 2014; root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49",
"version": "2.7.7",
"versionArray": [
2,
7,
7,
0
]
},
"statuses": {
"locked": false,
"mongos": false,
"primary": true
}
}
-
500 - Returned if the Server could not be created.
-
GET - Get a listing of all Servers. This includes ones that aren't running but have not yet been deleted.
available response representations:
- 200 - This should always be the reponse code.
Example:
{
"links": [
{
"href": "/v1",
"method": "GET",
"rel": "service"
},
{
"href": "/v1/releases",
"method": "GET",
"rel": "get-releases"
},
{
"href": "/v1/servers",
"method": "GET",
"rel": "self"
},
{
"href": "/v1/servers",
"method": "POST",
"rel": "add-server"
},
{
"href": "/v1/replica_sets",
"method": "GET",
"rel": "get-replica-sets"
},
{
"href": "/v1/sharded_clusters",
"method": "GET",
"rel": "get-sharded-clusters"
}
],
"servers": [
{
"id": "91aa9c65-a52a-43d0-b764-68c027a070f8",
"links": [
{
"href": "/v1/servers/91aa9c65-a52a-43d0-b764-68c027a070f8",
"method": "DELETE",
"rel": "delete-server"
},
{
"href": "/v1/servers/91aa9c65-a52a-43d0-b764-68c027a070f8",
"method": "GET",
"rel": "get-server-info"
},
{
"actions": [
"start",
"stop",
"restart",
"freeze"
],
"href": "/v1/servers/91aa9c65-a52a-43d0-b764-68c027a070f8",
"method": "POST",
"rel": "server-command",
"template": {
"action": "<action name>"
}
}
]
},
{
"id": "f19142f4-2847-4a01-92f7-bfa687244421",
"links": [
{
"href": "/v1/servers/f19142f4-2847-4a01-92f7-bfa687244421",
"method": "DELETE",
"rel": "delete-server"
},
{
"href": "/v1/servers/f19142f4-2847-4a01-92f7-bfa687244421",
"method": "GET",
"rel": "get-server-info"
},
{
"actions": [
"start",
"stop",
"restart",
"freeze"
],
"href": "/v1/servers/f19142f4-2847-4a01-92f7-bfa687244421",
"method": "POST",
"rel": "server-command",
"template": {
"action": "<action name>"
}
}
]
}
]
}
- 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 nearly 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 - Start the Server.
- stop - Stop the Server.
- restart - Restart the Server.
- reset - Ensure the Server is available.
- freeze - Call
replSetFreeze
on this Server. - stepdown - Call
replSetStepDown
on this Server.
available response representations:
- 200 - The command was issued successfully.
- 404 - No server exists with the given
server-id
. - 500 - Error.
When the command was successful, the response body will contain a command_result
field that holds any output of the command.
-
GET - info about server
available response representations:
- 200 - application/json
Example:
{
"id": "myServer",
"links": [
{
"href": "/v1/servers/myServer",
"method": "DELETE",
"rel": "delete-server"
},
{
"href": "/v1/servers/myServer",
"method": "GET",
"rel": "self"
},
{
"actions": [
"start",
"stop",
"restart",
"freeze"
],
"href": "/v1/servers/myServer",
"method": "POST",
"rel": "server-command",
"template": {
"action": "<action name>"
}
},
{
"href": "/v1/servers",
"method": "GET",
"rel": "get-servers"
}
],
"mongodb_uri": "",
"orchestration": "servers",
"procInfo": {
"alive": false,
"name": "mongod",
"optfile": "/var/folders/v9/spc2j6cx3db71l__k89_8ng80000gp/T/mongo-zhcYDv",
"params": {
"dbpath": "/var/folders/v9/spc2j6cx3db71l__k89_8ng80000gp/T/mongo-RLDw_D",
"ipv6": true,
"journal": true,
"logappend": true,
"noprealloc": true,
"oplogSize": 100,
"port": 1030,
"setParameter": {
"enableTestCommands": 1
},
"smallfiles": true
}
},
"serverInfo": {},
"statuses": {}
}
-
404 - Returned if the server does not exist
-
DELETE - Remove a Server.
All data and logs will be deleted, too.
available response representations:
- 204 - Returned if delete was successful
- 404 - Returned if the server does not exist
- 500 - An error occurred while trying to delete the Server.
Note that the response body is empty if the delete was successful.