Tair DevToolset — Full-Lifecycle Tair Development Assistant
This Skill provides operational capabilities and development guidelines for Alibaba Cloud Tair (Redis OSS-Compatible) database, covering architecture selection, data structure design, instance creation, connection management, performance monitoring, error troubleshooting, and backup & recovery.
Note: This Skill executes real cloud operations via aliyun CLI. Restore operations are high-risk and will overwrite current data. Ensure the RAM account has the required permissions before use.
Supported Capabilities
| Capability |
Description |
| Architecture Selection |
Choose the right Tair architecture (Standard vs Cluster) and edition (Memory-optimized, Persistent memory, Disk-based) |
| Data Structure Design |
Select optimal Redis and Tair extended data structures for your use case |
| Instance Creation |
Create and configure Tair instances via aliyun CLI |
| Connection Management |
Connect via standalone/proxy/cluster modes with TLS support |
| Performance Monitoring |
Intelligent diagnostics via alibabacloud-tair-ai-assistant skill |
| Error Troubleshooting |
Diagnose and resolve common Tair connection, cluster, memory, and client errors |
| Backup and Recovery |
Configure backup policies, perform PITR, and restore data |
Part I — Cross-Cutting Concerns
1. Prerequisites
1.1 CLI Installation & Version
Aliyun CLI >= 3.3.3 required. Run aliyun version to verify. If not installed or version too low, see references/cli-installation-guide.md for installation instructions.
# Enable automatic plugin installation (required for r-kvstore plugin)
aliyun configure set --auto-plugin-install true
# Update existing plugins to latest version
aliyun plugin update
# Verify jq is installed (required for JSON parsing in scripts)
jq --version
1.2 Authentication
All credential configurations follow existing aliyun CLI settings.
Security Rules:
- NEVER read, echo, or print AK/SK values (e.g.,
echo $ALIBABA_CLOUD_ACCESS_KEY_ID is FORBIDDEN)
- NEVER ask the user to input AK/SK directly in the conversation or command line
- NEVER use
aliyun configure set with literal credential values
- ONLY use
aliyun configure list to check credential status
aliyun configure list
If no valid profile exists, STOP here. Configure credentials outside of this session, then return.
1.3 AI-Mode Configuration
[MUST] Enable AI-Mode at the start of any workflow (before any CLI invocation):
aliyun configure ai-mode enable
aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-tair-devtoolset"
[MUST] Disable AI-Mode at EVERY exit point — before delivering the final response for ANY reason (success, failure, error, user cancellation, etc.). AI-mode MUST NOT remain enabled after the skill stops running.
aliyun configure ai-mode disable
2. Security & Compliance
2.1 User-Agent Requirement
Every aliyun CLI command invocation must include:
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-tair-devtoolset
2.2 RAM Permissions
This Skill requires R-KVStore RAM permissions for instance management, backup, and recovery operations. See references/ram-policies.md for the full permission table and policy document.
[MUST] Permission Failure Handling: When any command fails due to permission errors:
- Read
references/ram-policies.md to get the full list of required permissions
- Use
ram-permission-diagnose skill to guide the user through requesting permissions
- Pause and wait until the user confirms that the required permissions have been granted
3. Parameter Confirmation Rule
Before executing any command or API call, ALL user-customizable parameters (e.g., RegionId, instance names, passwords, resource specifications) MUST be confirmed with the user. Do NOT assume or use default values without explicit user approval.
Part II — Capabilities
4. Architecture Selection
Choose the right Tair architecture based on data volume, throughput requirements, and read/write ratio.
When to Use
- Deciding between Standard and Cluster architecture
- Determining whether read/write splitting is needed
- Selecting edition type (Memory-optimized, Persistent memory, Disk-based)
- Evaluating Tair vs Open Source Redis for a new project
Key Guidance
Key Concepts:
| Component |
Description |
| Node |
Smallest unit, runs Redis-compatible process |
| Shard |
Group of nodes storing a subset of data |
| Master node |
Handles write operations |
| Replica node |
Copy of master, provides failover |
| Read-only node |
Serves read traffic only (read/write splitting) |
| Proxy node |
Routes requests to appropriate nodes |
Architecture Comparison:
| Dimension |
Standard |
Cluster |
| Structure |
One master + replicas |
Multiple shards, each with master + replicas |
| Data partitioning |
No (single shard) |
Yes (distributed across shards) |
| Best for |
Small data, stable QPS |
Large data, high QPS, throughput-intensive |
| Read/write splitting |
Supported |
Supported |
Selection Decision Tree:
Data volume > single-node capacity?
├── Yes → Cluster architecture
│ └── Read-heavy? → Enable read/write splitting
└── No → Standard architecture
└── Read-heavy? → Enable read/write splitting
References
- references/architecture-selection/arch-selection.md — Architecture selection decision guide
- references/architecture-selection/arch-compare-oss-redis.md — Tair vs Open Source Redis comparison and edition selection
5. Data Structure Design
Choose the appropriate data structure based on your access patterns and business requirements.
When to Use
- Selecting data structures for a new feature or application
- Choosing between Redis native and Tair extended data structures
- Migrating data models and evaluating structure alternatives
Key Guidance
Redis Data Structures:
| Name |
Use Case |
| String |
Caching, counters, distributed locks, session storage, rate limiting |
| Hash |
Object storage (user profiles, product info), grouped field-value pairs |
| List |
Message queues, latest feeds, task queues, stack/queue operations |
| Set |
Unique collections, tagging, social graph (followers/friends), set operations |
| Sorted Set |
Leaderboards, ranking systems, priority queues, range queries by score |
| Stream |
Event sourcing, log streaming, message queues with consumer groups |
| Bitmap |
Feature flags, online status tracking, daily active user counting |
| Bitfield |
Compact counters, fixed-width integer encoding, atomic increment |
| Geospatial |
Location-based services, nearby search, geofencing |
| HyperLogLog |
Unique visitor counting, cardinality estimation with minimal memory |
Tair Data Structures:
| Name |
Use Case |
| exString / TairString (String enhancement) |
Versioned strings, bounded INCRBY, CAS/CAD for distributed locks |
| exHash / TairHash (Hash enhancement) |
Field-level TTL, field versioning, multi-device login management |
| exZset / TairZset (Zset enhancement) |
Multi-dimensional scoring (256 dims), multi-criteria ranking |
| GIS / TairGis (Geospatial enhancement) |
Point/line/polygon queries, spatial relationship checks |
| Doc / TairDoc (JSON) |
JSON with binary tree indexing, fast sub-element access |
| Search / TairSearch |
ES-like full-text search, multi-column index, tokenization |
| TS / TairTs (TimeSeries) |
Real-time monitoring, IoT data, two-level timeline aggregation |
| Bloom / TairBloom |
Probabilistic membership testing, deduplication, URL filtering |
| Cpc / TairCpc |
Compressed cardinality estimation, streaming analytics |
| Roaring / TairRoaring (Bitmap enhancement) |
User segmentation, audience targeting, multi-bitmap operations |
| Vector / TairVector |
Vector similarity search, LLM Chatbot, multimodal retrieval |
References
6. Instance Creation
Create and configure Tair instances on Alibaba Cloud, including whitelist configuration and public endpoint allocation.
When to Use
- Creating a new Tair instance for testing, development, or production
- Configuring network access (whitelist, public endpoint) for an instance
- Setting up a Tair benchmark or PoC environment
6.1 Choosing Instance Specifications
Required Parameters:
| Parameter |
Description |
Example |
| VPC_ID |
VPC ID |
vpc-bp1xxx |
| VSWITCH_ID |
VSwitch ID |
vsw-bp1xxx |
Optional Parameters (with defaults):
| Parameter |
Default |
Description |
| REGION_ID |
cn-hangzhou |
Region ID |
| ZONE_ID |
cn-hangzhou-h |
Zone ID |
| INSTANCE_TYPE |
tair_rdb |
Instance series: tair_rdb (DRAM), tair_scm (Persistent memory), tair_essd (ESSD disk) |
| INSTANCE_CLASS |
tair.rdb.1g |
Instance specification (see table below) |
| INSTANCE_NAME |
tair-benchmark-<timestamp> |
Instance name |
| CHARGE_TYPE |
PostPaid |
Billing method: PostPaid (pay-as-you-go), PrePaid (subscription) |
Common Specifications (Standard Architecture):
| InstanceClass |
Memory |
Bandwidth |
Max Connections |
QPS Reference |
| tair.rdb.1g |
1 GB |
768 Mbps |
30,000 |
300,000 |
| tair.rdb.2g |
2 GB |
768 Mbps |
30,000 |
300,000 |
| tair.rdb.4g |
4 GB |
768 Mbps |
40,000 |
300,000 |
| tair.rdb.8g |
8 GB |
768 Mbps |
40,000 |
300,000 |
| tair.rdb.16g |
16 GB |
768 Mbps |
40,000 |
300,000 |
| tair.rdb.24g |
24 GB |
768 Mbps |
50,000 |
300,000 |
| tair.rdb.32g |
32 GB |
768 Mbps |
50,000 |
300,000 |
| tair.rdb.64g |
64 GB |
768 Mbps |
50,000 |
300,000 |
6.2 Automated Workflow (Script)
For quick end-to-end instance creation with public network access, use the all-in-one script:
Execution Constraints:
- MUST use
scripts/create-and-connect-test.sh for this workflow — do NOT bypass the script to directly call individual aliyun r-kvstore commands
- DO NOT write or concatenate aliyun CLI commands to replace script functionality
- Model's responsibility: collect parameters → set environment variables → run script
export VPC_ID="<user-confirmed VPC_ID>"
export VSWITCH_ID="<user-confirmed VSWITCH_ID>"
# Optional parameters
export REGION_ID="cn-hangzhou"
export ZONE_ID="cn-hangzhou-h"
export INSTANCE_TYPE="tair_rdb"
export INSTANCE_CLASS="tair.rdb.1g"
# For NAT environment, manually set public IP
# export MY_PUBLIC_IP="your-public-ip"
bash scripts/create-and-connect-test.sh
The script will automatically complete: Create instance → Wait for ready → Configure whitelist → Allocate public endpoint → Get public connection info.
6.3 Manual CLI Steps
For custom requirements (PrePaid subscription, no public endpoint, custom security groups, etc.), use manual CLI steps:
Step 1 — Create instance:
aliyun r-kvstore create-tair-instance \
--biz-region-id "$REGION_ID" --zone-id "$ZONE_ID" \
--vpc-id "$VPC_ID" --vswitch-id "$VSWITCH_ID" \
--instance-type "$INSTANCE_TYPE" --instance-class "$INSTANCE_CLASS" \
--password "$PASSWORD" --charge-type "$CHARGE_TYPE" \
--shard-type "MASTER_SLAVE" \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-tair-devtoolset
Step 2 — Wait for instance ready (poll until InstanceStatus is Normal):
aliyun r-kvstore describe-instance-attribute \
--instance-id "$INSTANCE_ID" \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-tair-devtoolset
Step 3 — Configure whitelist:
aliyun r-kvstore modify-security-ips \
--instance-id "$INSTANCE_ID" --security-ips "$MY_PUBLIC_IP" \
--security-ip-group-name "default" \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-tair-devtoolset
Step 4 — Allocate public endpoint:
aliyun r-kvstore allocate-instance-public-connection \
--instance-id "$INSTANCE_ID" \
--connection-string-prefix "${INSTANCE_ID}pub" --port "6379" \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-tair-devtoolset
6.4 Success Verification
aliyun r-kvstore describe-instance-attribute \
--instance-id "$INSTANCE_ID" \
--user-agent AlibabaCloud-Agent-Skills/alibabacloud-tair-devtoolset
Confirm InstanceStatus is Normal and public endpoint is allocated. For the full 3-step verification (instance status, whitelist, public endpoint), see references/verification-method.md.
References
- references/instance-creation/connect-create-instance.md — End-to-end instance creation and connection guide with redis-cli examples
- references/related-commands.md — Complete CLI command and parameter reference
- references/verification-method.md — Detailed success verification steps
- references/acceptance-criteria.md — CLI command correctness standards
7. Connection Management
Connect to Tair instances using various Redis-compatible clients in standalone, proxy, cluster, or TLS modes.
When to Use
- Connecting to a Tair instance from application code
- Choosing the right client library and connection mode
- Configuring TLS/SSL encryption for secure connections
- Troubleshooting connection issues
Key Guidance
Connection Modes:
| Mode |
Architecture |
Description |
| Standalone/Proxy |
Standard or Cluster (proxy mode) |
Connect via proxy node; supports all Redis commands including cross-slot multi-key |
| Cluster Direct |
Cluster (direct mode) |
Connect directly to data nodes; requires cluster-aware client; cross-slot multi-key commands not supported |
| TLS |
Any (overlay) |
Encrypt connections with TLS/SSL; supports both Proxy and Direct modes |
Authentication Format:
- Default account: password only
- Custom account:
<user>:<password>
- redis-cli: use
REDISCLI_AUTH environment variable — export REDISCLI_AUTH='InstanceID:Password'
Supported Clients: Jedis, Lettuce, Redisson (Java); redis-py (Python); Predis, phpredis (PHP); StackExchange.Redis (.NET); go-redis (Go); node-redis (Node.js); Spring Data Redis
References
- references/connection-management/connect-standalone-or-proxy.md — Standalone/proxy connection examples in Java, Python, PHP, .NET, Go, Spring Data Redis
- references/connection-management/connect-cluster.md — Cluster connection examples (JedisCluster, RedisCluster, LettuceCluster, go-redis cluster, redis-cli)
- references/connection-management/connect-with-tls.md — TLS/SSL connection examples for all client types (Proxy + Direct)
8. Performance Monitoring
Intelligent performance monitoring and diagnostics via the Tair AI Assistant (DAS API).
When to Use
- Diagnosing slow queries or performance degradation
- Analyzing memory usage and identifying big keys / hotspot keys
- Tuning instance parameters and connection settings
- Monitoring instance health and resource utilization
Key Guidance
For intelligent diagnostics, install and use the alibabacloud-tair-ai-assistant skill:
npx skills add aliyun/alibabacloud-aiops-skills --skill alibabacloud-tair-ai-assistant --agent <your-agent-platform>
The AI Assistant provides natural language based diagnostics covering: instance management, performance analysis, slow queries, memory analysis, big key / hotspot key detection, parameter tuning, and connection troubleshooting.
References
9. Error Troubleshooting
Diagnose and resolve common Tair errors across authentication, connection, cluster, memory, proxy, Lua/transactions, and client-specific issues.
When to Use
- Encountering authentication or connection errors
- Resolving cluster-related errors (cross-slot, moved, read-only)
- Handling memory exhaustion or command errors
- Debugging client-specific issues (Jedis, Lettuce, Redisson, go-redis, etc.)
Key Guidance
Common Error Categories:
| Category |
Example Errors |
Typical Cause |
| Authentication |
NOAUTH Authentication required, WRONGPASS |
Password not provided, incorrect password, or Lettuce CLIENT SETINFO bug |
| Connection |
ERR illegal address, max number of clients reached |
Client IP not in whitelist, connection pool leak, DNS failure |
| Cluster |
CROSSSLOT Keys in request don't hash to the same slot, MOVED |
Multi-key command across slots, key moved to another node |
| Memory/Command |
OOM command not allowed, WRONGTYPE, ERR unknown command |
Memory exceeded, wrong data type, command not supported |
| Proxy Mode |
client ip is not in whitelist, redis temporary failure |
Proxy whitelist, sub-instance timeout, request queue overflow |
| Lua/Transaction |
BUSY Redis is busy running a script, NOSCRIPT |
Long-running Lua script, script SHA not in cache |
| Client-specific |
Jedis Could not get a resource from the pool, Lettuce NOAUTH with correct password, go-redis cluster format panic |
Pool exhaustion, version incompatibility, RESP2/RESP3 mismatch |
References
- references/error-troubleshooting/errors-troubleshooting.md — Complete error tables with causes and solutions for all error categories and client libraries
- Common errors and troubleshooting
10. Backup and Recovery
Configure backup policies, create manual backups, restore data from backups, and perform point-in-time recovery (PITR).
When to Use
- Configuring automatic backup policies
- Creating a manual backup before high-risk operations
- Restoring data from a backup set
- Performing point-in-time recovery (PITR) or key-filtered recovery
Key Guidance
Persistence Policies:
| Policy |
Mechanism |
Key Feature |
| RDB |
Periodic snapshots |
Small files, non-blocking backup |
| AOF |
Logs all write operations |
Fsync every second by default, AOF rewrite reduces disk usage |
| Tair-Binlog |
Incremental AOF archiving (Enterprise DRAM only) |
Prevents AOF rewrite degradation, enables PITR accurate to the second |
Key CLI Operations:
modify-backup-policy — Modify automatic backup schedule
create-backup — Create a manual backup
describe-backups — Query available backup sets
restore-instance — Restore from backup set or point-in-time
- Full backup:
--backup-id "$BACKUP_ID"
- PITR:
--restore-type 1 --restore-time "2024-01-15T10:30:00Z"
- Key-filtered PITR: add
--filter-key "session:*,user:*"
⚠️ HIGH-RISK OPERATION — restore-instance overwrites current data and cannot be undone.
Before executing any restore:
- Verify current write traffic — Check if the instance has active writes; notify the user if so
- Create a latest backup — Run
create-backup to preserve current data as a rollback point
- Confirm with the user — Explicitly inform that data will be overwritten and obtain confirmation
References
References Index
| Reference |
Description |
Scope |
| references/cli-installation-guide.md |
Aliyun CLI installation and configuration guide |
Cross-cutting |
| references/ram-policies.md |
RAM permission policy document |
Cross-cutting |
| references/acceptance-criteria.md |
CLI command correctness standards |
Cross-cutting (QA) |
| references/related-commands.md |
Complete CLI command and parameter reference |
Instance Creation |
| references/verification-method.md |
Success verification steps |
Instance Creation |
| references/architecture-selection/arch-selection.md |
Architecture selection decision guide |
Architecture Selection |
| references/architecture-selection/arch-compare-oss-redis.md |
Tair vs Open Source Redis comparison |
Architecture Selection |
| references/data-structure-design/data-structure-design.md |
Detailed data structure use cases |
Data Structure Design |
| references/instance-creation/connect-create-instance.md |
End-to-end instance creation and connection guide |
Instance Creation |
| references/connection-management/connect-standalone-or-proxy.md |
Standalone/proxy connection examples |
Connection Management |
| references/connection-management/connect-cluster.md |
Cluster connection examples |
Connection Management |
| references/connection-management/connect-with-tls.md |
TLS connection examples (Proxy + Direct) |
Connection Management |
| references/performance-monitoring/perf-monitoring.md |
Performance monitoring and diagnostics |
Performance Monitoring |
| references/error-troubleshooting/errors-troubleshooting.md |
Complete error tables with causes and solutions |
Error Troubleshooting |
| references/backup-and-recovery/backup-recovery.md |
Backup and recovery strategies with CLI examples |
Backup and Recovery |
1---
2name: alibabacloud-tair-devtoolset
3description: |
4 Alibaba Cloud Tair development toolkit — 7 capabilities covering architecture selection, data structure design, instance creation & configuration, connection management, performance monitoring, error troubleshooting, and backup & recovery.
5 Executes real cloud operations via aliyun CLI (creating instances, modifying whitelists, managing backups, restoring data). Restore operations are high-risk and will overwrite current data. Ensure the RAM account has required permissions (see references/ram-policies.md).
6 Triggers: "tair", "create tair instance", "tair instance", "redis", "data structure", "backup", "PITR", "tair architecture", "tair connection", "tair error".
7---
8
9# Tair DevToolset — Full-Lifecycle Tair Development Assistant
10
11This Skill provides operational capabilities and development guidelines for **Alibaba Cloud Tair (Redis OSS-Compatible)** database, covering architecture selection, data structure design, instance creation, connection management, performance monitoring, error troubleshooting, and backup & recovery.
12
13> **Note:** This Skill executes real cloud operations via aliyun CLI. Restore operations are high-risk and will overwrite current data. Ensure the RAM account has the [required permissions](references/ram-policies.md) before use.
14
15### Supported Capabilities
16
17| Capability | Description |
18|------------|-------------|
19| Architecture Selection | Choose the right Tair architecture (Standard vs Cluster) and edition (Memory-optimized, Persistent memory, Disk-based) |
20| Data Structure Design | Select optimal Redis and Tair extended data structures for your use case |
21| Instance Creation | Create and configure Tair instances via aliyun CLI |
22| Connection Management | Connect via standalone/proxy/cluster modes with TLS support |
23| Performance Monitoring | Intelligent diagnostics via alibabacloud-tair-ai-assistant skill |
24| Error Troubleshooting | Diagnose and resolve common Tair connection, cluster, memory, and client errors |
25| Backup and Recovery | Configure backup policies, perform PITR, and restore data |
26
27---
28
29# Part I — Cross-Cutting Concerns
30
31## 1. Prerequisites
32
33### 1.1 CLI Installation & Version
34
35**Aliyun CLI >= 3.3.3 required.** Run `aliyun version` to verify. If not installed or version too low, see [references/cli-installation-guide.md](references/cli-installation-guide.md) for installation instructions.
36
37```bash
38# Enable automatic plugin installation (required for r-kvstore plugin)
39aliyun configure set --auto-plugin-install true
40
41# Update existing plugins to latest version
42aliyun plugin update
43
44# Verify jq is installed (required for JSON parsing in scripts)
45jq --version
46```
47
48### 1.2 Authentication
49
50All credential configurations follow existing aliyun CLI settings.
51
52**Security Rules:**
53- **NEVER** read, echo, or print AK/SK values (e.g., `echo $ALIBABA_CLOUD_ACCESS_KEY_ID` is FORBIDDEN)
54- **NEVER** ask the user to input AK/SK directly in the conversation or command line
55- **NEVER** use `aliyun configure set` with literal credential values
56- **ONLY** use `aliyun configure list` to check credential status
57
58```bash
59aliyun configure list
60```
61
62**If no valid profile exists, STOP here.** Configure credentials outside of this session, then return.
63
64### 1.3 AI-Mode Configuration
65
66> **[MUST] Enable AI-Mode at the start** of any workflow (before any CLI invocation):
67> ```bash
68> aliyun configure ai-mode enable
69> aliyun configure ai-mode set-user-agent --user-agent "AlibabaCloud-Agent-Skills/alibabacloud-tair-devtoolset"
70> ```
71
72> **[MUST] Disable AI-Mode at EVERY exit point** — before delivering the final response for ANY reason (success, failure, error, user cancellation, etc.). AI-mode MUST NOT remain enabled after the skill stops running.
73> ```bash
74> aliyun configure ai-mode disable
75> ```
76
77## 2. Security & Compliance
78
79### 2.1 User-Agent Requirement
80
81Every `aliyun` CLI command invocation must include:
82```
83--user-agent AlibabaCloud-Agent-Skills/alibabacloud-tair-devtoolset
84```
85
86### 2.2 RAM Permissions
87
88This Skill requires R-KVStore RAM permissions for instance management, backup, and recovery operations. See [references/ram-policies.md](references/ram-policies.md) for the full permission table and policy document.
89
90> **[MUST] Permission Failure Handling:** When any command fails due to permission errors:
91> 1. Read `references/ram-policies.md` to get the full list of required permissions
92> 2. Use `ram-permission-diagnose` skill to guide the user through requesting permissions
93> 3. Pause and wait until the user confirms that the required permissions have been granted
94
95## 3. Parameter Confirmation Rule
96
97Before executing any command or API call, ALL user-customizable parameters (e.g., RegionId, instance names, passwords, resource specifications) **MUST be confirmed with the user**. Do NOT assume or use default values without explicit user approval.
98
99---
100
101# Part II — Capabilities
102
103## 4. Architecture Selection
104
105Choose the right Tair architecture based on data volume, throughput requirements, and read/write ratio.
106
107### When to Use
108
109- Deciding between Standard and Cluster architecture
110- Determining whether read/write splitting is needed
111- Selecting edition type (Memory-optimized, Persistent memory, Disk-based)
112- Evaluating Tair vs Open Source Redis for a new project
113
114### Key Guidance
115
116**Key Concepts:**
117
118| Component | Description |
119|-----------|-------------|
120| Node | Smallest unit, runs Redis-compatible process |
121| Shard | Group of nodes storing a subset of data |
122| Master node | Handles write operations |
123| Replica node | Copy of master, provides failover |
124| Read-only node | Serves read traffic only (read/write splitting) |
125| Proxy node | Routes requests to appropriate nodes |
126
127**Architecture Comparison:**
128
129| Dimension | Standard | Cluster |
130|-----------|----------|---------|
131| Structure | One master + replicas | Multiple shards, each with master + replicas |
132| Data partitioning | No (single shard) | Yes (distributed across shards) |
133| Best for | Small data, stable QPS | Large data, high QPS, throughput-intensive |
134| Read/write splitting | Supported | Supported |
135
136**Selection Decision Tree:**
137
138```
139Data volume > single-node capacity?
140├── Yes → Cluster architecture
141│ └── Read-heavy? → Enable read/write splitting
142└── No → Standard architecture
143 └── Read-heavy? → Enable read/write splitting
144```
145
146### References
147
148- [references/architecture-selection/arch-selection.md](references/architecture-selection/arch-selection.md) — Architecture selection decision guide
149- [references/architecture-selection/arch-compare-oss-redis.md](references/architecture-selection/arch-compare-oss-redis.md) — Tair vs Open Source Redis comparison and edition selection
150
151---
152
153## 5. Data Structure Design
154
155Choose the appropriate data structure based on your access patterns and business requirements.
156
157### When to Use
158
159- Selecting data structures for a new feature or application
160- Choosing between Redis native and Tair extended data structures
161- Migrating data models and evaluating structure alternatives
162
163### Key Guidance
164
165**Redis Data Structures:**
166
167| Name | Use Case |
168|------|----------|
169| String | Caching, counters, distributed locks, session storage, rate limiting |
170| Hash | Object storage (user profiles, product info), grouped field-value pairs |
171| List | Message queues, latest feeds, task queues, stack/queue operations |
172| Set | Unique collections, tagging, social graph (followers/friends), set operations |
173| Sorted Set | Leaderboards, ranking systems, priority queues, range queries by score |
174| Stream | Event sourcing, log streaming, message queues with consumer groups |
175| Bitmap | Feature flags, online status tracking, daily active user counting |
176| Bitfield | Compact counters, fixed-width integer encoding, atomic increment |
177| Geospatial | Location-based services, nearby search, geofencing |
178| HyperLogLog | Unique visitor counting, cardinality estimation with minimal memory |
179
180**Tair Data Structures:**
181
182| Name | Use Case |
183|------|----------|
184| exString / TairString (String enhancement) | Versioned strings, bounded INCRBY, CAS/CAD for distributed locks |
185| exHash / TairHash (Hash enhancement) | Field-level TTL, field versioning, multi-device login management |
186| exZset / TairZset (Zset enhancement) | Multi-dimensional scoring (256 dims), multi-criteria ranking |
187| GIS / TairGis (Geospatial enhancement) | Point/line/polygon queries, spatial relationship checks |
188| Doc / TairDoc (JSON) | JSON with binary tree indexing, fast sub-element access |
189| Search / TairSearch | ES-like full-text search, multi-column index, tokenization |
190| TS / TairTs (TimeSeries) | Real-time monitoring, IoT data, two-level timeline aggregation |
191| Bloom / TairBloom | Probabilistic membership testing, deduplication, URL filtering |
192| Cpc / TairCpc | Compressed cardinality estimation, streaming analytics |
193| Roaring / TairRoaring (Bitmap enhancement) | User segmentation, audience targeting, multi-bitmap operations |
194| Vector / TairVector | Vector similarity search, LLM Chatbot, multimodal retrieval |
195
196### References
197
198- [references/data-structure-design/data-structure-design.md](references/data-structure-design/data-structure-design.md) — Detailed data structure use case descriptions
199- [Redis Data Types](https://redis.io/docs/latest/develop/data-types/)
200- [Tair Extended Data Structures](https://help.aliyun.com/zh/redis/developer-reference/extended-data-structures-of-apsaradb-for-redis-enhanced-edition)
201
202---
203
204## 6. Instance Creation
205
206Create and configure Tair instances on Alibaba Cloud, including whitelist configuration and public endpoint allocation.
207
208### When to Use
209
210- Creating a new Tair instance for testing, development, or production
211- Configuring network access (whitelist, public endpoint) for an instance
212- Setting up a Tair benchmark or PoC environment
213
214### 6.1 Choosing Instance Specifications
215
216**Required Parameters:**
217
218| Parameter | Description | Example |
219|-----------|-------------|---------|
220| VPC_ID | VPC ID | `vpc-bp1xxx` |
221| VSWITCH_ID | VSwitch ID | `vsw-bp1xxx` |
222
223**Optional Parameters (with defaults):**
224
225| Parameter | Default | Description |
226|-----------|---------|-------------|
227| REGION_ID | `cn-hangzhou` | Region ID |
228| ZONE_ID | `cn-hangzhou-h` | Zone ID |
229| INSTANCE_TYPE | `tair_rdb` | Instance series: `tair_rdb` (DRAM), `tair_scm` (Persistent memory), `tair_essd` (ESSD disk) |
230| INSTANCE_CLASS | `tair.rdb.1g` | Instance specification (see table below) |
231| INSTANCE_NAME | `tair-benchmark-<timestamp>` | Instance name |
232| CHARGE_TYPE | `PostPaid` | Billing method: `PostPaid` (pay-as-you-go), `PrePaid` (subscription) |
233
234**Common Specifications (Standard Architecture):**
235
236| InstanceClass | Memory | Bandwidth | Max Connections | QPS Reference |
237|---------------|--------|-----------|-----------------|---------------|
238| tair.rdb.1g | 1 GB | 768 Mbps | 30,000 | 300,000 |
239| tair.rdb.2g | 2 GB | 768 Mbps | 30,000 | 300,000 |
240| tair.rdb.4g | 4 GB | 768 Mbps | 40,000 | 300,000 |
241| tair.rdb.8g | 8 GB | 768 Mbps | 40,000 | 300,000 |
242| tair.rdb.16g | 16 GB | 768 Mbps | 40,000 | 300,000 |
243| tair.rdb.24g | 24 GB | 768 Mbps | 50,000 | 300,000 |
244| tair.rdb.32g | 32 GB | 768 Mbps | 50,000 | 300,000 |
245| tair.rdb.64g | 64 GB | 768 Mbps | 50,000 | 300,000 |
246
247### 6.2 Automated Workflow (Script)
248
249For quick end-to-end instance creation with public network access, use the all-in-one script:
250
251> **Execution Constraints:**
252> - **MUST** use `scripts/create-and-connect-test.sh` for this workflow — do NOT bypass the script to directly call individual `aliyun r-kvstore` commands
253> - **DO NOT** write or concatenate aliyun CLI commands to replace script functionality
254> - Model's responsibility: collect parameters → set environment variables → run script
255
256```bash
257export VPC_ID="<user-confirmed VPC_ID>"
258export VSWITCH_ID="<user-confirmed VSWITCH_ID>"
259
260# Optional parameters
261export REGION_ID="cn-hangzhou"
262export ZONE_ID="cn-hangzhou-h"
263export INSTANCE_TYPE="tair_rdb"
264export INSTANCE_CLASS="tair.rdb.1g"
265# For NAT environment, manually set public IP
266# export MY_PUBLIC_IP="your-public-ip"
267
268bash scripts/create-and-connect-test.sh
269```
270
271The script will automatically complete: Create instance → Wait for ready → Configure whitelist → Allocate public endpoint → Get public connection info.
272
273### 6.3 Manual CLI Steps
274
275For custom requirements (PrePaid subscription, no public endpoint, custom security groups, etc.), use manual CLI steps:
276
277**Step 1 — Create instance:**
278```bash
279aliyun r-kvstore create-tair-instance \
280 --biz-region-id "$REGION_ID" --zone-id "$ZONE_ID" \
281 --vpc-id "$VPC_ID" --vswitch-id "$VSWITCH_ID" \
282 --instance-type "$INSTANCE_TYPE" --instance-class "$INSTANCE_CLASS" \
283 --password "$PASSWORD" --charge-type "$CHARGE_TYPE" \
284 --shard-type "MASTER_SLAVE" \
285 --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tair-devtoolset
286```
287
288**Step 2 — Wait for instance ready** (poll until `InstanceStatus` is `Normal`):
289```bash
290aliyun r-kvstore describe-instance-attribute \
291 --instance-id "$INSTANCE_ID" \
292 --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tair-devtoolset
293```
294
295**Step 3 — Configure whitelist:**
296```bash
297aliyun r-kvstore modify-security-ips \
298 --instance-id "$INSTANCE_ID" --security-ips "$MY_PUBLIC_IP" \
299 --security-ip-group-name "default" \
300 --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tair-devtoolset
301```
302
303**Step 4 — Allocate public endpoint:**
304```bash
305aliyun r-kvstore allocate-instance-public-connection \
306 --instance-id "$INSTANCE_ID" \
307 --connection-string-prefix "${INSTANCE_ID}pub" --port "6379" \
308 --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tair-devtoolset
309```
310
311### 6.4 Success Verification
312
313```bash
314aliyun r-kvstore describe-instance-attribute \
315 --instance-id "$INSTANCE_ID" \
316 --user-agent AlibabaCloud-Agent-Skills/alibabacloud-tair-devtoolset
317```
318
319Confirm `InstanceStatus` is `Normal` and public endpoint is allocated. For the full 3-step verification (instance status, whitelist, public endpoint), see [references/verification-method.md](references/verification-method.md).
320
321### References
322
323- [references/instance-creation/connect-create-instance.md](references/instance-creation/connect-create-instance.md) — End-to-end instance creation and connection guide with redis-cli examples
324- [references/related-commands.md](references/related-commands.md) — Complete CLI command and parameter reference
325- [references/verification-method.md](references/verification-method.md) — Detailed success verification steps
326- [references/acceptance-criteria.md](references/acceptance-criteria.md) — CLI command correctness standards
327
328---
329
330## 7. Connection Management
331
332Connect to Tair instances using various Redis-compatible clients in standalone, proxy, cluster, or TLS modes.
333
334### When to Use
335
336- Connecting to a Tair instance from application code
337- Choosing the right client library and connection mode
338- Configuring TLS/SSL encryption for secure connections
339- Troubleshooting connection issues
340
341### Key Guidance
342
343**Connection Modes:**
344
345| Mode | Architecture | Description |
346|------|-------------|-------------|
347| Standalone/Proxy | Standard or Cluster (proxy mode) | Connect via proxy node; supports all Redis commands including cross-slot multi-key |
348| Cluster Direct | Cluster (direct mode) | Connect directly to data nodes; requires cluster-aware client; cross-slot multi-key commands not supported |
349| TLS | Any (overlay) | Encrypt connections with TLS/SSL; supports both Proxy and Direct modes |
350
351**Authentication Format:**
352- Default account: password only
353- Custom account: `<user>:<password>`
354- redis-cli: use `REDISCLI_AUTH` environment variable — `export REDISCLI_AUTH='InstanceID:Password'`
355
356**Supported Clients:** Jedis, Lettuce, Redisson (Java); redis-py (Python); Predis, phpredis (PHP); StackExchange.Redis (.NET); go-redis (Go); node-redis (Node.js); Spring Data Redis
357
358### References
359
360- [references/connection-management/connect-standalone-or-proxy.md](references/connection-management/connect-standalone-or-proxy.md) — Standalone/proxy connection examples in Java, Python, PHP, .NET, Go, Spring Data Redis
361- [references/connection-management/connect-cluster.md](references/connection-management/connect-cluster.md) — Cluster connection examples (JedisCluster, RedisCluster, LettuceCluster, go-redis cluster, redis-cli)
362- [references/connection-management/connect-with-tls.md](references/connection-management/connect-with-tls.md) — TLS/SSL connection examples for all client types (Proxy + Direct)
363
364---
365
366## 8. Performance Monitoring
367
368Intelligent performance monitoring and diagnostics via the Tair AI Assistant (DAS API).
369
370### When to Use
371
372- Diagnosing slow queries or performance degradation
373- Analyzing memory usage and identifying big keys / hotspot keys
374- Tuning instance parameters and connection settings
375- Monitoring instance health and resource utilization
376
377### Key Guidance
378
379For intelligent diagnostics, install and use the **alibabacloud-tair-ai-assistant** skill:
380
381```bash
382npx skills add aliyun/alibabacloud-aiops-skills --skill alibabacloud-tair-ai-assistant --agent <your-agent-platform>
383```
384
385The AI Assistant provides natural language based diagnostics covering: instance management, performance analysis, slow queries, memory analysis, big key / hotspot key detection, parameter tuning, and connection troubleshooting.
386
387### References
388
389- [references/performance-monitoring/perf-monitoring.md](references/performance-monitoring/perf-monitoring.md) — Performance monitoring reference
390- [alibabacloud-tair-ai-assistant](https://skills.aliyun.com/skills/alibabacloud-tair-ai-assistant)
391
392---
393
394## 9. Error Troubleshooting
395
396Diagnose and resolve common Tair errors across authentication, connection, cluster, memory, proxy, Lua/transactions, and client-specific issues.
397
398### When to Use
399
400- Encountering authentication or connection errors
401- Resolving cluster-related errors (cross-slot, moved, read-only)
402- Handling memory exhaustion or command errors
403- Debugging client-specific issues (Jedis, Lettuce, Redisson, go-redis, etc.)
404
405### Key Guidance
406
407**Common Error Categories:**
408
409| Category | Example Errors | Typical Cause |
410|----------|---------------|---------------|
411| Authentication | `NOAUTH Authentication required`, `WRONGPASS` | Password not provided, incorrect password, or Lettuce CLIENT SETINFO bug |
412| Connection | `ERR illegal address`, `max number of clients reached` | Client IP not in whitelist, connection pool leak, DNS failure |
413| Cluster | `CROSSSLOT Keys in request don't hash to the same slot`, `MOVED` | Multi-key command across slots, key moved to another node |
414| Memory/Command | `OOM command not allowed`, `WRONGTYPE`, `ERR unknown command` | Memory exceeded, wrong data type, command not supported |
415| Proxy Mode | `client ip is not in whitelist`, `redis temporary failure` | Proxy whitelist, sub-instance timeout, request queue overflow |
416| Lua/Transaction | `BUSY Redis is busy running a script`, `NOSCRIPT` | Long-running Lua script, script SHA not in cache |
417| Client-specific | Jedis `Could not get a resource from the pool`, Lettuce `NOAUTH` with correct password, go-redis cluster format panic | Pool exhaustion, version incompatibility, RESP2/RESP3 mismatch |
418
419### References
420
421- [references/error-troubleshooting/errors-troubleshooting.md](references/error-troubleshooting/errors-troubleshooting.md) — Complete error tables with causes and solutions for all error categories and client libraries
422- [Common errors and troubleshooting](https://www.alibabacloud.com/help/en/redis/support/common-errors-and-troubleshooting)
423
424---
425
426## 10. Backup and Recovery
427
428Configure backup policies, create manual backups, restore data from backups, and perform point-in-time recovery (PITR).
429
430### When to Use
431
432- Configuring automatic backup policies
433- Creating a manual backup before high-risk operations
434- Restoring data from a backup set
435- Performing point-in-time recovery (PITR) or key-filtered recovery
436
437### Key Guidance
438
439**Persistence Policies:**
440
441| Policy | Mechanism | Key Feature |
442|--------|-----------|-------------|
443| RDB | Periodic snapshots | Small files, non-blocking backup |
444| AOF | Logs all write operations | Fsync every second by default, AOF rewrite reduces disk usage |
445| Tair-Binlog | Incremental AOF archiving (Enterprise DRAM only) | Prevents AOF rewrite degradation, enables PITR accurate to the second |
446
447**Key CLI Operations:**
448- `modify-backup-policy` — Modify automatic backup schedule
449- `create-backup` — Create a manual backup
450- `describe-backups` — Query available backup sets
451- `restore-instance` — Restore from backup set or point-in-time
452 - Full backup: `--backup-id "$BACKUP_ID"`
453 - PITR: `--restore-type 1 --restore-time "2024-01-15T10:30:00Z"`
454 - Key-filtered PITR: add `--filter-key "session:*,user:*"`
455
456> **⚠️ HIGH-RISK OPERATION — `restore-instance` overwrites current data and cannot be undone.**
457> Before executing any restore:
458> 1. **Verify current write traffic** — Check if the instance has active writes; notify the user if so
459> 2. **Create a latest backup** — Run `create-backup` to preserve current data as a rollback point
460> 3. **Confirm with the user** — Explicitly inform that data will be overwritten and obtain confirmation
461
462### References
463
464- [references/backup-and-recovery/backup-recovery.md](references/backup-and-recovery/backup-recovery.md) — Complete backup/recovery guide with CLI examples and data protection details
465- [Data backup and restoration policies](https://www.alibabacloud.com/help/en/redis/user-guide/backup-and-restoration-solutions)
466
467---
468
469# References Index
470
471| Reference | Description | Scope |
472|-----------|-------------|-------|
473| [references/cli-installation-guide.md](references/cli-installation-guide.md) | Aliyun CLI installation and configuration guide | Cross-cutting |
474| [references/ram-policies.md](references/ram-policies.md) | RAM permission policy document | Cross-cutting |
475| [references/acceptance-criteria.md](references/acceptance-criteria.md) | CLI command correctness standards | Cross-cutting (QA) |
476| [references/related-commands.md](references/related-commands.md) | Complete CLI command and parameter reference | Instance Creation |
477| [references/verification-method.md](references/verification-method.md) | Success verification steps | Instance Creation |
478| [references/architecture-selection/arch-selection.md](references/architecture-selection/arch-selection.md) | Architecture selection decision guide | Architecture Selection |
479| [references/architecture-selection/arch-compare-oss-redis.md](references/architecture-selection/arch-compare-oss-redis.md) | Tair vs Open Source Redis comparison | Architecture Selection |
480| [references/data-structure-design/data-structure-design.md](references/data-structure-design/data-structure-design.md) | Detailed data structure use cases | Data Structure Design |
481| [references/instance-creation/connect-create-instance.md](references/instance-creation/connect-create-instance.md) | End-to-end instance creation and connection guide | Instance Creation |
482| [references/connection-management/connect-standalone-or-proxy.md](references/connection-management/connect-standalone-or-proxy.md) | Standalone/proxy connection examples | Connection Management |
483| [references/connection-management/connect-cluster.md](references/connection-management/connect-cluster.md) | Cluster connection examples | Connection Management |
484| [references/connection-management/connect-with-tls.md](references/connection-management/connect-with-tls.md) | TLS connection examples (Proxy + Direct) | Connection Management |
485| [references/performance-monitoring/perf-monitoring.md](references/performance-monitoring/perf-monitoring.md) | Performance monitoring and diagnostics | Performance Monitoring |
486| [references/error-troubleshooting/errors-troubleshooting.md](references/error-troubleshooting/errors-troubleshooting.md) | Complete error tables with causes and solutions | Error Troubleshooting |
487| [references/backup-and-recovery/backup-recovery.md](references/backup-and-recovery/backup-recovery.md) | Backup and recovery strategies with CLI examples | Backup and Recovery |