Trino Gateway documentation
Configuration | Design | Development | Security | Operation | Gateway API | Resource groups API | Routing rules | References | Release notes |
For resource group and selector apis, we can now specify a query parameter with the request supporting multiple trino databases for different trino backends. This allows a user to configure a db for every trino backend with their own resource groups and selector tables. To use this, just specify the query parameter ?useSchema= to the request. Example, to list all resource groups,
curl -X GET http://localhost:8080/trino/resourcegroup/read/{INSERT_ID_HERE}?useSchema=newdatabasename
To add a single resource group, specify all relevant fields in the body. Resource group id should not be specified since the database should autoincrement it.
curl -X POST http://localhost:8080/trino/resourcegroup/create \
-d '{
"name": "resourcegroup1", \
"softMemoryLimit": "100%", \
"maxQueued": 100, \
"softConcurrencyLimit": 100, \
"hardConcurrencyLimit": 100, \
"schedulingPolicy": null, \
"schedulingWeight": null, \
"jmxExport": null, \
"softCpuLimit": null, \
"hardCpuLimit": null, \
"parent": null, \
"environment": "test" \
}'
If no resourceGroupId (type long) is specified, then all existing resource groups are fetched.
curl -X GET http://localhost:8080/trino/resourcegroup/read/{INSERT_ID_HERE}
Specify all columns in the body, which will overwrite properties for the resource group with that specific resourceGroupId.
curl -X POST http://localhost:8080/trino/resourcegroup/update \
-d '{ "resourceGroupId": 1, \
"name": "resourcegroup_updated", \
"softMemoryLimit": "80%", \
"maxQueued": 50, \
"softConcurrencyLimit": 40, \
"hardConcurrencyLimit": 60, \
"schedulingPolicy": null, \
"schedulingWeight": null, \
"jmxExport": null, \
"softCpuLimit": null, \
"hardCpuLimit": null, \
"parent": null, \
"environment": "test" \
}'
To delete a resource group, specify the corresponding resourceGroupId (type long).
curl -X POST http://localhost:8080/trino/resourcegroup/delete/{INSERT_ID_HERE}
To add a single selector, specify all relevant fields in the body. Resource group id should not be specified since the database should autoincrement it.
curl -X POST http://localhost:8080/trino/selector/create \
-d '{
"priority": 1, \
"userRegex": "selector1", \
"sourceRegex": "resourcegroup1", \
"queryType": "insert" \
}'
If no resourceGroupId (type long) is specified, then all existing selectors are fetched.
curl -X GET http://localhost:8080/trino/selector/read/{INSERT_ID_HERE}
To update a selector, the existing selector must be specified with all relevant fields under "current". The updated version of that selector is specified under "update", with all relevant fields included. If the selector under "current" does not exist, a new selector will be created with the details under "update". Both "current" and "update" must be included to update a selector.
curl -X POST http://localhost:8080/trino/selector/update \
-d '{ "current": {
"resourceGroupId": 1, \
"priority": 1, \
"userRegex": "selector1", \
"sourceRegex": "resourcegroup1", \
"queryType": "insert" \
},
"update": {
"resourceGroupId": 1, \
"priority": 2, \
"userRegex": "selector1_updated", \
"sourceRegex": "resourcegroup1", \
"queryType": null \
}
}'
To delete a selector, specify all relevant fields in the body.
curl -X POST http://localhost:8080/trino/selector/delete \
-d '{ "resourceGroupId": 1, \
"priority": 2, \
"userRegex": "selector1_updated", \
"sourceRegex": "resourcegroup1", \
"queryType": null \
}'
To add a single global property, specify all relevant fields in the body.
curl -X POST http://localhost:8080/trino/globalproperty/create \
-d '{
"name": "cpu_quota_period", \
"value": "1h" \
}'
If no name (type String) is specified, then all existing global properties are fetched.
curl -X GET http://localhost:8080/trino/globalproperty/read/{INSERT_NAME_HERE}
Specify all columns in the body, which will overwrite properties for the global property with that specific name.
curl -X POST http://localhost:8080/trino/globalproperty/update \
-d '{
"name": "cpu_quota_period", \
"value": "2h" \
}'
To delete a global property, specify the corresponding name (type String).
curl -X POST http://localhost:8080/trino/globalproperty/delete/{INSERT_NAME_HERE}