-
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 host
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/hosts/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
}
If preset
is specified, parameters are first loaded from the server-side configuration file,
e.g., configurations/hosts/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/hosts/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
.
available response representations:
- 200 - Returned if create host was successful (return host object)
Example:
{
"id": "single_mongod",
"orchestration": "hosts",
"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 Host could not be created.
-
GET - Get a listing of all Host ids
available response representations:
- 200 - This should always be the reponse code. Example:
["host_1", "host_2", "host_3"]
- 500 - Returned if create host was fail
Methods:
-
PUT - Create a new host 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 host 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
At present, issuing a start
when a server is already running results in a second server, so check status with GET to avoid this issue.
-
GET - info about host
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 host does not exist
-
DELETE - remove host 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 host does not exist