redis-cli is the command line interface that ships with the official Redis
distribution. Because Upstash speaks the native Redis protocol over TCP, you can
use redis-cli to connect to your Upstash database and run any Redis command
directly from your terminal.
Upstash exposes your database over both TCP and HTTP. redis-cli and other
traditional clients use the TCP (RESP) protocol, while the HTTP/REST API and
@upstash/redis SDK are built for
serverless environments. This page covers the TCP path with redis-cli.
Install redis-cli#
redis-cli is included in the official Redis distribution. If you don't have
Redis installed, follow the
Redis installation guide.
Get your connection details#
Open your database in the Upstash Console and go to the Details tab. You will need the Endpoint, Port, and the Password (token) of your database.
The Details tab has a ready-to-use redis-cli command with your endpoint,
port, and password already filled in. You can copy it and paste it straight
into your terminal.
Connect#
Upstash enables TLS on every database, so you must pass the --tls flag when
connecting with redis-cli:
You can also connect using a single rediss:// connection string (note the
double s, which signals TLS):
TLS is enabled by default for all Upstash Redis databases and cannot be
disabled. If you omit --tls (or use redis:// instead of rediss://), the
connection will fail.
TCP or HTTP?#
Upstash serves the same database over two protocols, so you can pick whichever fits your environment:
- TCP (RESP) — Use
redis-cliand standard Redis clients such asioredis,redis-py, orjedis. This is the right choice for local development, scripting, and long-running servers. - HTTP/REST — Use the @upstash/redis SDK or the REST API. This is the right choice for serverless platforms like Vercel and Cloudflare Workers, where TCP-based clients can run into connection limits.
For connecting via the official SDKs and other language clients, see Connect Your Client.