influxdb/influxdb — pull request #1280 by benbjohnson (2014-12-31 20:00:23+00:00)
Title: [WIP] Create cluster on initial run

## Overview

This pull request merges `influxd create-cluster` into `influxd run`. It also removes local mode.

*Note: A commit from this PR slipped into `master`: 70d561aa6fbbf73b0a5403de344b19bf5b2c84d6*

## Workflow

Previously, an explicit `influxd create-cluster` command would be used to create a new cluster. Now, the `influxd run` will create a cluster the first time it is run. The basic flow for creating a broker+data cluster:

1. Check that neither a broker directory or data directory exist.
2. Initialize a new raft log with the broker.
3. Start the Broker's HTTP handler.
4. Open the Server.
5. Create a new replica on the broker.
6. Initialize the server to create a DataNode and set its `ID` to `1`.
7. Connect messaging client with `ReplicaID` of `1`.
8. Start the Server's HTTP handler.
9. ???
10. Profit

## Caveats

The `--role` flag works for `combined` and `broker` but not for `data` yet. This is because the `messaging.Client` currently requires a `ReplicaID` to be set to open it. I need to change the client to not require a replica id so that we can create a replica.