-
Notifications
You must be signed in to change notification settings - Fork 109
/
start-stop-vms.html.md.erb
178 lines (115 loc) · 6.55 KB
/
start-stop-vms.html.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
---
title: Stopping and starting virtual machines in Cloud Foundry
owner: BOSH
---
<%# Reset page title based on platform type %>
<% if vars.platform_code != 'CF' %>
<% set_title("Stopping and starting virtual machines in", vars.app_runtime_abbr) %>
<% end %>
You can stop and start the component <%= vars.app_runtime_abbr %> virtual machines that make up your deployment.
This article assumes you are using [BOSH CLI version 2](https://bosh.io/docs/cli-v2.html).
In some cases, you might want to stop all your VMs (for example, power down your deployment) or start all of your <%= vars.app_runtime_first %> VMs (for example, recover from a power outage). You can stop or start all <%= vars.app_runtime_abbr %> VMs with a single `bosh` command.
If you want to shut down or start up a single VM in your deployment, you can use the manual process described in [Stopping and Starting Individual <%= vars.app_runtime_abbr %> VMs](#manual).
This procedure uses the BOSH Command Line Interface (BOSH CLI). <%= vars.bosh_cli_link %>
## <a id='startstop'></a> Stopping and starting all <%= vars.app_runtime_abbr %> VMs
This section describes how to stop and start all the VMs in your deployment.
### <a id='stop_all'></a> Stopping all <%= vars.app_runtime_abbr %> VMs
To shut down all the VMs in your deployment:
1. Scale down the following jobs to one instance:
* `consul_server`
* `mysql`
<% if vars.platform_code == 'CF' %>
* `etcd_tls_server`
<% end %>
1. Run the following command for each of the deployments listed in the previous step:
```console
bosh -e MY-ENV -d MY-DEPLOYMENT stop --hard
```
Where:
<ul>
<li><code>MY-ENV</code> is the alias you set for the BOSH Director.</li>
<li><code>MY-DEPLOYMENT</code> is the name of your deployment.</li>
</ul>
For example:
<pre class="terminal">
$ bosh -e prod -d mysql stop --hard
</pre>
This command stops all VMs in the specified deployment. The `--hard` flag instructs BOSH to delete the VMs but retain any persistent disks.
### <a id='start_all'></a> Starting all <%= vars.app_runtime_abbr %> VMs
To start all the VMs in your deployment:
1. Select the product deployment for the VMs you want to shut down. You can run the following command to locate CF deployment manifests:
<pre class="terminal">
$ find /var/tempest/workspaces/default/deployments -name cf-*.yml
</pre>
1. Run the following command:
```console
bosh -e MY-ENV -d MY-DEPLOYMENT start
```
Where:
<ul>
<li><code>MY-ENV</code> is the alias you set for the BOSH Director.</li>
<li><code>MY-DEPLOYMENT</code> is the name of your deployment.</li>
</ul>
For example:
<pre class="terminal">
$ bosh -e prod -d mysql start
</pre>
This command starts all VMs in the specified deployment.
1. If you require high availability in your deployment, scale up all instance groups to the original or desired counts.
## <a id='manual'></a> Stopping and starting individual <%= vars.app_runtime_abbr %> VMs
This section describes how to stop and start individual VMs in your deployment.
### <a id='get-names'></a> Find the names of your <%= vars.app_runtime_abbr %> VMs
You need the full names of the VMs to stop and start them using the BOSH CLI. To find full names for the VMs running each component, run `bosh -e MY-ENV instances`, replacing `MY-ENV` with the alias you set for your BOSH Director. To filter the list of instances by deployment, run `bosh -e MY-ENV -d MY-DEPLOYMENT instances`.
For example:
<pre class="terminal">
$ bosh -e prod -d mysql instances
...
Deployment 'mysql'
Instance Process State AZ IPs
mysql/0123-abcd-4567ef89 running - 10.244.0.6
mysql/abcd-0123-ef4567ab running - 10.244.0.2
2 instances
...
</pre>
You can see the full name of each VM in the `Instance` column of the terminal output. Each full name has:
* A prefix indicating the component function of the VM.
* An identifier string specific to the VM.
For any component, you can look for its prefix in the `bosh instances` output to find the full name of the VM or VMs that run it.
### <a id='stop'></a> Stopping an individual <%= vars.app_runtime_abbr %> VM
To stop a job, run the following command for the component in your <%= vars.app_runtime_abbr %> deployment, replacing `MY-ENV` with the alias you set for your BOSH Director and `MY-DEPLOYMENT` with the name of the deployment:
```console
bosh -e MY-ENV -d MY-DEPLOYMENT stop VM-NAME
```
To delete the instance that contains the job, run the following command for the component in your <%= vars.app_runtime_abbr %> deployment:
```console
bosh -e MY-ENV -d MY-DEPLOYMENT stop VM-NAME --hard
```
Use the full name of the component VM as listed in your `bosh instances` terminal output without the unique identifier string.
For example, the following command stops the Loggregator Traffic Controller job:
<pre class="terminal">
$ bosh -e prod -d loggregator stop loggregator_trafficcontroller
</pre>
To stop a specific instance of a job, include the identifier string at the end of its full name.
For example, the following command stops the Loggregator Traffic Controller job on only one Diego Cell instance:
<pre class="terminal">
$ bosh -e prod -d loggregator stop loggregator_trafficcontroller/0123-abcd-4567ef89
</pre>
To delete the VM, include `--hard` at the end of the command. This command does not delete persistent disks.
For example, the following command deletes a specific Loggregator Traffic Controller instance:
<pre class="terminal">
$ bosh -e prod -d loggregator stop loggregator_trafficcontroller/0123-abcd-4567ef89 --hard
</pre>
### <a id='start'></a> Starting an individual <%= vars.app_runtime_abbr %> VM
Run the following command for the component in your <%= vars.app_runtime_abbr %> deployment you wish to start, replacing `MY-ENV` with the alias you set for your BOSH Director and `MY-DEPLOYMENT` with the name of the deployment. Use the full name of the component VM as listed in your `bosh vms` terminal output without the unique identifier string.
```console
bosh -e MY-ENV -d MY-DEPLOYMENT start VM-NAME
```
The following example command starts the Loggregator Traffic Controller VM:
<pre class="terminal">
$ bosh -e prod -d loggregator start loggregator_trafficcontroller
</pre>
To start a specific instance of a VM, include the identifier string at the end of its full name.
For example, the following command starts the Loggregator Traffic Controller job on one Diego Cell instance:
<pre class="terminal">
$ bosh -e prod -d loggregator start loggregator_trafficcontroller/0123-abcd-4567ef89
</pre>