~evilnick/clouddocs/logging

« back to all changes in this revision

Viewing changes to Admin/Scaling-OpenStack.md

  • Committer: Nick Veitch
  • Date: 2014-04-30 23:18:08 UTC
  • mfrom: (23.2.1 trunk)
  • Revision ID: nick.veitch@canonical.com-20140430231808-6ih01vf3cjyek6lr
scaling additions

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
But to scale the services running on OpenStack, sometimes even OpenStack itself has to
19
19
be scaled. This means nodes for computing or storage have to be added.
20
20
 
21
 
## Scope
22
 
 
23
 
**TODO**
24
 
 
25
21
## Nova
26
22
 
27
 
### Analyzis
 
23
### Usage Statistics
28
24
 
29
25
To list the hosts and the nova-related services that run on them call:
30
26
 
31
27
```
32
 
$ nova host-list
33
 
+------------------+-------------+----------+
34
 
| host_name        | service     | zone     |
35
 
+------------------+-------------+----------+
36
 
| devstack-grizzly | conductor   | internal |
37
 
| devstack-grizzly | compute     | nova     |
38
 
| devstack-grizzly | cert        | internal |
39
 
| devstack-grizzly | network     | internal |
40
 
| devstack-grizzly | scheduler   | internal |
41
 
| devstack-grizzly | consoleauth | internal |
42
 
+------------------+-------------+----------+
 
28
nova host-list
 
29
 
 
30
+---------------+-------------+----------+
 
31
| host_name     | service     | zone     |
 
32
+---------------+-------------+----------+
 
33
| mystack-alpha | conductor   | internal |
 
34
| mystack-alpha | compute     | nova     |
 
35
| mystack-alpha | cert        | internal |
 
36
| mystack-alpha | network     | internal |
 
37
| mystack-alpha | scheduler   | internal |
 
38
| mystack-alpha | consoleauth | internal |
 
39
+---------------+-------------+----------+
 
40
 
43
41
```
44
42
 
45
43
To get a summary of resource usage of all of the instances running on the host call:
46
44
 
47
45
```
48
 
$ nova host-describe devstack-grizzly
49
 
+------------------+----------------------------------+-----+-----------+---------+
50
 
| HOST             | PROJECT                          | cpu | memory_mb | disk_gb |
51
 
+------------------+----------------------------------+-----+-----------+---------+
52
 
| devstack-grizzly | (total)                          | 2   | 4003      | 157     |
53
 
| devstack-grizzly | (used_now)                       | 3   | 5120      | 40      |
54
 
| devstack-grizzly | (used_max)                       | 3   | 4608      | 40      |
55
 
| devstack-grizzly | b70d90d65e464582b6b2161cf3603ced | 1   | 512       | 0       |
56
 
| devstack-grizzly | 66265572db174a7aa66eba661f58eb9e | 2   | 4096      | 40      |
57
 
+------------------+----------------------------------+-----+-----------+---------+
 
46
nova host-describe mystack-alpha
 
47
 
 
48
+---------------+----------------------------------+-----+-----------+---------+
 
49
| HOST          | PROJECT                          | cpu | memory_mb | disk_gb |
 
50
+---------------+----------------------------------+-----+-----------+---------+
 
51
| mystack-alpha | (total)                          | 2   | 4003      | 157     |
 
52
| mystack-alpha | (used_now)                       | 3   | 5120      | 40      |
 
53
| mystack-alpha | (used_max)                       | 3   | 4608      | 40      |
 
54
| mystack-alpha | b70d90d65e464582b6b2161cf3603ced | 1   | 512       | 0       |
 
55
| mystack-alpha | 66265572db174a7aa66eba661f58eb9e | 2   | 4096      | 40      |
 
56
+---------------+----------------------------------+-----+-----------+---------+
 
57
 
58
58
```
59
59
 
60
60
This information will help explain how this host is used.
73
73
instances that run on the hosts. This command does not query the CPU usage, memory usage, 
74
74
or hard disk usage of the physical host.
75
75
 
 
76
 
76
77
Now you can retrieve the CPU, memory, I/O, and network statistics for an instance. First
77
78
list all instances.
78
79
 
 
80
 
79
81
```
80
 
$ nova list
 
82
nova list
 
83
 
81
84
+--------------------------------------+----------------------+--------+------------+-------------+------------------+
82
85
| ID                                   | Name                 | Status | Task State | Power State | Networks         |
83
86
+--------------------------------------+----------------------+--------+------------+-------------+------------------+
86
89
+--------------------------------------+----------------------+--------+------------+-------------+------------------+
87
90
```
88
91
 
89
 
Then, get diagnostic statistics:
 
92
Then, get some diagnostic statistics:
90
93
 
91
94
```
92
 
$ nova diagnostics myCirrosServer
 
95
nova diagnostics myCirrosServer
 
96
 
93
97
+------------------+----------------+
94
98
| Property         | Value          |
95
99
+------------------+----------------+
111
115
+------------------+----------------+
112
116
```
113
117
 
114
 
Finally you can get summary statistics for each tenant.
 
118
Finally you can get summary statistics for each tenant:
115
119
 
116
120
```
117
 
$ nova usage-list
 
121
nova usage-list
 
122
 
118
123
Usage from 2013-06-25 to 2013-07-24:
119
124
+----------------------------------+-----------+--------------+-----------+---------------+
120
125
| Tenant ID                        | Instances | RAM MB-Hours | CPU Hours | Disk GB-Hours |
124
129
+----------------------------------+-----------+--------------+-----------+---------------+
125
130
```
126
131
 
127
 
**TODO** How to interpret this information to know when to scale?
128
 
 
129
 
### Scaling
 
132
### Change server size
 
133
 
 
134
In case an image size doesn't match your needs anymore you're able to resize it. First
 
135
list your available flavors.
 
136
 
 
137
```
 
138
$ nova flavor-list
 
139
+----+-----------+-----------+------+-----------+------+-------+-------------+
 
140
| ID |    Name   | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor |
 
141
+----+-----------+-----------+------+-----------+------+-------+-------------+
 
142
| 1  |  m1.tiny  |    512    |  0   |     0     |      |   1   |     1.0     |
 
143
| 2  |  m1.small |    2048   |  10  |     20    |      |   1   |     1.0     |
 
144
| 3  | m1.medium |    4096   |  10  |     40    |      |   2   |     1.0     |
 
145
| 4  |  m1.large |    8192   |  10  |     80    |      |   4   |     1.0     |
 
146
| 5  | m1.xlarge |   16384   |  10  |    160    |      |   8   |     1.0     |
 
147
+----+-----------+-----------+------+-----------+------+-------+-------------+
 
148
```
 
149
 
 
150
Now you can show the information for the server you want to resize with:
 
151
 
 
152
```
 
153
$ nova show 84c6e57d-a6b1-44b6-81eb-fcb36afd31b5
 
154
+------------------------+----------------------------------------------------------+
 
155
| Property               | Value                                                    |
 
156
+------------------------+----------------------------------------------------------+
 
157
| OS-DCF:diskConfig      | MANUAL                                                   |
 
158
| OS-EXT-STS:power_state | 1                                                        |
 
159
| OS-EXT-STS:task_state  | None                                                     |
 
160
| OS-EXT-STS:vm_state    | active                                                   |
 
161
| OS-EXT-SRV-ATTR:host   | mystack-alpha                                            |
 
162
| accessIPv4             |                                                          |
 
163
| accessIPv6             |                                                          |
 
164
| config_drive           |                                                          |
 
165
| created                | 2012-05-09T15:47:48Z                                     |
 
166
| flavor                 | m1.small                                                 |
 
167
| hostId                 | de0c201e62be88c61aeb52f51d91e147acf6cf2012bb57892e528487 |
 
168
| id                     | 84c6e57d-a6b1-44b6-81eb-fcb36afd31b5                     |
 
169
| image                  | maverick-image                                           |
 
170
| key_name               |                                                          |
 
171
| metadata               | {}                                                       |
 
172
| name                   | myCirrosServer                                           |
 
173
| private network        | 172.16.101.6                                             |
 
174
| progress               | 0                                                        |
 
175
| public network         | 10.4.113.6                                               |
 
176
| status                 | ACTIVE                                                   |
 
177
| tenant_id              | e830c2fbb7aa4586adf16d61c9b7e482                         |
 
178
| updated                | 2012-05-09T15:47:59Z                                     |
 
179
| user_id                | de3f4e99637743c7b6d27faca4b800a9                         |
 
180
+------------------------+----------------------------------------------------------+
 
181
```
 
182
 
 
183
Here in the example the flavor is `m1.small`. To resize it to `m1.medium` you need
 
184
the server's ID and the ID of the flavor:
 
185
 
 
186
```
 
187
$ nova resize 84c6e57d-a6b1-44b6-81eb-fcb36afd31b5 3
 
188
```
 
189
 
 
190
Now the `list` command shows the changed status:
 
191
 
 
192
```
 
193
$ nova list
 
194
+--------------------------------------+----------------------+--------+------------+-------------+------------------+
 
195
| ID                                   | Name                 | Status | Task State | Power State | Networks         |
 
196
+--------------------------------------+----------------------+--------+------------+-------------+------------------+
 
197
| 84c6e57d-a6b1-44b6-81eb-fcb36afd31b5 | myCirrosServer       | RESIZE | None       | Running     | private=10.0.0.3 |
 
198
| 8a99547e-7385-4ad1-ae50-4ecfaaad5f42 | myInstanceFromVolume | ACTIVE | None       | Running     | private=10.0.0.4 |
 
199
+--------------------------------------+----------------------+--------+------------+-------------+------------------+
 
200
```
 
201
 
 
202
Once this operation finished the status changes to `VERIFY_RESIZE`. You have to confirm
 
203
that this operation has been successful:
 
204
 
 
205
```
 
206
$ nova resize-confirm 84c6e57d-a6b1-44b6-81eb-fcb36afd31b5
 
207
```
 
208
 
 
209
In case the resizing hasn't been successful you can revert it by executing:
 
210
 
 
211
```
 
212
$ nova resize-revert 84c6e57d-a6b1-44b6-81eb-fcb36afd31b5
 
213
```
 
214
 
 
215
In both cases, the server status should go back to `ACTIVE`.
 
216
 
 
217
### Adding compute nodes
130
218
 
131
219
Adding compute nodes is straightforward. They are easily picked up by the existing 
132
220
installation. Simply call:
133
221
 
134
222
```
135
 
juju add-unit nova-compute:
 
223
juju add-unit nova-compute
 
224
```
 
225
 
 
226
### Migrate instances to other nodes
 
227
 
 
228
OpenStack allows to migrate instances between nodes, e.g. in case of an overall 
 
229
too high load on the current node. You alreade know the commands `list` and `show`
 
230
to retrieve information about your instance. To list the possible nodes 
 
231
execute:
 
232
 
 
233
```
 
234
nova-manager service list
 
235
mystack-alpha nova-scheduler enabled  :-) None
 
236
mystack-alpha nova-network enabled  :-) None
 
237
mystack-alpha nova-compute enabled  :-) None
 
238
mystack-bravo nova-compute enabled  :-) None
 
239
mystack-charlie nova-compute enabled  :-) None
 
240
```
 
241
 
 
242
Here we will choose `mystack-charlie` as migration target, `nova-compute`
 
243
is running on this system. First let's have a look if the node has
 
244
enough resources:
 
245
 
 
246
```
 
247
nova-manage service describe_resource mystack-charlie
 
248
 
 
249
HOST                       PROJECT     cpu   mem(mb)     hdd
 
250
mystack-charlie(total)                  16     32232     878
 
251
mystack-charlie(used_now)               13     21284     442
 
252
mystack-charlie(used_max)               13     21284     442
 
253
mystack-charlie            p1            5     10240     150
 
254
mystack-charlie            p2            5     10240     150
 
255
.....
 
256
```
 
257
 
 
258
These values show the physical resources and their usage.
 
259
 
 
260
- The `cpu` column shows the number of cpu.
 
261
- The `mem(mb)` column is the total amount of memory (MB).
 
262
- The `hdd' column shows the total amount of space for NOVA-INST-DIR/instances (GB).
 
263
- 1st line shows total amount of resource physical server has.
 
264
- 2nd line shows current used resource.
 
265
- 3rd line shows maximum used resource.
 
266
- 4th line and under is used resource per project.
 
267
 
 
268
If those values show that our instance fits on that system we can
 
269
migrate it with:
 
270
 
 
271
```
 
272
nova live-migration 84c6e57d-a6b1-44b6-81eb-fcb36afd31b5 mystack-charlie
 
273
 
 
274
Migration of 84c6e57d-a6b1-44b6-81eb-fcb36afd31b5 initiated.
136
275
```
137
276
 
138
277
## Cinder