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

Cloud migration tutorial #1610

Merged
merged 3 commits into from Jun 27, 2017
Merged

Cloud migration tutorial #1610

merged 3 commits into from Jun 27, 2017

Conversation

jseldess
Copy link
Contributor

@jseldess jseldess commented Jun 21, 2017

A tutorial showing users how to use a local cluster to simulate cross-cloud deployment and then migration from one cloud to another.

I'm planning to add a simple screencast (with audio or text) demoing this across real cloud platforms, and offering that video as something to watch before you begin. But I'm opening this to get initial feedback on the flow and basic messaging.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

@spencerkimball spencerkimball left a comment

Choose a reason for hiding this comment

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

Awesome.

~~~ shell
# In a new terminal, start node 1 on cloud 1:
$ cockroach start --insecure \
--locality=cloud=platform1 \
Copy link
Member

Choose a reason for hiding this comment

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

Why "cloud=platform1" instead of just "cloud=1"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Done.


## Step 2. Set up HAProxy load balancing

Each CockroachDB node is an equally suitable SQL gateway to your cluster, but to ensure client performance and reliability, it's important to use TCP load balancing. [HAProxy](http://www.haproxy.org/) is one of the most popular open-source TCP load balancers, and CockroachDB includes a built-in command for generating a configuration file that is preset to work with your running cluster, so you'll use that tool here.
Copy link
Member

Choose a reason for hiding this comment

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

How about: "..., but to ensure an even balancing of client requests across available nodes, we can use a TCP load balancer."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.


## Step 7. Migrate all data to "cloud 2"

In a new terminal, edit the default replication zone, adding a [hard constraint](configure-replication-zones.html#replication-constraints) that all replicas must be on nodes with `--locality=cloud=platform2`:
Copy link
Member

Choose a reason for hiding this comment

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

Why don't you provide some colorful additional narration to these steps that are demonstrating the value proposition. For example: "OK, we're now running three nodes one cloud 1. But what if we'd like to start experimenting with resources provided by another cloud vendor? Let's try that by adding three more nodes to a new cloud platform."

"We now have the cluster replicating across our two simulated cloud vendors. But after experimentation, we're happy with cloud vendor 2, and we decide that we'd like to move everything there. Can we do that without interruption to our live client traffic? Yes, and it's as simple as adding a constraint to our replication configuration that all replicas must be chosen from cloud vendor 2."

You get the idea...we need to give people a scenario so it's not just an abstraction that only folks who've been struggling specifically with these problems will understand.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great feedback. I'll work on this.

@bdarnell
Copy link
Member

LGTM


Review status: 0 of 10 files reviewed at latest revision, 9 unresolved discussions, some commit checks failed.


demo-cloud-migration.md, line 7 at r4 (raw file):

---

CockroachDB's flexible [replication controls](configure-replication-zones.html) make it trivially easy to run a single CockroachDB cluster across cloud platforms or to migrate a cluster from one cloud to another without any service interruption. This page walks you through a local simulation of the process.

Cross-cloud migration is just a special case of cross-DC migration. Since this is just a simulation, it seems weird to say it's a simulation of the special case instead of the general case. But I guess that's what gets the clicks...


demo-cloud-migration.md, line 55 at r4 (raw file):

~~~ shell
$ brew install haproxy

This is mac-specific. I'm OK with not having instructions for other platforms at this point, but we should say something like "In a new terminal, install HAProxy. If you're on a Mac and using Homebrew, use brew install haproxy"


demo-cloud-migration.md, line 64 at r4 (raw file):

~~~

This command generates an `haproxy.cfg` file automatically configured to work with the 3 nodes of your running cluster. In the file, change `bind :26257` to `bind :26270`. This changes the port on which HAProxy accepts requests to a port that is not already in use by a node and that won't be used by the nodes you'll add later.

These port numbers all start to run together. How about a round number like 26000 instead of 26270?


demo-cloud-migration.md, line 66 at r4 (raw file):

This command generates an `haproxy.cfg` file automatically configured to work with the 3 nodes of your running cluster. In the file, change `bind :26257` to `bind :26270`. This changes the port on which HAProxy accepts requests to a port that is not already in use by a node and that won't be used by the nodes you'll add later.

~~~ shell

shell mode doesn't highlight this correctly (it colors bind but not any other keywords). Unless there's a more precise option, better to just remove the shell tag completely.


demo-cloud-migration.md, line 98 at r4 (raw file):

~~~ shell
$ go get github.com/cockroachdb/loadgen/ycsb

There should be an introductory section that tells people they'll need to install Go (and we could put the haproxy installation instructions there too)


demo-cloud-migration.md, line 183 at r4 (raw file):

## Step 9. Stop the cluster

Stop HAProxy and YCSB by switching into their terminals and pressing **CTRL + C**. Do the same for each CockroachDB node.

Stop YCSB first, or it will start spewing errors as soon as you stop haproxy.


Comments from Reviewable

@jseldess
Copy link
Contributor Author

Review status: 0 of 10 files reviewed at latest revision, 9 unresolved discussions, some commit checks failed.


demo-cloud-migration.md, line 64 at r4 (raw file):

Previously, bdarnell (Ben Darnell) wrote…

These port numbers all start to run together. How about a round number like 26000 instead of 26270?

Done.


demo-cloud-migration.md, line 66 at r4 (raw file):

Previously, bdarnell (Ben Darnell) wrote…

shell mode doesn't highlight this correctly (it colors bind but not any other keywords). Unless there's a more precise option, better to just remove the shell tag completely.

Done.


Comments from Reviewable

@nstewart
Copy link
Contributor

Minor feedback (we discussed in person too)

  1. it would be useful to have people start in some sort of ./cloud-migration-test directory so they don't get a bunch of data files in their home
  2. as written, the ycsb command doesn't work after the go-install. need to include the command to build
  3. We shouldn't pre-split the ycsb ranges. I think this breaks (or at least doesn't reinforce) a beginners mental model for how CRDB works. Taking off the split shows new ranges emerging as new load comes in, vs just having it be flat the whole time.
  4. In the final 'aha' graph where the load switches we ask users to hover over the graph to see the replica counts, but in my instance all but 1 were zero, which clearly wasn't correct. I think I would just say look at the graph, it's clear from the shape and color change that the load has moved to the other cloud. For the record, I just realized my crdb local install is beta, but according to Jesse this is still a bug.

@jseldess
Copy link
Contributor Author

Review status: 0 of 10 files reviewed at latest revision, 9 unresolved discussions.


demo-cloud-migration.md, line 55 at r4 (raw file):

Previously, bdarnell (Ben Darnell) wrote…

This is mac-specific. I'm OK with not having instructions for other platforms at this point, but we should say something like "In a new terminal, install HAProxy. If you're on a Mac and using Homebrew, use brew install haproxy"

Done.


demo-cloud-migration.md, line 98 at r4 (raw file):

Previously, bdarnell (Ben Darnell) wrote…

There should be an introductory section that tells people they'll need to install Go (and we could put the haproxy installation instructions there too)

Done.


demo-cloud-migration.md, line 183 at r4 (raw file):

Previously, bdarnell (Ben Darnell) wrote…

Stop YCSB first, or it will start spewing errors as soon as you stop haproxy.

Done.


Comments from Reviewable

@jseldess
Copy link
Contributor Author

@nstewart:

  • Added a "before you begin" suggestion to create a new directory for running nodes.
  • Moved all installations to "before you begin". And since go get does in fact build ycsb in $HOME/go/bin by default, I've added that path to the command to start ycsb.
  • No longer pre-splitting ranges with ycsb.
  • Called out that the replica count on hover will be off for a few minutes but that the graph lines are accurate. Also pointed to the node list view for another accurate view of per-node replica counts.

1 similar comment
@jseldess jseldess changed the title [WIP] Cloud migration tutorial Cloud migration tutorial Jun 27, 2017
@jseldess
Copy link
Contributor Author

Merging. Will open a follow-up PR for the screencast part.

@jseldess jseldess merged commit 0520d55 into master Jun 27, 2017
@jseldess jseldess deleted the cloud-migration branch June 27, 2017 17:22
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.

None yet

5 participants