Create Node Group
To communicate with the Stream Manager 2.0 API, you can use the integrated Swagger UI, Postman, or curl from the command line.
Stream Manager 2.0 include OpenAPI/Swagger UI by default, you can find it on the main Stream Manager 2.0 web page https://<STREAM_MANAGER_DOMAIN_NAME>
or using direct url: https://<STREAM_MANAGER_DOMAIN_NAME>/swagger-ui/index.html
If you are using Stream Manager 2.0 without an SSL certificate and domain name, use
http://<STREAM_MANAGER_IP_ADDRESS>
instead.
Documentation: Stream Manager 2.0 API Overview.
Get JWT Token
JWT token is used to authenticate and authorize users, ensuring secure access to the API.
- First example using username and password in the URL:
Please do not use this example if you have special characters like
@
in your R5AS_AUTH_USER or R5AS_AUTH_PASS variables.
curl -H "Content-Type: application/json"
-X PUT https://<R5AS_AUTH_USER>:<R5AS_AUTH_PASS>@<STREAM_MANAGER_DOMAIN_NAME>/as/v1/auth/login
- Second example using Base64 encoding for your username and password:
curl -X 'PUT'
'https://<STREAM_MANAGER_DOMAIN_NAME>/as/v1/auth/login'
-H 'accept: application/json'
-H 'Authorization: Basic <USER_AND_PASSWORD_IN_BASE64>'
In this example, you need to replace <USER_AND_PASSWORD_IN_BASE64>
with your Base64-encoded username and password. To generate this encoded string, combine your username and password in the format username:password
, then encode this string using Base64. You can use the following command to encode it:
echo -n 'username:password' | base64
-
R5AS_AUTH_USER
– Authentication user name used to get JWT token. You set this secret in the.env
file during the configuration of Stream Manager 2.0. -
R5AS_AUTH_PASS
– Authentication user password used to get JWT token. You set this secret in the.env
file during the configuration of Stream Manager 2.0. -
Response body
{
"token": "YOUR_JWT_TOKEN"
}
Create Node Group Config
Creating a new node group will immediately begin scaling out Red5 Pro nodes using your configuration.
curl -X POST
'https://<STREAM_MANAGER_DOMAIN_NAME>/as/v1/admin/nodegroup'
--header 'Content-Type: application/json'
--header "Authorization: Bearer <YOUR_JWT_TOKEN>"
--data "@node-group-create.json"
Json node-group-create.json
body:
{
"name": "<NODE_GROUP_NAME>",
"description": "This is an GCP nodegroup example",
"cloudProperties": "environment=example;vpc=<NODE_VPC_NAME>;volume_size=16",
"cloudPlatform": "GCP",
"isScalingPaused": false,
"images": {
"base_image": {
"name": "base_image",
"image": "<NODE_IMAGE_NAME>",
"cloudProperties": "instance_type=<NODE_INSTANCE_TYPE>"
}
},
"roles": {
"origin": {
"name": "origin",
"imageName": "base_image",
"capabilities": [
"PUBLISH"
]
},
"edge": {
"name": "edge",
"imageName": "base_image",
"capabilities": [
"SUBSCRIBE"
],
"parentRoleName": "origin",
"parentCardinality": "GLOBAL"
}
},
"groups": {
"<SUB_GROUP_NAME>": {
"subGroupName": "<SUB_GROUP_NAME>",
"nodeGroupName": "<NODE_GROUP_NAME>",
"groupType": "main",
"rulesByRole": {
"origin": {
"nodeGroupName": "<NODE_GROUP_NAME>",
"subGroupName": "<SUB_GROUP_NAME>",
"nodeRoleName": "origin",
"min": 1,
"max": 5,
"increment": 1,
"outExpression": "(avg(connections.client) / 200) * 0.5 + (avg(connections.publisher) / 50) * 0.5 > 1.0",
"inExpression": "avg(connections.client) < 10",
"capacityRankingExpression": "(connections.client / 200) * 10",
"capacityLimitExpression": "10"
},
"edge": {
"nodeGroupName": "<NODE_GROUP_NAME>",
"subGroupName": "<SUB_GROUP_NAME>",
"nodeRoleName": "edge",
"min": 1,
"max": 10,
"increment": 1,
"outExpression": "(avg(connections.client) / 200) * 0.5 + (avg(connections.subscriber) / 50) * 0.5 > 1.0",
"inExpression": "avg(connections.client) < 10",
"capacityRankingExpression": "(connections.client / 200) * 10",
"capacityLimitExpression": "10"
}
},
"cloudProperties": "region=<NODE_GCP_REGION>"
}
},
"internalVersionCount": 0
}
Please replace these variables with the values you recorded in the previous steps:
NODE_GROUP_NAME
– The name of node group. Min 1 char, max 16 chars. Alphanumeric, plus -, _, and .. Must be GLOBALLY unique (no two Node Groups can share the same name) Example:node-group-test
SUB_GROUP_NAME
– The name of this SubGroup. Min 1 char, max 16 chars. Example:sub-group-test
NODE_VPC_NAME
– The name of the VPC you created when setting up the network (VPC). Example:red5pro-autoscaling
NODE_SECURITY_GROUP
– The name of the security group for Red5 Pro nodes, created during the network (VPC) setup. Example:red5pro-autoscaling-node-sg
NODE_IMAGE_NAME
– The name of the Red5 Pro node instance image you created when preparing the Red5 Pro node image. Example:red5pro-autoscaling-node-image
NODE_GCP_REGION
– The GCP region where you deployed your Stream Manager. This is the region where the Stream Manager will create autoscaling Red5 Pro nodes. Example:us-central1
.NODE_INSTANCE_TYPE
– GCP instance type (Instance Type). Example:n2-standard-2
(2 CPUs and 4GB of memory)- Follow the docs for instance types details.
Examples:
Node Instance Types in GCP
Examples of Node Instance Types
NODE_INSTANCE_TYPE | Category | CPUs | GB Memory |
---|---|---|---|
e2-medium | General Purpose | 2 | 4 |
e2-standard-4 | General Purpose | 4 | 16 |
e2-standard-8 | General Purpose | 8 | 32 |
n2-standard-4 | General Purpose | 4 | 16 |
n2-standard-8 | General Purpose | 8 | 32 |
n2-standard-16 | General Purpose | 16 | 64 |
c2-standard-4 | Compute Optimized | 4 | 16 |
c2-standard-8 | Compute Optimized | 8 | 32 |
c2-standard-16 | Compute Optimized | 16 | 64 |
c2-standard-30 | Compute Optimized | 30 | 120 |
c2-standard-60 | Compute Optimized | 60 | 240 |
t2d-standard-2 | General Purpose | 2 | 8 |
t2d-standard-4 | General Purpose | 4 | 16 |
t2d-standard-8 | General Purpose | 8 | 32 |
c3-standard-4 | Consistently High Performance | 4 | 16 |
c3-standard-8 | Consistently High Performance | 8 | 32 |
c3-standard-22 | Consistently High Performance | 22 | 88 |
c3-standard-44 | Consistently High Performance | 44 | 176 |
c3-standard-88 | Consistently High Performance | 88 | 352 |
c3-highcpu-4 | Consistently High Performance | 4 | 8 |
c3-highcpu-8 | Consistently High Performance | 8 | 16 |
c3-highcpu-22 | Consistently High Performance | 22 | 44 |
c3-highcpu-44 | Consistently High Performance | 44 | 88 |
c3-highcpu-88 | Consistently High Performance | 88 | 176 |
c4-standard-2 | Consistently High Performance | 2 | 8 |
c4-standard-4 | Consistently High Performance | 4 | 16 |
c4-standard-8 | Consistently High Performance | 8 | 32 |
c4-standard-16 | Consistently High Performance | 16 | 64 |
c4-standard-32 | Consistently High Performance | 32 | 128 |
c4-standard-48 | Consistently High Performance | 48 | 192 |
c4-highcpu-2 | Consistently High Performance | 2 | 4 |
c4-highcpu-4 | Consistently High Performance | 4 | 8 |
c4-highcpu-8 | Consistently High Performance | 8 | 16 |
c4-highcpu-16 | Consistently High Performance | 16 | 32 |
c4-highcpu-32 | Consistently High Performance | 32 | 64 |
This example node group config will create 2 Red5 Pro node instances (origin and edge)
Get node group lists
curl -X 'GET'
'https://<STREAM_MANAGER_DOMAIN_NAME>/as/v1/admin/nodegroup'
-H 'accept: application/json'
-H 'Authorization: Bearer <YOUR_JWT_TOKEN>'
- Response body
[
"<NODE_GROUP_NAME>"
]
Delete node group
curl -X 'DELETE'
'https://<STREAM_MANAGER_DOMAIN_NAME>/as/v1/admin/nodegroup/<NODE_GROUP_NAME>'
-H 'accept: application/json'
-H 'Authorization: Bearer <YOUR_JWT_TOKEN>'
Debug page
Debug UI it is extra web application which can help with checking active node groups, streams, and more using UI interface.
Stream Manager 2.0 includes a Debug UI web page, which you can find on the main Stream Manager 2.0 web page at https://<STREAM_MANAGER_DOMAIN_NAME>
or directly at https://<STREAM_MANAGER_DOMAIN_NAME>/debug/
.