---
title: "Install and connect"
description: "Start Aerospike in Docker, install adk-aerospike, and verify connectivity."
---

# Install and connect

> For the complete documentation index see: [llms.txt](https://aerospike.com/docs/llms.txt)
> 
> All documentation pages available in markdown.

Start Aerospike, install Python packages, and confirm `AerospikeSessionService` connects.

## Start Aerospike Database

1.  Start Aerospike in Docker:
    
    Terminal window
    
    ```shell
    docker run -d --name aerospike -p 3000-3002:3000-3002 aerospike/aerospike-server
    ```
    
2.  Verify the database is listening on port 3000:
    
    Terminal window
    
    ```shell
    nc -z localhost 3000 && echo 'Aerospike database is running.'
    ```
    
    Expected result
    
    ```plaintext
    Connection to localhost port 3000 [tcp/hbci] succeeded!
    
    Aerospike database is running.
    ```
    

::: tip
If a container named `aerospike` already exists from a previous run, remove it with `docker rm -f aerospike` before starting another container.
:::

## Install Python packages

1.  Create and activate a virtual environment:
    
    Terminal window
    
    ```shell
    python3.11 -m venv .venv
    
    source .venv/bin/activate
    ```
    
    On Windows, use `.venv\Scripts\activate`.
    
2.  Upgrade pip and install packages:
    
    Terminal window
    
    ```shell
    python -m pip install --upgrade pip
    
    python -m pip install "adk-aerospike>=0.1.0" "aerospike>=19"
    ```
    
    `adk-aerospike` pulls in `google-adk`. Pin the Aerospike Python client at 19 or newer. Client 18.x lacks `index_single_value_create`, which `AerospikeSessionService` uses when it creates secondary indexes on first connect.
    
3.  Verify imports:
    
    Terminal window
    
    ```shell
    python -c "from adk_aerospike import AerospikeSessionService; print('ok')"
    ```
    
    Expected result
    
    ```plaintext
    ok
    ```
    

## Connect to Aerospike

1.  Run a connectivity check:
    
    Terminal window
    
    ```shell
    python -c "
    
    from adk_aerospike import AerospikeSessionService
    
    s = AerospikeSessionService.from_uri('aerospike://localhost:3000/test')
    
    s.close()
    
    print('Connected to Aerospike.')
    
    "
    ```
    
    Expected result
    
    ```plaintext
    Connected to Aerospike.
    ```
    
    Compare your terminal output to the expected result.
    

The service is ready. On the next pages you learn how sessions map to Aerospike records, then run the demo script.

::: undefined
-   I’ve started Aerospike Database in Docker.
-   I’ve installed adk-aerospike and aerospike client 19+.
-   I’ve verified AerospikeSessionService connects.
:::

[Previous  
Prerequisites](https://aerospike.com/docs/develop/adk-atomic-session-append/step/1/part/0/prerequisites) [Next  
Session and segment layout](https://aerospike.com/docs/develop/adk-atomic-session-append/step/2/part/0/session-and-segments)