Skip to content

Quick start

This guide will go over setting up a simple developement environment connected to a Valkey Docker instance.

GLIDE provides two main client types:

  • GlideClient: For standalone Valkey instances.
  • GlideClusterClient: For cluster deployments.

For this guide, we will use a standalone client to connect to a Valkey Docker instance.

  1. Follow the instructions on the Docker website to install Docker for your operating system.

  2. Start a local Valkey server:

    Terminal window
    # Pull and run Valkey server
    docker run -d --name valkey-server -p 6379:6379 valkey/valkey:latest
    # Verify it's running
    docker ps
  3. Verify connection with Valkey server:

    Terminal window
    docker exec valkey-server valkey-cli ping
    # Expected output: PONG
  4. Install Valkey GLIDE

    Terminal window
    # Install the latest version
    pip3 install valkey-glide
  5. Finally, conect to Valkey using GLIDE and verify your installation.

    import asyncio
    from glide import GlideClient, NodeAddress
    async def main():
    # Create client configuration
    client = GlideClient([NodeAddress("localhost", 6379)])
    try:
    # Test the connection
    response = await client.ping()
    # Valkey respond with PONG
    print(f"Connected! Server responded: {response}")
    except Exception as e:
    print(f"Connection failed: {e}")
    finally:
    # Always close the client
    await client.close()
    # Run the async function
    if __name__ == "__main__":
    asyncio.run(main())
  6. Running the above snippet should give you this respond.

    Terminal window
    Connected! Server responded: PONG

GLIDE offers many configuration options. A typical configuration may look like following:

import asyncio
from glide import GlideClient, NodeAddress, GlideClientConfiguration
async def main():
# Setting up connection configuration
config = GlideClientConfiguration(
addresses=[NodeAddress("localhost", 6379)],
# Connection timeout (milliseconds)
request_timeout=5000,
# Connection pool size
connection_backoff_max_delay=1000,
# TLS configuration (if needed)
use_tls=False,
# Database selection (0-15 for Redis/Valkey)
database_id=0
)
client = GlideClient(config)
try:
# Test connection with custom message
response = await client.ping("Hello GLIDE!")
print(f"Server responded: {response}")
finally:
await client.close()
if __name__ == "__main__":
asyncio.run(main())

Congratulations, you are now connected to Valkey using GLIDE! To see how to make basic operations take a look at the our guide.