<commit_before>---
layout: default
title: Setup
group: "docs"
weight: 1
---

# Setup

Myria Source Code:
git clone https://github.com/uwescience/myria.git

#Preparing to use

#### 0. Build the Myria jar
In Myria source (`../`), run `./gradlew jar`.

#### 1. Myria needs Java 7
Make sure `java -version` shows 7 on any machines in the cluster. 

If not (e.g., support-managed machines have Java 6), you can put Java 7 in your directory, and let your `PATH` include it BEFORE the default `PATH`

    export PATH=(path to java7 bin folder):$PATH

#### 2. You need passwordless SSH to the cluster

Better make sure you can access any machine in the cluster from your client side, using `ssh` with no password. Otherwise, you will need to enter them a lot of times.

If you have not setup keys before, the easiest way to make it happen:

    ssh-keygen
    ssh-copy-id username@remote_machine_address

Use default settings all the way.

Then ssh to the remote machine and check

    ssh username@remote_machine_address

Install `ssh-copy-id` if you don't have it on your machine.

# Setting up a new cluster deployment

#### 0. Create an updated deployment configuration file

Edit the template in `deployment.cfg.sample`

    cp deployment.cfg.sample deployment.cfg
    
#### 1. Setup the cluster directories and catalogs and copy to nodes

Use this script if you want to initialize (or re-initialize) a new Myria cluster configuration.

    ./setup_cluster.py <deployment.cfg>

This will: Create a directory called `<description>` with all the catalog files, then dispatch them to corresponding machines in `<master + workers>` under `<path>`.

Notice this **overwrites** the cluster: no ingested relations in previous Myria instances will be inherited by this new one.

# Running the cluster<commit_msg>Add partial instructions on using postgres as backend<commit_after>---
layout: default
title: Setup
group: "docs"
weight: 1
---

# Setup

Myria Source Code:
git clone https://github.com/uwescience/myria.git

#Preparing to use

#### 0. Build the Myria jar
In Myria source (`../`), run `./gradlew jar`.

#### 1. Myria needs Java 7
Make sure `java -version` shows 7 on any machines in the cluster. 

If not (e.g., support-managed machines have Java 6), you can put Java 7 in your directory, and let your `PATH` include it BEFORE the default `PATH`

    export PATH=(path to java7 bin folder):$PATH

#### 2. You need passwordless SSH to the cluster

Better make sure you can access any machine in the cluster from your client side, using `ssh` with no password. Otherwise, you will need to enter them a lot of times.

If you have not setup keys before, the easiest way to make it happen:

    ssh-keygen
    ssh-copy-id username@remote_machine_address

Use default settings all the way.

Then ssh to the remote machine and check

    ssh username@remote_machine_address

Install `ssh-copy-id` if you don't have it on your machine.

# Setting up a new cluster deployment

#### 0. Create an updated deployment configuration file

Edit the template in `deployment.cfg.sample`.

    cp deployment.cfg.sample deployment.cfg
    
A. If using sqlite as the storage backend, 

B. If using [PostgreSQL](www.postgresql.org) as the storage backend, deployment.cfg.postgres shows an example config file. In addition, take these steps:

- Install postgres
- Myria connects to postgres through port 5401 rather than the default. Change the port on which postgres listens in the `postgresql.conf` file, and make sure postgres is restarted.
- Create a `uwdb` role which Myria will use to manage the tables stored in postgres.

    `create role uwdb with superuser;`
    
    `alter role uwdb with login;`
    
#### 1. Setup the cluster directories and catalogs and copy to nodes

Use this script if you want to initialize (or re-initialize) a new Myria cluster configuration.

    ./setup_cluster.py <deployment.cfg>

This will: Create a directory called `<description>` with all the catalog files, then dispatch them to corresponding machines in `<master + workers>` under `<path>`.

Notice this **overwrites** the cluster: no ingested relations in previous Myria instances will be inherited by this new one.

# Running the cluster
{'fraction_non_alphanumeric': 0.07690481841917873, 'fraction_numerical': 0.006171374317588417, 'mean_word_length': 3.8548387096774195, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '454169', 'n_tokens_mistral': 1206, 'n_tokens_neox': 1132, 'n_words': 598}