Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Create Your First Redis Enterprise Database

⏱️ Time: 5 minutes
📋 Prerequisites:

Quick Command

Create a basic database with one command:

redisctl enterprise database create \
  --data '{"name": "my-first-db", "memory_size": 1073741824}' \
  --wait

Step-by-Step Guide

1. Verify Cluster Connection

Check that redisctl can connect to your cluster:

redisctl enterprise cluster get -o json -q 'name'

What you should see:

"cluster1.local"

Troubleshooting:

  • ❌ "Connection refused" → Check REDIS_ENTERPRISE_URL or profile settings
  • ❌ "401 Unauthorized" → Verify credentials with redisctl profile get
  • ❌ "SSL error" → Add --insecure flag or set REDIS_ENTERPRISE_INSECURE=true

2. Check Available Resources

See what resources are available:

redisctl enterprise cluster get -o json -q '{
  shards_limit: shards_limit,
  shards_used: shards_used,
  memory_size: memory_size
}'

Example output:

{
  "shards_limit": 100,
  "shards_used": 5,
  "memory_size": 107374182400
}

3. Create the Database

Minimum configuration (1GB database):

redisctl enterprise database create \
  --data '{
    "name": "my-first-db",
    "memory_size": 1073741824,
    "type": "redis",
    "port": 12000
  }' \
  --wait

Common options:

  • memory_size: Bytes (1073741824 = 1GB, 10737418240 = 10GB)
  • type: redis or memcached
  • port: Must be unique on cluster (12000-19999 typical range)
  • replication: true for high availability
  • sharding: true for clustering across shards

What you should see:

{
  "uid": 1,
  "name": "my-first-db",
  "status": "active",
  "port": 12000,
  "memory_size": 1073741824,
  "endpoint": "redis-12000.cluster1.local"
}

4. Get Connection Details

Retrieve your database endpoint and authentication:

redisctl enterprise database get --database-id 1 -o json -q '{
  endpoint: dns_address_master,
  port: port,
  password: authentication_redis_pass
}'

Output:

{
  "endpoint": "redis-12000.cluster1.local",
  "port": 12000,
  "password": "your-password-here"
}

5. Test Connection

Using redis-cli:

redis-cli -h redis-12000.cluster1.local \
  -p 12000 \
  -a your-password-here \
  PING

Expected response: PONG

Advanced Configuration

High Availability Database

Create a replicated database with automatic failover:

redisctl enterprise database create \
  --data '{
    "name": "ha-database",
    "memory_size": 10737418240,
    "type": "redis",
    "port": 12001,
    "replication": true,
    "data_persistence": "aof",
    "aof_policy": "appendfsync-every-sec"
  }' \
  --wait

Clustered Database

Create a sharded database for scaling:

redisctl enterprise database create \
  --data '{
    "name": "clustered-db",
    "memory_size": 53687091200,
    "type": "redis",
    "port": 12002,
    "sharding": true,
    "shards_count": 5,
    "oss_cluster": true
  }' \
  --wait

Using a Configuration File

For complex setups:

# Create database-config.json
cat > database-config.json << 'EOF'
{
  "name": "production-db",
  "memory_size": 21474836480,
  "type": "redis",
  "port": 12003,
  "replication": true,
  "sharding": true,
  "shards_count": 3,
  "data_persistence": "aof",
  "aof_policy": "appendfsync-every-sec",
  "eviction_policy": "volatile-lru",
  "oss_cluster": true,
  "authentication_redis_pass": "my-secure-password"
}
EOF

redisctl enterprise database create \
  --data @database-config.json \
  --wait

Common Issues

Port Already in Use

Error: Port 12000 is already allocated

Solution: Use a different port or check existing databases:

redisctl enterprise database list -o json -q '[].port'

Insufficient Cluster Resources

Error: Not enough memory available

Solution: Check cluster capacity:

redisctl enterprise cluster get -q '{available_memory: (memory_size - memory_used)}'

Database Stuck in "pending"

Status: pending

Solution: Check cluster node status:

redisctl enterprise node list -o table

All nodes should show online status. If not, investigate node issues first.

Memory Size Reference

Quick conversion table:

DescriptionBytesHuman
100 MB1048576000.1 GB
500 MB5242880000.5 GB
1 GB10737418241 GB
5 GB53687091205 GB
10 GB1073741824010 GB
50 GB5368709120050 GB
100 GB107374182400100 GB

Or use: echo "$((1 * 1024 * 1024 * 1024))" for 1GB

Next Steps

Now that you have a database:

See Also