> ## Documentation Index
> Fetch the complete documentation index at: https://upstash.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Using redis-cli

> Connect to your Upstash Redis database with redis-cli. Learn how to install it, connect over TLS, run commands, and when to use TCP versus HTTP.

`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](/redis/howto/connect-with-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](https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/).

## Get your connection details

Open your database in the [Upstash Console](https://console.upstash.com) and go
to the **Details** tab. You will need the **Endpoint**, **Port**, and the
**Password** (token) of your database.

<Tip>
  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.
</Tip>

## Connect

Upstash enables TLS on every database, so you must pass the `--tls` flag when
connecting with `redis-cli`:

```bash theme={"system"}
> redis-cli --tls -a PASSWORD -h ENDPOINT -p PORT
ENDPOINT:PORT> set counter 0
OK
ENDPOINT:PORT> get counter
"0"
ENDPOINT:PORT> incr counter
(int) 1
ENDPOINT:PORT> incr counter
(int) 2
```

You can also connect using a single `rediss://` connection string (note the
double `s`, which signals TLS):

```bash theme={"system"}
> redis-cli -u rediss://default:PASSWORD@ENDPOINT:PORT
```

<Note>
  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.
</Note>

## TCP or HTTP?

Upstash serves the same database over two protocols, so you can pick whichever
fits your environment:

* **TCP (RESP)** — Use `redis-cli` and standard Redis clients such as `ioredis`,
  `redis-py`, or `jedis`. This is the right choice for local development,
  scripting, and long-running servers.
* **HTTP/REST** — Use the [@upstash/redis](/redis/howto/connect-with-upstash-redis)
  SDK or the [REST API](/redis/features/restapi). This is the right choice for
  serverless platforms like Vercel and Cloudflare Workers, where TCP-based
  clients can run into connection limits.

<Info>
  For connecting via the official SDKs and other language clients, see
  [Connect Your Client](/redis/howto/connect-client).
</Info>
