Synapse Status and Maintenance Modes
...
The following example shows how to get the current status. Note: This call does not require an authentication token.
Request
Code Block |
---|
curl -i -k -H Accept:application/json -H Content-Type:application/json http://localhost:8080/services-repository-0.8-SNAPSHOT/repo/v1/admin/synapse/status
|
Response
Code Block |
---|
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json
Transfer-Encoding: chunked
Date: Sat, 10 Dec 2011 23:35:07 GMT
{
"status":"READ_WRITE",
"pendingMaintenanceMessage":"Synapse will be down for maintenance Saturday 12/10 from 11:58 to ll:59.",
"currentMessage":"Synapse is currently up and running."
}
|
...
Only an administrator can change the current status of Synapse. The administrator can set all three fields (status, currentMessage, and pendingMaintenanceMessage) with a single call:
Request
Code Block |
---|
curl -i -k -H sessionToken:<your admin token> -H Accept:application/json -H Content-Type:application/json -X PUT -d '{
"status": "DOWN",
"currentMessage": "Synapse is currently DOWN for maintenance. It will be back up in few minute.",
"pendingMaintenanceMessage":null,
}' http://localhost:8080/services-repository-0.8-SNAPSHOT/repo/v1/admin/synapse/status
|
Response
Code Block |
---|
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json
Transfer-Encoding: chunked
Date: Sat, 10 Dec 2011 23:47:18 GMT
{
"status":"DOWN",
"currentMessage":"Synapse is currently DOWN for maintenance. It will be back up in few minute."
}
|
StackStatus JSON Schema
Code Block |
---|
{
"description":"The Status of the stack",
"properties":{
"status":{
"type":"string",
"description":"The status of this stack can be one of the following enumerations",
"name":"StatusEnum",
"id":"org.sagebionetworks.repo.model.status.StatusEnum",
"enum":[
"READ_WRITE",
"READ_ONLY",
"DOWN",
],
},
"currentMessage":{
"type":"string",
"description":"This message applies to the current state of the stack."
},
"pendingMaintenanceMessage":{
"type":"string",
"description":"This message is used to notify users of pending maintenance"
},
}
}
|
Creating a Repository Backup Snapshot
A backup copy of the Repository Services is created by starting a daemon process that will stream all of the repository to a file, and then upload the file to its S3 bucket. This daemon can be
launched and monitored from a set of HTTP Rest calls. Note: All Backup/Restore services will require an administrator's session token.
...
Storage Usage
Check the (external) storage usage by the Synapse system. You must be an administrator to perform these actions.
Get aggregated totals
Aggregated over any combination of dimensions listed in StorageUsageDimension (see StorageUsageDimension in Synapse Entity Types) except for USER_ID and ENTITY_ID which are provided via separate APIs. For example, the following command lists storage usage by content type and storage provider:
Code Block |
---|
|
curl -i -H sessionToken: |
...
<token> -H Accept:application/json |
...
Code Block |
---|
curl -i -k -H sessionToken:<your admin token> -H Accept:application/json -H Content-Type:application/json -d '{
}' https://staging-reposervice.elasticbeanstalk.com/repo/v1/admin/daemon/backup
|
...
Code Block |
---|
HTTP/1.1 201 Created
Content-Type: application/json
Date: Thu, 18 Aug 2011 22:38:56 GMT
Server: Apache-Coyote/1.1
Content-Length: 256
Connection: keep-alive
{
"id":"6695",
"type":"BACKUP",
"status":"STARTED",
"errorMessage":null,
"progresssMessage":"Starting...",
"progresssCurrent":0,
"progresssTotal":0,
"errorDetails":null,
"backupUrl":null,
"totalTimeMS":0,
"startedBy":"platform@sagebase.org",
"startedOn":1313707136615
}
|
...
Code Block |
---|
curl -i -k -H sessionToken:<your admin token> -H Accept:application/json -H Content-Type:application/json https://staging-reposervice.elasticbeanstalk.com/repo/v1/admin/daemon/6695
|
...
Code Block |
---|
HTTP/1.1 200 OK
Content-Type: application/json
Date: Thu, 18 Aug 2011 22:46:06 GMT
Server: Apache-Coyote/1.1
Content-Length: 1114
Connection: keep-alive
{
"id":"6695",
"type":"BACKUP",
"status":"FAILED",
"errorMessage":"Access Denied",
"progresssMessage":"Starting to upload temp file: /opt/tomcat7/temp/BackupDaemonJob6695-762955157468269943.zip to S3...",
"progresssCurrent":785,
"progresssTotal":863,
"errorDetails":"Status Code: 403, AWS Request ID: CF8A8149099FE5F9, AWS Error Code: AccessDenied,...",
"backupUrl":null,
"totalTimeMS":26145,
"startedBy":"platform@sagebase.org",
"startedOn":1313707136615
}
|
...
Code Block |
---|
HTTP/1.1 200 OK
Content-Type: application/json
Date: Thu, 18 Aug 2011 23:00:10 GMT
Server: Apache-Coyote/1.1
transfer-encoding: chunked
Connection: keep-alive
{
"id":"6696",
"type":"BACKUP",
"status":"COMPLETED",
"errorMessage":null,
"progresssMessage":"Finished: BACKUP",
"progresssCurrent":863,
"progresssTotal":863,
"errorDetails":null,
"backupUrl":"https://s3.amazonaws.com/stagingdata.sagebase.org/BackupDaemonJob6696-911306061719227050.zip",
"totalTimeMS":24880,
"startedBy":"platform@sagebase.org",
"startedOn":1313708374613
}
|
...
Restore a Repository from a Backup Snapshot
Restoring a Repository Service from a backup is just the reverse of a backup. A restore daemon is started that will download the backup file from the service's S3 bucket, and then stream the data into repository.
Caution - The restoration process will start by clearing all data from the repository before applying the backup data.
Note: All Backup/Restore services will require an administrator's session token.
...
Code Block |
---|
curl -i -k -H sessionToken:YourSessionToken -H Accept:application/json -H Content-Type:application/json -d '{
"email": "<admin username>",
"password": "<admin password>"
}' http://localhost:8080/services-authentication-0.6-SNAPSHOT/auth/v1/session
|
...
Code Block |
---|
curl -i -k -H sessionToken:YourSessionToken -H Accept:application/json -H Content-Type:application/json -d '{
"url": "BackupDaemonJob6696-911306061719227050.zip"
}' http://localhost:8080/services-repository-0.6-SNAPSHOT/repo/v1/admin/daemon/restore
|
...
Code Block |
---|
HTTP/1.1 201 Created
Server: Apache-Coyote/1.1
Content-Type: application/json
Transfer-Encoding: chunked
Date: Thu, 18 Aug 2011 23:31:28 GMT
{
"id":"4",
"type":"RESTORE",
"status":"STARTED",
"progresssMessage":"Starting...",
"progresssCurrent":0,
"progresssTotal":0,
"errorMessage":null,
"errorDetails":null,
"backupUrl":null,
"totalTimeMS":0,
"startedBy":"platform@sagebase.org",
"startedOn":1313710288153
}
|
...
Code Block |
---|
curl -i -k -H sessionToken:YourSessionToken -H Accept:application/json -H Content-Type:application/json http://localhost:8080/services-repository-0.6-SNAPSHOT/repo/v1/admin/daemon/4
|
...
Code Block |
---|
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json
Transfer-Encoding: chunked
Date: Thu, 18 Aug 2011 23:37:16 GMT
{
"id":"4",
"type":"RESTORE",
"status":"FAILED",
"progresssMessage":"Starting to download the file from S3...",
"progresssCurrent":0,
"progresssTotal":0,
"errorMessage":"Access Denied",
"errorDetails":"Status Code: 403, AWS Request ID: 5A6F56E7416E1203, AWS Error Code: AccessDenied, AWS Error Message: Access Denied, S3 Extended Request ID: ...",
"totalTimeMS":781,
"startedBy":"platform@sagebase.org",
"startedOn":1313710288153
}
|
...
Code Block |
---|
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json
Transfer-Encoding: chunked
Date: Thu, 18 Aug 2011 23:59:13 GMT
{
"id":"5",
"type":"RESTORE",
"status":"COMPLETED",
"progresssMessage":"Finished: RESTORE",
"progresssCurrent":1164611,
"progresssTotal":1164611,
"errorMessage":null,
"errorDetails":null,
"backupUrl":"https://s3.amazonaws.com/devdata.sagebase.org/BackupDaemonJob6696-5911306061719227050.zip",
"totalTimeMS":46800,
"startedBy":"platform@sagebase.org",
"startedOn":1313711855784
}
|
...
https://repo-staging.sagebase.org/repo/v1/admin/storageSummary?aggregation=CONTENT_TYPE,STORAGE_PROVIDER |
Will get results like the following
Code Block |
---|
|
{
"summaryList": [
{
"aggregatedCount": 181,
"aggregatedSize": 5409454583,
"dimensionList": [
{
"dimension": "CONTENT_TYPE",
"value": "application/binary"
},
{
"dimension": "STORAGE_PROVIDER",
"value": "awss3"
}
]
},
{
"aggregatedCount": 9,
"aggregatedSize": 0,
"dimensionList": [
{
"dimension": "CONTENT_TYPE",
"value": "application/binary"
},
{
"dimension": "STORAGE_PROVIDER",
"value": "external"
}
]
},
{
"aggregatedCount": 3,
"aggregatedSize": 195333619,
"dimensionList": [
{
"dimension": "CONTENT_TYPE",
"value": "application/octet-stream"
},
{
"dimension": "STORAGE_PROVIDER",
"value": "awss3"
}
]
},
{
"aggregatedCount": 3590,
"aggregatedSize": 0,
"dimensionList": [
{
"dimension": "CONTENT_TYPE",
"value": "application/octet-stream"
},
{
"dimension": "STORAGE_PROVIDER",
"value": "external"
}
]
},
{
"aggregatedCount": 19,
"aggregatedSize": 9927282,
"dimensionList": [
{
"dimension": "CONTENT_TYPE",
"value": "application/pdf"
},
{
"dimension": "STORAGE_PROVIDER",
"value": "awss3"
}
]
},
{
"aggregatedCount": 8370,
"aggregatedSize": 0,
"dimensionList": [
{
"dimension": "CONTENT_TYPE",
"value": "application/x-tar"
},
{
"dimension": "STORAGE_PROVIDER",
"value": "external"
}
]
},
]
}
|
Without any aggregation, the same URL will get only the grand totals.
Code Block |
---|
|
curl -i -H sessionToken:<token> -H Accept:application/json https://repo-staging.sagebase.org/repo/v1/admin/storageSummary |
Code Block |
---|
|
{
"totalCount":133827,
"totalSize":1080865415607,
"summaryList":[]
} |
Get usage by users
Lists the aggregated usage by users in descending order of 'aggregatedSize':
Code Block |
---|
|
curl -i -H sessionToken:<token> -H Accept:application/json https://repo-staging.sagebase.org/repo/v1/admin/storageSummary/perUser |
Example response body listing the top 3 users:
Code Block |
---|
|
{
"summaryList": [
{
"aggregatedCount": 35204,
"aggregatedSize": 283329626902,
"dimensionList": [
{
"dimension": "USER_ID",
"value": "273975"
}
]
},
{
"aggregatedCount": 458,
"aggregatedSize": 227459357704,
"dimensionList": [
{
"dimension": "USER_ID",
"value": "342024"
}
]
},
{
"aggregatedCount": 179,
"aggregatedSize": 66928683678,
"dimensionList": [
{
"dimension": "USER_ID",
"value": "274010"
}
]
},
...
]
} |
Get usage by entities
Lists the aggregated usage by entities in descending order of 'aggregatedSize':
Code Block |
---|
|
curl -i -H sessionToken:<token> -H Accept:application/json https://repo-staging.sagebase.org/repo/v1/admin/storageSummary/perEntity |
Example response body listing the top 3 entities:
Code Block |
---|
|
{
"summaryList": [
{
"aggregatedCount": 1,
"aggregatedSize": 5210220350,
"dimensionList": [
{
"dimension": "NODE_ID",
"value": "317475"
}
]
},
{
"aggregatedCount": 1,
"aggregatedSize": 4670860925,
"dimensionList": [
{
"dimension": "NODE_ID",
"value": "1113803"
}
]
},
{
"aggregatedCount": 2,
"aggregatedSize": 4235837739,
"dimensionList": [
{
"dimension": "NODE_ID",
"value": "4494"
}
]
},
...
]
} |