upstash-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseThe Upstash CLI () manages Upstash services via the Upstash Developer API. All commands are non-interactive and emit JSON on stdout. Errors go to stderr as with exit code .
upstash{ "error": "..." }1Upstash CLI()通过Upstash Developer API管理Upstash服务。所有命令均为非交互式,会在标准输出(stdout)中输出JSON格式内容。错误信息会以的格式输出到标准错误(stderr),并返回退出码。
upstash{ "error": "..." }1Install
安装
bash
npm i -g @upstash/clibash
npm i -g @upstash/cliAuthentication
认证
Recommended: run once per machine. Prompts for email and a Developer API key (create one at https://console.upstash.com/account/api), verifies them, and saves to .
upstash login~/.config/upstash/config.jsonbash
upstash loginAlternatives — env vars (also auto-loaded from a in cwd), or / inline, or to point at a specific :
.env--email--api-key--env-path <path>.envbash
export UPSTASH_EMAIL=you@example.com
export UPSTASH_API_KEY=your_api_keyPrecedence: flags > env vars > > saved config. Prefer a read-only API key for agents when possible — mutations fail at the API, the same way they would in the console.
.env推荐方式:每台机器运行一次。会提示输入邮箱和Developer API密钥(可在https://console.upstash.com/account/api创建),验证通过后将保存至`~/.config/upstash/config.json`。
upstash loginbash
upstash login其他方式——环境变量(也会自动加载当前目录下的文件),或在命令行中通过 / 传入,或使用指定特定的文件路径:
.env--email--api-key--env-path <path>.envbash
export UPSTASH_EMAIL=you@example.com
export UPSTASH_API_KEY=your_api_key优先级:命令行参数 > 环境变量 > 文件 > 已保存的配置。尽可能为代理使用只读API密钥——此时API层面会拒绝修改操作,与控制台中的表现一致。
.envResource ID flags
资源ID参数
| Flag | Products |
|---|---|
| Redis |
| Vector, Search |
| QStash |
| Team |
| 参数 | 产品 |
|---|---|
| Redis |
| Vector, Search |
| QStash |
| Team |
Redis
Redis
bash
upstash redis list
upstash redis get --db-id <id> [--hide-credentials]
upstash redis create --name <name> --region <region> [--read-regions <r1> <r2>]
upstash redis delete --db-id <id> [--dry-run]
upstash redis rename --db-id <id> --name <new-name>
upstash redis reset-password --db-id <id>
upstash redis stats --db-id <id>
upstash redis enable-tls --db-id <id>
upstash redis {enable,disable}-eviction --db-id <id>
upstash redis {enable,disable}-autoupgrade --db-id <id>
upstash redis change-plan --db-id <id> --plan <free|payg|pro|paid>
upstash redis update-budget --db-id <id> --budget <cents>
upstash redis update-regions --db-id <id> --read-regions <r1> <r2>
upstash redis move-to-team --db-id <id> --team-id <id>Regions — AWS: , , , , , , , , , , , , , . GCP: , , , .
us-east-1us-east-2us-west-1us-west-2ca-central-1eu-central-1eu-west-1eu-west-2sa-east-1ap-south-1ap-northeast-1ap-southeast-1ap-southeast-2af-south-1us-central1us-east4europe-west1asia-northeast1bash
upstash redis list
upstash redis get --db-id <id> [--hide-credentials]
upstash redis create --name <name> --region <region> [--read-regions <r1> <r2>]
upstash redis delete --db-id <id> [--dry-run]
upstash redis rename --db-id <id> --name <new-name>
upstash redis reset-password --db-id <id>
upstash redis stats --db-id <id>
upstash redis enable-tls --db-id <id>
upstash redis {enable,disable}-eviction --db-id <id>
upstash redis {enable,disable}-autoupgrade --db-id <id>
upstash redis change-plan --db-id <id> --plan <free|payg|pro|paid>
upstash redis update-budget --db-id <id> --budget <cents>
upstash redis update-regions --db-id <id> --read-regions <r1> <r2>
upstash redis move-to-team --db-id <id> --team-id <id>区域——AWS: , , , , , , , , , , , , , 。GCP: , , , .
us-east-1us-east-2us-west-1us-west-2ca-central-1eu-central-1eu-west-1eu-west-2sa-east-1ap-south-1ap-northeast-1ap-southeast-1ap-southeast-2af-south-1us-central1us-east4europe-west1asia-northeast1Redis backups
Redis备份
bash
upstash redis backup list --db-id <id>
upstash redis backup create --db-id <id> --name <name>
upstash redis backup delete --db-id <id> --backup-id <id> [--dry-run]
upstash redis backup restore --db-id <id> --backup-id <id>
upstash redis backup {enable,disable}-daily --db-id <id>bash
upstash redis backup list --db-id <id>
upstash redis backup create --db-id <id> --name <name>
upstash redis backup delete --db-id <id> --backup-id <id> [--dry-run]
upstash redis backup restore --db-id <id> --backup-id <id>
upstash redis backup {enable,disable}-daily --db-id <id>Redis exec (REST, not the Developer API key)
Redis执行(使用REST,而非Developer API密钥)
bash
upstash redis exec --db-url <url> --db-token <token> SET key value
upstash redis exec --db-url <url> --db-token <token> --json '["SET","key","value"]'--db-url--db-tokenUPSTASH_REDIS_REST_URLUPSTASH_REDIS_REST_TOKENendpointrest_tokenupstash redis get --db-id <id>bash
upstash redis exec --db-url <url> --db-token <token> SET key value
upstash redis exec --db-url <url> --db-token <token> --json '["SET","key","value"]'--db-url--db-tokenUPSTASH_REDIS_REST_URLUPSTASH_REDIS_REST_TOKENupstash redis get --db-id <id>endpointrest_tokenTeam
团队
bash
upstash team list
upstash team create --name <name> [--copy-cc]
upstash team delete --team-id <id> [--dry-run]
upstash team members --team-id <id>
upstash team add-member --team-id <id> --member-email <email> --role <admin|dev|finance>
upstash team remove-member --team-id <id> --member-email <email> [--dry-run]bash
upstash team list
upstash team create --name <name> [--copy-cc]
upstash team delete --team-id <id> [--dry-run]
upstash team members --team-id <id>
upstash team add-member --team-id <id> --member-email <email> --role <admin|dev|finance>
upstash team remove-member --team-id <id> --member-email <email> [--dry-run]Vector
Vector
bash
upstash vector list
upstash vector get --index-id <id>
upstash vector create --name <name> --region <region> --similarity-function <fn> --dimension-count <n> [--type payg] [--index-type <type>] [--embedding-model <m>] [--sparse-embedding-model <m>]
upstash vector delete --index-id <id> [--dry-run]
upstash vector rename --index-id <id> --name <new-name>
upstash vector reset-password --index-id <id>
upstash vector set-plan --index-id <id> --plan <free|payg|fixed>
upstash vector transfer --index-id <id> --target-account <id>
upstash vector stats # aggregate across all indexes
upstash vector index-stats --index-id <id> [--period <1h|3h|12h|1d|3d|7d|30d>]Regions: , , . Similarity: , , . Index types: , , . Dense models: , , , . Sparse models: , . For with managed embeddings, set .
eu-west-1us-east-1us-central1COSINEEUCLIDEANDOT_PRODUCTDENSESPARSEHYBRIDBGE_SMALL_EN_V1_5BGE_BASE_EN_V1_5BGE_LARGE_EN_V1_5BGE_M3BM25BGE_M3HYBRID--dimension-count 0bash
upstash vector list
upstash vector get --index-id <id>
upstash vector create --name <name> --region <region> --similarity-function <fn> --dimension-count <n> [--type payg] [--index-type <type>] [--embedding-model <m>] [--sparse-embedding-model <m>]
upstash vector delete --index-id <id> [--dry-run]
upstash vector rename --index-id <id> --name <new-name>
upstash vector reset-password --index-id <id>
upstash vector set-plan --index-id <id> --plan <free|payg|fixed>
upstash vector transfer --index-id <id> --target-account <id>
upstash vector stats # 所有索引的聚合统计
upstash vector index-stats --index-id <id> [--period <1h|3h|12h|1d|3d|7d|30d>]区域: , , 。相似度函数: , , 。索引类型: , , 。稠密模型: , , , 。稀疏模型: , 。对于使用托管嵌入的索引,设置。
eu-west-1us-east-1us-central1COSINEEUCLIDEANDOT_PRODUCTDENSESPARSEHYBRIDBGE_SMALL_EN_V1_5BGE_BASE_EN_V1_5BGE_LARGE_EN_V1_5BGE_M3BM25BGE_M3HYBRID--dimension-count 0Search
Search
bash
upstash search list
upstash search get --index-id <id>
upstash search create --name <name> --region <region> --type <free|payg|fixed>
upstash search delete --index-id <id> [--dry-run]
upstash search rename --index-id <id> --name <new-name>
upstash search reset-password --index-id <id>
upstash search transfer --index-id <id> --target-account <id>
upstash search stats
upstash search index-stats --index-id <id> [--period <1h|3h|12h|1d|3d|7d|30d>]Regions: , .
eu-west-1us-central1bash
upstash search list
upstash search get --index-id <id>
upstash search create --name <name> --region <region> --type <free|payg|fixed>
upstash search delete --index-id <id> [--dry-run]
upstash search rename --index-id <id> --name <new-name>
upstash search reset-password --index-id <id>
upstash search transfer --index-id <id> --target-account <id>
upstash search stats
upstash search index-stats --index-id <id> [--period <1h|3h|12h|1d|3d|7d|30d>]区域: , 。
eu-west-1us-central1QStash
QStash
bash
upstash qstash list # run first; maps region → id
upstash qstash get --qstash-id <id>
upstash qstash rotate-token --qstash-id <id>
upstash qstash set-plan --qstash-id <id> --plan <paid|qstash_fixed_1m|qstash_fixed_10m|qstash_fixed_100m>
upstash qstash stats --qstash-id <id> [--period <1h|3h|12h|1d|3d|7d|30d>]
upstash qstash ipv4 # CIDR blocks for allowlisting
upstash qstash move-to-team --qstash-id <id> --target-team-id <id>
upstash qstash update-budget --qstash-id <id> --budget <dollars> # 0 = no limit
upstash qstash {enable,disable}-prodpack --qstash-id <id>bash
upstash qstash list # 先运行此命令;映射区域→ID
upstash qstash get --qstash-id <id>
upstash qstash rotate-token --qstash-id <id>
upstash qstash set-plan --qstash-id <id> --plan <paid|qstash_fixed_1m|qstash_fixed_10m|qstash_fixed_100m>
upstash qstash stats --qstash-id <id> [--period <1h|3h|12h|1d|3d|7d|30d>]
upstash qstash ipv4 # 用于白名单的CIDR块
upstash qstash move-to-team --qstash-id <id> --target-team-id <id>
upstash qstash update-budget --qstash-id <id> --budget <dollars> # 0表示无限制
upstash qstash {enable,disable}-prodpack --qstash-id <id>Conventions
约定
- Pipe any output to for field extraction, e.g.
jq.upstash redis list | jq '.[].database_id' - Use first on any
--dry-runordelete.remove-member - Use on
--hide-credentialswhen the password isn't needed.redis get
- 可将任何输出通过管道传递给进行字段提取,例如
jq。upstash redis list | jq '.[].database_id' - 在执行任何或
delete命令前,先使用remove-member测试。--dry-run - 当不需要密码时,在命令中使用
redis get参数。--hide-credentials