Merge lp:~arosales/juju-core/docs-update-scaling into lp:juju-core/docs

Proposed by Antonio Rosales
Status: Merged
Approved by: Nick Veitch
Approved revision: no longer in the source branch.
Merged at revision: 86
Proposed branch: lp:~arosales/juju-core/docs-update-scaling
Merge into: lp:juju-core/docs
Diff against target: 85 lines (+61/-4)
1 file modified
htmldocs/charms-scaling.html (+61/-4)
To merge this branch: bzr merge lp:~arosales/juju-core/docs-update-scaling
Reviewer Review Type Date Requested Status
charmers Pending
Review via email: mp+183284@code.launchpad.net

Description of the change

Remove incorrect reference to --count and -c. I also expanded on how to
scale up a service with add-unit, and scale down a service with remove-unit.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'htmldocs/charms-scaling.html'
2--- htmldocs/charms-scaling.html 2013-08-22 13:55:23 +0000
3+++ htmldocs/charms-scaling.html 2013-08-30 21:41:21 +0000
4@@ -60,6 +60,21 @@
5 <h1>Scaling Charms</h1>
6 <p>One of the killer features of computing in the cloud is that it (should) seamlessly allow you to scale up or down your services to meet your needs and whims. Juju not only makes it simple to deploy services, but crucially makes it easy to manage them too. It won't anticipate you getting slashdotted or on the front page of hacker news (yet), but it does mean that when you do you can reliably scale your services to meet the demand.</p>
7 <h1> Adding Units </h1>
8+ <p> The general usage to scale a service up is via the <code>add-unit</code> command:</p>
9+ <pre class="runnable"><code>
10+ juju add-unit [options] &ltservice-name&gt
11+ </code></pre>
12+ <p>The command options are:</p>
13+ <pre class="runnable"><code>
14+ #juju environment to operate in
15+ -e, --environment &ltenvironment_name&gt
16+
17+ # number of service units to add
18+ -n, --num-units [integer]
19+
20+ #the machine or container to deploy the unit in, bypasses constraints
21+ --to &ltmachine&gt
22+ </code></pre>
23 <p>Scaling up services is really as simple as asking for more instances. Consider the following setup for a mediawiki:</p>
24 <pre class="runnable"><code>
25 juju bootstrap
26@@ -72,15 +87,57 @@
27 <pre class="runnable"><code>
28 juju add-unit mediawiki
29 </code></pre>
30- <p>This will cause a new instance to be run and configured to work alongside the currently running one.</p>
31- <p>If that isn't the sort of scale you had in mind, you can use a --count or -c switch to specify a number of instances to add:</p>
32-
33+ <p>This will cause a new instance to be run and configured to work alongside the currently running one. Behind the scenes Juju is adding an instance to the Juju environment called a machine and provisioning the specified service onto that instance/machine.</p>
34+ <p>Suppose your mysql service needs hyper-scale, you can use the <code>-n</code> or <code>--num-units</code> options to <code>add-unit</code> to specify the desired number of units you want to be added to the service. For example, to scale up your service by 100 units simply do:</p>
35+ <pre class="runnable"><code>
36+ juju add-unit -n 100 mysql
37+ </code></pre>
38+ <p>or you can use <code>--num-unit</code> which has the same result, but is more readable:</p>
39+ <pre class="runnable"><code>
40+ juju add-unit --num-unit 100 mysql
41+ </code></pre>
42+ <p>If you would like to add a unit to a specific machine just append the <code>--to</code> <machine> option.</p>
43+ <pre class="runnable"><code>
44+ #add unit to machine 23
45+ juju add-unit mysql --to 23
46+
47+ #add unit to lxc container 3 on host machine 24
48+ juju add-unit mysql --to 24/lxc/3
49+
50+ #add unit to a new lxc container on host machine 25
51+ juju add-unit mysql --to lxc:25
52+ </code></pre>
53+ <p>The <code>add-unit</code> command deploys a machine matching the constraints of the initially deployed service. For example, if mysql was deployed with the defaults (ie no <code>--constraints</code> option) you would have mysql on an instance that matches the closest to 1Gig of memory and 1CPU. If you would like to add a unit with more resources to the mysql service you will first need to issue a <code>add-machine</code> with the desired constraint followed by a <code>add-unit</code>. For example, the following command adds a 16Gig unit to the mysql service (note in this example <code>juju status</code> returns machine 3 for the <code>add-machine</code> command):</p>
54+ <pre class="runnable"><code>
55+ juju add-machine --constraints="mem=16G"
56+ juju add-unit mysql --to 3
57+ </code></pre>
58+
59+ <p class="note">Keep in mind you can always use the <code>-e</code> or <code>--environment</code> options to specify which environment/cloud you would like the command ran against. In the following example the <code>-e hpcloud</code> adds 100 units to the mysql service in HP's cloud:</p>
60+ <pre class="runnable"><code>
61+ juju add-unit -n 100 mysql -e hpcloud
62+ </code></pre>
63+ <p><a href="charms-deploying.html#deploying-to-machines">More on deploying to specific machines.</a></p>
64 <h1>Scaling Back</h1>
65 <p>Sometimes you also want to scale back some of your services, and this too is easy with Juju.</p>
66+ <p> The general usage to scale down a service is with the <code>remove-unit</code> command:</p>
67+ <pre class="runnable"><code>
68+ juju remove-unit [options] &ltunit&gt [...]
69+ </code></pre>
70+ <p> For example, the following scales down the mediawiki service by one unit:</p>
71 <pre class="runnable"><code>
72 juju remove-unit mediawiki/1
73 </code></pre>
74- <p>The <span class="pre">remove-unit</span> command can be run to remove running units safely. The running services should automatically adjust to the change. Should you wish to remove a service, please see the section on <a href="charms-destroy.html">destroying services</a>.
75+ <p> If you have scaled-up the mediawiki service by more than one unit you can remove multiple units in the same command as long as you know the unit name (ie &ltservice&gt/#).</p>
76+ <pre class="runnable"><code>
77+ juju remove-unit mediawiki/1 mediawiki/2 mediawiki/3 mediawiki/4 mediawiki/5
78+ </code></pre>
79+ <p>The <code>remove-unit</code> command can be run to remove running units safely. The running services should automatically adjust to the change.</p>
80+ <p class="note">Note: After removing a service the machine will still be running. In order to completely remove the machine that once housed the service you need to issue a <code>destroy-machine</code>. For example, to remove machine 1 that the unit mediawiki/1 was housed on issue:
81+ <pre class="runnable"><code>
82+ juju destroy-machine 1
83+ </code></pre>
84+ <p>For more information on removing services, please see the section on <a href="charms-destroy.html">destroying services</a>.</p>
85 </section>
86
87

Subscribers

People subscribed via source and target branches