blob: c7901a21fb9520b4ab89ae1cc16b542dff107b9e [file] [log] [blame]
Sean M. Collins09e550c2014-10-21 11:40:08 -04001`DevStack </>`__
2
3- `Overview <../overview.html>`__
4- `Changes <../changes.html>`__
5- `FAQ <../faq.html>`__
6- `git.openstack.org <https://git.openstack.org/cgit/openstack-dev/devstack>`__
7- `Gerrit <https://review.openstack.org/#/q/status:open+project:openstack-dev/devstack,n,z>`__
8
9Multi-Node Lab: Serious Stuff
10=============================
11
12Here is OpenStack in a realistic test configuration with multiple
13physical servers.
14
15Prerequisites Linux & Network
16-----------------------------
17
18Minimal Install
19~~~~~~~~~~~~~~~
20
21You need to have a system with a fresh install of Linux. You can
22download the `Minimal
23CD <https://help.ubuntu.com/community/Installation/MinimalCD>`__ for
24Ubuntu releases since DevStack will download & install all the
25additional dependencies. The netinstall ISO is available for
26`Fedora <http://mirrors.kernel.org/fedora/releases/18/Fedora/x86_64/iso/Fedora-20-x86_64-netinst.iso>`__
27and
28`CentOS/RHEL <http://mirrors.kernel.org/centos/6.5/isos/x86_64/CentOS-6.5-x86_64-netinstall.iso>`__.
29
30Install a couple of packages to bootstrap configuration:
31
32::
33
34 apt-get install -y git sudo || yum install -y git sudo
35
36Network Configuration
37~~~~~~~~~~~~~~~~~~~~~
38
39The first iteration of the lab uses OpenStack's FlatDHCP network
40controller so only a single network will be required. It should be on
41its own subnet without DHCP; the host IPs and floating IP pool(s) will
42come out of this block. This example uses the following:
43
44- Gateway: 192.168.42.1
45- Physical nodes: 192.168.42.11-192.168.42.99
46- Floating IPs: 192.168.42.128-192.168.42.254
47
48Configure each node with a static IP. For Ubuntu edit
49``/etc/network/interfaces``:
50
51::
52
53 auto eth0
54 iface eth0 inet static
55 address 192.168.42.11
56 netmask 255.255.255.0
57 gateway 192.168.42.1
58
59For Fedora and CentOS/RHEL edit
60``/etc/sysconfig/network-scripts/ifcfg-eth0``:
61
62::
63
64 BOOTPROTO=static
65 IPADDR=192.168.42.11
66 NETMASK=255.255.255.0
67 GATEWAY=192.168.42.1
68
69Installation shake and bake
70---------------------------
71
72Add the DevStack User
73~~~~~~~~~~~~~~~~~~~~~
74
75OpenStack runs as a non-root user that has sudo access to root. There is
76nothing special about the name, we'll use ``stack`` here. Every node
77must use the same name and preferably uid. If you created a user during
78the OS install you can use it and give it sudo privileges below.
79Otherwise create the stack user:
80
81::
82
83 groupadd stack
84 useradd -g stack -s /bin/bash -d /opt/stack -m stack
85
86This user will be making many changes to your system during installation
87and operation so it needs to have sudo privileges to root without a
88password:
89
90::
91
92 echo "stack ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
93
94From here on use the ``stack`` user. **Logout** and **login** as the
95``stack`` user.
96
97Set Up Ssh
98~~~~~~~~~~
99
100Set up the stack user on each node with an ssh key for access:
101
102::
103
104 mkdir ~/.ssh; chmod 700 ~/.ssh
105 echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCyYjfgyPazTvGpd8OaAvtU2utL8W6gWC4JdRS1J95GhNNfQd657yO6s1AH5KYQWktcE6FO/xNUC2reEXSGC7ezy+sGO1kj9Limv5vrvNHvF1+wts0Cmyx61D2nQw35/Qz8BvpdJANL7VwP/cFI/p3yhvx2lsnjFE3hN8xRB2LtLUopUSVdBwACOVUmH2G+2BWMJDjVINd2DPqRIA4Zhy09KJ3O1Joabr0XpQL0yt/I9x8BVHdAx6l9U0tMg9dj5+tAjZvMAFfye3PJcYwwsfJoFxC8w/SLtqlFX7Ehw++8RtvomvuipLdmWCy+T9hIkl+gHYE4cS3OIqXH7f49jdJf jesse@spacey.local" > ~/.ssh/authorized_keys
106
107Download DevStack
108~~~~~~~~~~~~~~~~~
109
110Grab the latest version of DevStack:
111
112::
113
114 git clone https://git.openstack.org/openstack-dev/devstack
115 cd devstack
116
117Up to this point all of the steps apply to each node in the cluster.
118From here on there are some differences between the cluster controller
119(aka 'head node') and the compute nodes.
120
121Configure Cluster Controller
122~~~~~~~~~~~~~~~~~~~~~~~~~~~~
123
124The cluster controller runs all OpenStack services. Configure the
125cluster controller's DevStack in ``local.conf``:
126
127::
128
129 [[local|localrc]]
130 HOST_IP=192.168.42.11
131 FLAT_INTERFACE=eth0
132 FIXED_RANGE=10.4.128.0/20
133 FIXED_NETWORK_SIZE=4096
134 FLOATING_RANGE=192.168.42.128/25
135 MULTI_HOST=1
136 LOGFILE=/opt/stack/logs/stack.sh.log
137 ADMIN_PASSWORD=labstack
138 MYSQL_PASSWORD=supersecret
139 RABBIT_PASSWORD=supersecrete
140 SERVICE_PASSWORD=supersecrete
141 SERVICE_TOKEN=xyzpdqlazydog
142
143In the multi-node configuration the first 10 or so IPs in the private
144subnet are usually reserved. Add this to ``local.sh`` to have it run
145after every ``stack.sh`` run:
146
147::
148
149 for i in `seq 2 10`; do /opt/stack/nova/bin/nova-manage fixed reserve 10.4.128.$i; done
150
151Fire up OpenStack:
152
153::
154
155 ./stack.sh
156
157A stream of activity ensues. When complete you will see a summary of
158``stack.sh``'s work, including the relevant URLs, accounts and passwords
159to poke at your shiny new OpenStack. The most recent log file is
160available in ``stack.sh.log``.
161
162Configure Compute Nodes
163~~~~~~~~~~~~~~~~~~~~~~~
164
165The compute nodes only run the OpenStack worker services. For additional
166machines, create a ``local.conf`` with:
167
168::
169
170 HOST_IP=192.168.42.12 # change this per compute node
171 FLAT_INTERFACE=eth0
172 FIXED_RANGE=10.4.128.0/20
173 FIXED_NETWORK_SIZE=4096
174 FLOATING_RANGE=192.168.42.128/25
175 MULTI_HOST=1
176 LOGFILE=/opt/stack/logs/stack.sh.log
177 ADMIN_PASSWORD=labstack
178 MYSQL_PASSWORD=supersecret
179 RABBIT_PASSWORD=supersecrete
180 SERVICE_PASSWORD=supersecrete
181 SERVICE_TOKEN=xyzpdqlazydog
182 DATABASE_TYPE=mysql
183 SERVICE_HOST=192.168.42.11
184 MYSQL_HOST=192.168.42.11
185 RABBIT_HOST=192.168.42.11
186 GLANCE_HOSTPORT=192.168.42.11:9292
187 ENABLED_SERVICES=n-cpu,n-net,n-api,c-sch,c-api,c-vol
188 NOVA_VNC_ENABLED=True
189 NOVNCPROXY_URL="http://192.168.42.11:6080/vnc_auto.html"
190 VNCSERVER_LISTEN=$HOST_IP
191 VNCSERVER_PROXYCLIENT_ADDRESS=$VNCSERVER_LISTEN
192
193Fire up OpenStack:
194
195::
196
197 ./stack.sh
198
199A stream of activity ensues. When complete you will see a summary of
200``stack.sh``'s work, including the relevant URLs, accounts and passwords
201to poke at your shiny new OpenStack. The most recent log file is
202available in ``stack.sh.log``.
203
204Cleaning Up After DevStack
205~~~~~~~~~~~~~~~~~~~~~~~~~~
206
207Shutting down OpenStack is now as simple as running the included
208``unstack.sh`` script:
209
210::
211
212 ./unstack.sh
213
214A more aggressive cleanup can be performed using ``clean.sh``. It
215removes certain troublesome packages and attempts to leave the system in
216a state where changing the database or queue manager can be reliably
217performed.
218
219::
220
221 ./clean.sh
222
223Sometimes running instances are not cleaned up. DevStack attempts to do
224this when it runs but there are times it needs to still be done by hand:
225
226::
227
228 sudo rm -rf /etc/libvirt/qemu/inst*
229 sudo virsh list | grep inst | awk '{print $1}' | xargs -n1 virsh destroy
230
231Options pimp your stack
232-----------------------
233
234Additional Users
235~~~~~~~~~~~~~~~~
236
237DevStack creates two OpenStack users (``admin`` and ``demo``) and two
238tenants (also ``admin`` and ``demo``). ``admin`` is exactly what it
239sounds like, a privileged administrative account that is a member of
240both the ``admin`` and ``demo`` tenants. ``demo`` is a normal user
241account that is only a member of the ``demo`` tenant. Creating
242additional OpenStack users can be done through the dashboard, sometimes
243it is easier to do them in bulk from a script, especially since they get
244blown away every time ``stack.sh`` runs. The following steps are ripe
245for scripting:
246
247::
248
249 # Get admin creds
250 . openrc admin admin
251
252 # List existing tenants
253 keystone tenant-list
254
255 # List existing users
256 keystone user-list
257
258 # Add a user and tenant
259 NAME=bob
260 PASSWORD=BigSecrete
261 TENANT=$NAME
262 keystone tenant-create --name=$NAME
263 keystone user-create --name=$NAME --pass=$PASSWORD
264 keystone user-role-add --user-id=<bob-user-id> --tenant-id=<bob-tenant-id> --role-id=<member-role-id>
265 # member-role-id comes from the existing member role created by stack.sh
266 # keystone role-list
267
268Swift
269~~~~~
270
271Swift requires a significant amount of resources and is disabled by
272default in DevStack. The support in DevStack is geared toward a minimal
273installation but can be used for testing. To implement a true multi-node
274test of Swift required more than DevStack provides. Enabling it is as
275simple as enabling the ``swift`` service in ``local.conf``:
276
277::
278
279 enable_service s-proxy s-object s-container s-account
280
281Swift will put its data files in ``SWIFT_DATA_DIR`` (default
282``/opt/stack/data/swift``). The size of the data 'partition' created
283(really a loop-mounted file) is set by ``SWIFT_LOOPBACK_DISK_SIZE``. The
284Swift config files are located in ``SWIFT_CONFIG_DIR`` (default
285``/etc/swift``). All of these settings can be overridden in (wait for
286it...) ``local.conf``.
287
288Volumes
289~~~~~~~
290
291DevStack will automatically use an existing LVM volume group named
292``stack-volumes`` to store cloud-created volumes. If ``stack-volumes``
293doesn't exist, DevStack will set up a 5Gb loop-mounted file to contain
294it. This obviously limits the number and size of volumes that can be
295created inside OpenStack. The size can be overridden by setting
296``VOLUME_BACKING_FILE_SIZE`` in ``local.conf``.
297
298``stack-volumes`` can be pre-created on any physical volume supported by
299Linux's LVM. The name of the volume group can be changed by setting
300``VOLUME_GROUP`` in ``localrc``. ``stack.sh`` deletes all logical
301volumes in ``VOLUME_GROUP`` that begin with ``VOLUME_NAME_PREFIX`` as
302part of cleaning up from previous runs. It is recommended to not use the
303root volume group as ``VOLUME_GROUP``.
304
305The details of creating the volume group depends on the server hardware
306involved but looks something like this:
307
308::
309
310 pvcreate /dev/sdc
311 vgcreate stack-volumes /dev/sdc
312
313Syslog
314~~~~~~
315
316DevStack is capable of using ``rsyslog`` to aggregate logging across the
317cluster. It is off by default; to turn it on set ``SYSLOG=True`` in
318``local.conf``. ``SYSLOG_HOST`` defaults to ``HOST_IP``; on the compute
319nodes it must be set to the IP of the cluster controller to send syslog
320output there. In the example above, add this to the compute node
321``local.conf``:
322
323::
324
325 SYSLOG_HOST=192.168.42.11
326
327Using Alternate Repositories/Branches
328~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
329
330The git repositories for all of the OpenStack services are defined in
331``stackrc``. Since this file is a part of the DevStack package changes
332to it will probably be overwritten as updates are applied. Every setting
333in ``stackrc`` can be redefined in ``local.conf``.
334
335To change the repository or branch that a particular OpenStack service
336is created from, simply change the value of ``*_REPO`` or ``*_BRANCH``
337corresponding to that service.
338
339After making changes to the repository or branch, if ``RECLONE`` is not
340set in ``localrc`` it may be necessary to remove the corresponding
341directory from ``/opt/stack`` to force git to re-clone the repository.
342
343For example, to pull Nova from a proposed release candidate in the
344primary Nova repository:
345
346::
347
348 NOVA_BRANCH=rc-proposed
349
350To pull Glance from an experimental fork:
351
352::
353
354 GLANCE_BRANCH=try-something-big
355 GLANCE_REPO=https://github.com/mcuser/glance.git
356
357Notes stuff you might need to know
358----------------------------------
359
360Reset the Bridge
361~~~~~~~~~~~~~~~~
362
363How to reset the bridge configuration:
364
365::
366
367 sudo brctl delif br100 eth0.926
368 sudo ip link set dev br100 down
369 sudo brctl delbr br100
370
371Set MySQL Password
372~~~~~~~~~~~~~~~~~~
373
374If you forgot to set the root password you can do this:
375
376::
377
378 mysqladmin -u root -pnova password 'supersecret'
379
380© Openstack Foundation 2011-2014 — An
381`OpenStack <https://www.openstack.org/>`__
382`program <https://wiki.openstack.org/wiki/Programs>`__