Connecting to the cluster

Scylla is a distributed database, which means that it operates on multiple nodes running independently. When creating a Session you can specify a few known nodes to which the driver will try connecting:

use scylla::{Session, SessionBuilder};
use std::error::Error;
use std::time::Duration;
use std::net::{IpAddr, Ipv4Addr, SocketAddr};

async fn main() -> Result<(), Box<dyn Error>> {
    let uri = std::env::var("SCYLLA_URI")
        .unwrap_or_else(|_| "".to_string());

    let session: Session = SessionBuilder::new()
            IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)),


After succesfully connecting to some specified node the driver will fetch topology information about other nodes in this cluster and connect to them as well.