Skip to content

Running Pravega in Local Machine

As an alternative to running Pravega on a cluster of machines, you may run Pravega on a local/single machine. Running Pravega locally on a single host allows you to get started with Pravega quickly. Running Pravega locally is especially suitable for development and testing purposes.

You may run Pravega on local machine using either of these two options:

  1. Standalone mode deployment: In this option, Pravega server runs on a single process.
  2. Distributed mode Docker Compose deployment: In this option, Pravega components run on separate processes within the same host.

These options are explained in below subsections.

Standalone Mode

In standalone mode, the Pravega server is accessible from clients through the localhost interface only. Controller REST APIs, however, are accessible from remote hosts/machines.

Security is off by default in Pravega. Please see this document to find how to enable security in standalone mode.

You can launch a standalone mode server using the following options:

  1. From source code
  2. From installation package
  3. From Docker image

From Source Code

Checkout the source code:

$ git clone https://github.com/pravega/pravega.git
$ cd pravega

Build the Pravega standalone mode distribution:

./gradlew startStandalone

From Installation Package

Download the Pravega release from the GitHub Releases.

$ tar xfvz pravega-<version>.tgz
Download and extract either tarball or zip files. Follow the instructions provided for the tar files (same can be applied for zip file) to launch all the components of Pravega on your local machine.

Run Pravega Standalone:

$ pravega-<version>/bin/pravega-standalone

From Docker Image

The below command will download and run Pravega from the container image on docker hub.

Note: We must replace the <ip> with the IP of our machine to connect to Pravega from our local machine. Optionally we can replace latest with the version of Pravega as per the requirement.

docker run -it -e HOST_IP=<ip> -p 9090:9090 -p 12345:12345 pravega/pravega:latest standalone

Docker Compose (Distributed Mode)

Unlike other options for running locally, the Docker Compose option runs a full deployment of Pravega in distributed mode. It contains containers for running Zookeeper, Bookkeeper and HDFS. Hence Pravega operates as if it would in production. This is the easiest way to get started with the standalone option but requires additional resources.

  1. Ensure that your host machine meets the following prerequisites:

  2. It has Docker 1.12 or later installed.

  3. It has Docker Compose installed.

  4. Download the docker-compose.yml file from Pravega GitHub repository.

$ wget https://raw.githubusercontent.com/pravega/pravega/master/docker/compose/docker-compose.yml

Alternatively, clone the Pravega repository to fetch the code.

$ git clone https://github.com/pravega/pravega.git
  1. Navigate to the directory containing Docker Compose configuration .yml files.
$ cd /path/to/pravega/docker/compose
  1. Add HOST_IP as an environment variable with the value as the IP address of the host.
$ export HOST_IP=<HOST_IP>
  1. Run the following command to start a deployment comprising of multiple Docker containers, as specified in the docker-compose.yml file.
$ docker-compose up -d

To use one of the other files in the directory, use the -f option to specify the file.

$ docker-compose up -d -f docker-compose-nfs.yml
  1. Verify that the deployment is up and running.
$ docker-compose ps

Clients can then connect to the Controller at <HOST_IP>:9090.

To access the Pravega Controller REST API, invoke it using a URL of the form http://<HOST_IP>:10080/v1/scopes (where /scopes is one of the many endpoints that the API supports).