Get started

Get Redis running and connect your first application, however you deploy it.

In this guide, you'll learn how to create a Redis deployment in Redis Cloud, Redis Software, or Redis Open Source. Then, you'll learn how to create an application that connects to your deployment.

Create a Redis deployment

This section shows how to set up a Redis deployment and connect to it with redis-cli.

  1. Install dependencies

    Before you begin, install the following dependencies in your development environment:

    • redis-cli: command-line tool that connects to a deployment and runs Redis commands
    • Docker: platform that runs software in containers, including local Redis deployments

    Select the tab corresponding to your deployment method to see which of these you need.

    • A web browser, to sign up and manage your database in the Redis Cloud console.
      • redis-cli installed locally, to connect to your database in step 3:

        curl -fsSL https://packages.redis.io/redis-cli/install.sh | sh
        

        See Install redis-cli for more information.

  2. Set up a fully-featured deployment

    Select the tab corresponding to your deployment method and follow its instructions to deploy Redis and create a database.

    Sign up and create your database. Signing up creates a free 30 MB database for you.

    To create additional or different types of databases from the console, see:

    • Create an Essentials database — a cost-efficient, fully managed database for low-throughput workloads, training, and prototyping.
    • Create a Pro database — a dedicated, "pay as you go" database for production workloads that need higher throughput, larger datasets, and advanced features like Active-Active and clustering.
  3. Connect to your deployment

    You can connect to your deployment with redis-cli. Select the tab corresponding to your deployment method.

    Get your database's host, port, and password from the connection wizard in the Redis Cloud console, then connect with redis-cli:

    redis-cli -h <hostname> -p <portnumber> -a <password>
    

    See Connect to a Redis Cloud database for the full procedure, including Redis Insight and client library options.

Congratulations! You have successfully set up your Redis deployment and connected to it.

In the next section, you'll learn how to create an application that connects to your deployment and interacts with data.

Create your first Redis application

To connect to your Redis deployment in an application, you can use one of the official Redis client libraries.

Select your preferred programming language from the tabs in each step below.

  1. Load sample data

    Unlike some databases, Redis doesn't need a separate sample-data load step. The SET and GET commands in step 3 both create and read the sample data directly — there's no dataset to restore first.

  2. Initialize your application

    Create a project directory and install redis-py:

    mkdir python-quickstart
    cd python-quickstart
    pip install redis
    
  3. Create your application

    Copy the following code into app.py. This connects to your database and sets and retrieves a value.

    import redis
    
    r = redis.Redis(host='localhost', port=6379, decode_responses=True)
    
    r.set('bike:1', 'Process 134')
    print(r.get('bike:1'))
    
  4. Add your connection string

    The examples in step 3 connect to localhost:6379. Replace that with your actual deployment's host, port, and password — from the Redis Cloud connection wizard, the Redis Software connection details, or localhost:6379 if you're already running Redis Open Source locally.

       r = redis.from_url("redis://default:<password>@<host>:<port>")
    
  5. Run your application

       python app.py
    

    Each program prints Process 134 — the value you stored and then retrieved. (RedisVL's example instead confirms the index was created.)

  6. Explore a use case

    Each of the following quick starts shows a complete example application for a specific use case:

    Refer to the Redis use cases page for a complete set of use cases with code examples in your programming language.

Next steps

To learn more about developing with Redis, see the following resources:

RATE THIS PAGE
Back to top ↑