forked from cloudfoundry/docs-bosh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sysadmin-commands.html.md.erb
193 lines (131 loc) · 8.69 KB
/
sysadmin-commands.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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
---
title: CLI Commands
---
This document lists the all CLI commands you use to perform system administration tasks.
---
## <a id="cluster-operators"></a> For Cluster Operators
Use these commands against the Director to manage deployments and associated assets.
### <a id="director"></a> Director Location
<pre class="terminal">$ bosh target [DIRECTOR_URL] [ALIAS]</pre>
Connects to the Director URL/IP that you specify for ongoing communication. You can provide `ALIAS` to set an alias for the Director. Displays the currently targeted Director if you do not provide a URL.
<pre class="terminal">$ bosh login [USERNAME] [PASSWORD]</pre>
Authenticates a user with the Director when you provide a username and password. Prompts for this information if you omit it.
<pre class="terminal">$ bosh status [--uuid]</pre>
Displays the configuration file and deployment manifest in use, and information about the BOSH Director such as name, URL, version, current username, UUID, and CPI.
---
### <a id="user"></a> Users
Use these commands to create and delete users on the Director.
<pre class="terminal">$ bosh create user [USERNAME] [PASSWORD]</pre>
Creates a user with the Director. Prompts you for a `USERNAME` and `PASSWORD` if you omit this information.
<pre class="terminal">$ bosh delete user [USERNAME]</pre>
Deletes a specific user from the BOSH Director. Prompts you for a `USERNAME` if you omit this information.
---
### <a id="dir-release"></a> Releases
<pre class="terminal">$ bosh releases [--jobs]</pre>
Displays the list of available releases.
<pre class="terminal">
$ bosh upload release [RELEASE_FILE] [--rebase] [--skip-if-exists]
$ bosh upload release RELEASE_URL
</pre>
Uploads the file that you specify as a release. If you do not provide a `RELEASE_FILE`, you must run this command from a valid release directory.
<pre class="terminal">$ bosh delete release NAME [VERSION] [--force]</pre>
Deletes a release and associated jobs, packages, compiled packages, and all package metadata. Fails if a deployment references this release.
---
### <a id="dir-stemcells"></a> Stemcells
<pre class="terminal">$ bosh stemcells</pre>
Displays the name, version, and CID of available stemcells.
<pre class="terminal">
$ bosh upload stemcell STEMCELL_PATH [--skip-if-exists]
$ bosh upload stemcell STEMCELL_URL
</pre>
Uploads specified stemcell. See [stemcells section of bosh.io](//bosh.io/stemcells) for all available stemcells.
<pre class="terminal">$ bosh delete stemcell NAME VERSION [--force]</pre>
Deletes a stemcell and all associated compiled packages. Fails if any deployment references this stemcell.
---
### <a id="deployment"></a> Deployment
<pre class="terminal">$ bosh deployments</pre>
Displays the list of created deployments on the Director. Shows stemcells and releases used by each deployment.
<pre class="terminal">$ bosh deployment [FILE_PATH]</pre>
Switches the CLI to operate on the deployment specified by the deployment manifest `FILE_PATH`. Displays the current deployment if you omit `FILENAME`.
<pre class="terminal">$ bosh deploy [--recreate]</pre>
Creates/updates or recreates a deployment.
<pre class="terminal">$ bosh download manifest DEPLOYMENT_NAME [FILE_PATH]</pre>
Downloads and saves the deployment manifest of the deployment `DEPLOYMENT_NAME` to `FILE_PATH`.
<pre class="terminal">$ bosh delete deployment DEPLOYMENT_NAME [--force]</pre>
Deletes job instances, VMs, disks, snapshots, templates associated with the deployment `DEPLOYMENT_NAME`.
---
### <a id="health"></a> Job/VM Health
<pre class="terminal">$ bosh instances [--ps] [--details] [--dns] [--vitals]</pre>
Displays a table that provides an overview of the instances in a current deployment. You can specify the following options:
- **ps**: includes process information
- **details**: includes VM cloud ID, agent ID
- **dns**: includes the DNS A record
- **vitals**: includes load, CPU, memory, swap, system disk, ephemeral disk, and persistent disk usage
<pre class="terminal">$ bosh vms [DEPLOYMENT_NAME] [--details] [--dns] [--vitals]</pre>
Displays a table that provides an overview of the VMs in `DEPLOYMENT_NAME`. You can specify the following options:
- **details**: includes VM cloud ID, agent ID
- **dns**: includes the DNS A record
- **vitals**: includes load, CPU, memory, swap, system disk, ephemeral disk, and persistent disk usage
<pre class="terminal">$ bosh recreate JOB [INDEX] [--force]</pre>
Stops the job process, power cycles the VM, recreates the job instance, then restarts the job process.
<pre class="terminal">$ bosh stop JOB [INDEX] [--hard] [--force]</pre>
Stops the job processes, and if `--hard` is specified deletes a VM keeping persistent disks.
<pre class="terminal">$ bosh start JOB [INDEX] [--force]</pre>
Creates a VM and reattaches persistent disks if VM does not exist, then starts the job processes.
<a id="vm-resurrection"></a>
<pre class="terminal">
$ bosh vm resurrection [STATE]
$ bosh vm resurrection JOB INDEX [STATE]
</pre>
Sets resurrection state (`on` or `off`) for all VMs managed by the Director or for a single deployment job instance.
<pre class="terminal">$ bosh cck [DEPLOYMENT_NAME] [--auto] [--report]</pre>
Scans for differences between the VM state database that the Director maintains and the actual state of the VMs. For each difference the scan detects, `bosh cck` offers possible repair options.
---
### <a id="tasks"></a> Director Tasks
<pre class="terminal">$ bosh tasks [--no-filter] </pre>
Displays a table that lists the following for all _currently running_ tasks: ID number, state, timestamp, user, description, and result.
<pre class="terminal">$ bosh tasks recent [COUNT] [--no-filter]</pre>
Displays a table that lists the following for the last `COUNT` tasks: ID number, state, timestamp, user, description, and result. `COUNT` defaults to 30.
<pre class="terminal">$ bosh task [TASK_ID] [--event] [--cpi] [--debug] [--result] [--raw]</pre>
Displays the status of a task that you specify and tracks its output. You can track only one of the following log types at a time: event, CPI, debug, or result. Defaults to event.
---
### <a id="ssh"></a> SSH
<pre class="terminal">$ bosh ssh [--public_key FILE] [--gateway_host HOST] [--gateway_user USER] [--gateway_identity_file FILE] [--default_password PASSWORD]</pre>
When you provide arguments with an option flag, the BOSH Director starts an interactive session, passing the specified arguments to a job VM. For example, `bosh ssh --public_key mykey.pub` instructs the BOSH Director to launch an interactive session with a job VM and pass the specified key to the VM.
<pre class="terminal">$ bosh ssh JOB [INDEX] [COMMANDS]</pre>
When you provide arguments without an option flag, the Director executes the arguments as commands on the job VM. For example, `bosh redis ssh ls -R` runs the `ls -R` command on the redis job VM.
---
### <a id="logs"></a> Logs
<pre class="terminal">$ bosh logs JOB [INDEX] [--agent] [--job] [--only filter1,filter2,...] [--dir DESTINATION_DIRECTORY]</pre>
Fetches a job or agent log from a VM. Supports custom filtering only for job logs.
---
### <a id="errand"></a> Errands
<pre class="terminal">$ bosh errands</pre>
Displays a table that lists all available errands for the set deployment.
<pre class="terminal">$ bosh run errand ERRAND_NAME [--download-logs] [--logs-dir DESTINATION_DIRECTORY]</pre>
Instructs the BOSH Director to run the named errand on a job instance on a VM.
---
### <a id="snapshots"></a> Snapshots
<pre class="terminal">$ bosh snapshots</pre>
Displays the job, CID, and created date of all snapshots.
<pre class="terminal">$ bosh take snapshot [JOB] [INDEX]</pre>
Takes a snapshot of the job VM that you specify. If you do not specify a `JOB`, takes a snapshot of every VM in your deployment.
<pre class="terminal">$ bosh delete snapshots</pre>
Deletes all snapshots.
<pre class="terminal">$ bosh delete snapshot SNAPSHOT_CID</pre>
Deletes a snapshot.
---
## <a id="release-maintainers"></a> For Release Maintainers
Use these commands against the Director to create and update releases.
### <a id="main-release"></a> Release Creation
<pre class="terminal">$ bosh create release [MANIFEST_FILE] [--name NAME] [--version VERSION] [--with-tarball] [--force]</pre>
Creates a development release.
<pre class="terminal">$ bosh create release [MANIFEST_FILE] [--name NAME] [--version VERSION] [--with-tarball] [--force] --final</pre>
Creates a final release.
<pre class="terminal">$ bosh finalize release RELEASE_PATH [--name NAME] [--version VERSION]</pre>
Create a final release from a development release tarball (assumes current directory to be a release directory).
### <a id="blobs"></a> Blobs
<pre class="terminal">$ bosh blobs</pre>
Lists blobs pending an upload.
<pre class="terminal">$ bosh upload blobs</pre>
Uploads new and updated blobs to the blobstore.