Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify cluster startup for scripting and deployment #5602

Merged
merged 15 commits into from
Feb 12, 2016
Merged

Conversation

corylanou
Copy link
Contributor

This PR will allow the specifying of the meta nodes with the -join argument. It will require that you specify all current nodes for restart. These arguments no longer need to change between restarts.

Example of starting a 3 node meta/data cluster:

# node 1
influxd -config ~/influx1.toml -join localhost:8191,localhost:8291,localhost8391

# node 2
influxd -config ~/influx2.toml -join localhost:8191,localhost:8291,localhost8391

# node 3
influxd -config ~/influx3.toml -join localhost:8191,localhost:8291,localhost8391

Will result in this server configuration:

> show servers
name: data_nodes
----------------
id      http_addr       tcp_addr
3       localhost:8186  localhost:8188
4       localhost:8286  localhost:8288
6       localhost:8386  localhost:8388


name: meta_nodes
----------------
id      http_addr       tcp_addr
1       localhost:8291  localhost:8288
2       localhost:8191  localhost:8188
5       localhost:8391  localhost:8388

This has also been tested with bringing up a cluster, and then having a new node join.

# node 1
influxd -config ~/influx1.toml -join localhost:8191,localhost:8291

# node 2
influxd -config ~/influx2.toml -join localhost:8191,localhost:8291

Wait for the cluster to be healthy:

> show servers
name: data_nodes
----------------
id      http_addr       tcp_addr
3       localhost:8186  localhost:8188
4       localhost:8286  localhost:8288


name: meta_nodes
----------------
id      http_addr       tcp_addr
1       localhost:8291  localhost:8288
2       localhost:8191  localhost:8188

Join new node. Notice you need to specify all nodes in the -join argument

# node 3
influxd -config ~/influx3.toml -join localhost:8191,localhost:8291,localhost8391

Also, to restart nodes 1 and 2, you now need to pass all three nodes. This is typically done via scripted automation.

@corylanou corylanou force-pushed the cluster-startup branch 2 times, most recently from 1c31896 to bb7d548 Compare February 10, 2016 21:35
@corylanou corylanou changed the title WIP - Cluster startup Simplify cluster startup for scripting and deployment Feb 11, 2016
@jwilder jwilder added this to the 0.11.0 milestone Feb 11, 2016
@@ -645,13 +652,16 @@ func (s *Server) initializeMetaClient() error {
if err := s.MetaClient.Open(); err != nil {
return err
}

if s.TSDBStore != nil {
for {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is preferable or not, but an alternative to the break/continue stuff could be:

    n, err := s.MetaClient.CreateDataNode(s.httpAPIAddr, s.tcpAddr)
    for ; err != nil; n, err = s.MetaClient.CreateDataNode(s.httpAPIAddr, s.tcpAddr) {
        log.Printf("Unable to create data node. retry in 1s: %s", err.Error())
        time.Sleep(time.Second)
    }
    s.Node.ID = n.ID

or even:

    n, err := s.MetaClient.CreateDataNode(s.httpAPIAddr, s.tcpAddr)
    for err != nil {
        log.Printf("Unable to create data node. retry in 1s: %s", err.Error())
        time.Sleep(time.Second)
        n, err = s.MetaClient.CreateDataNode(s.httpAPIAddr, s.tcpAddr)
    }
    s.Node.ID = n.ID

@jwilder
Copy link
Contributor

jwilder commented Feb 12, 2016

👍 Maybe squash the WIP commit of mine though?

@corylanou corylanou force-pushed the cluster-startup branch 2 times, most recently from 6c1f87f to 7b357da Compare February 12, 2016 17:54
@e-dard
Copy link
Contributor

e-dard commented Feb 12, 2016

LGTM 👍

jwilder added a commit that referenced this pull request Feb 12, 2016
Simplify cluster startup for scripting and deployment
@jwilder jwilder merged commit ef571fc into master Feb 12, 2016
@jwilder jwilder deleted the cluster-startup branch February 12, 2016 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants