blob: e6b0b96eb4d5d397f722283bc0029c91e08b210e [file] [log] [blame]
Dean Troyer0986a7b2014-10-29 22:08:13 -05001==============
2Multi-Node Lab
3==============
Sean M. Collins09e550c2014-10-21 11:40:08 -04004
5Here is OpenStack in a realistic test configuration with multiple
6physical servers.
7
8Prerequisites Linux & Network
Sean Dague32930462014-11-18 06:51:16 -05009=============================
Sean M. Collins09e550c2014-10-21 11:40:08 -040010
11Minimal Install
Sean Dague32930462014-11-18 06:51:16 -050012---------------
Sean M. Collins09e550c2014-10-21 11:40:08 -040013
14You need to have a system with a fresh install of Linux. You can
15download the `Minimal
16CD <https://help.ubuntu.com/community/Installation/MinimalCD>`__ for
17Ubuntu releases since DevStack will download & install all the
18additional dependencies. The netinstall ISO is available for
Dean Troyerea3cdfa2014-11-08 08:29:16 -060019`Fedora <http://mirrors.kernel.org/fedora/releases/>`__
Sean M. Collins09e550c2014-10-21 11:40:08 -040020and
Dean Troyerea3cdfa2014-11-08 08:29:16 -060021`CentOS/RHEL <http://mirrors.kernel.org/centos/>`__.
Sean M. Collins09e550c2014-10-21 11:40:08 -040022
23Install a couple of packages to bootstrap configuration:
24
25::
26
27 apt-get install -y git sudo || yum install -y git sudo
28
29Network Configuration
Sean Dague32930462014-11-18 06:51:16 -050030---------------------
Sean M. Collins09e550c2014-10-21 11:40:08 -040031
32The first iteration of the lab uses OpenStack's FlatDHCP network
33controller so only a single network will be required. It should be on
34its own subnet without DHCP; the host IPs and floating IP pool(s) will
35come out of this block. This example uses the following:
36
37- Gateway: 192.168.42.1
38- Physical nodes: 192.168.42.11-192.168.42.99
39- Floating IPs: 192.168.42.128-192.168.42.254
40
41Configure each node with a static IP. For Ubuntu edit
42``/etc/network/interfaces``:
43
44::
45
46 auto eth0
47 iface eth0 inet static
48 address 192.168.42.11
49 netmask 255.255.255.0
50 gateway 192.168.42.1
51
52For Fedora and CentOS/RHEL edit
53``/etc/sysconfig/network-scripts/ifcfg-eth0``:
54
55::
56
57 BOOTPROTO=static
58 IPADDR=192.168.42.11
59 NETMASK=255.255.255.0
60 GATEWAY=192.168.42.1
61
62Installation shake and bake
Sean Dague32930462014-11-18 06:51:16 -050063===========================
Sean M. Collins09e550c2014-10-21 11:40:08 -040064
65Add the DevStack User
Sean Dague32930462014-11-18 06:51:16 -050066---------------------
Sean M. Collins09e550c2014-10-21 11:40:08 -040067
68OpenStack runs as a non-root user that has sudo access to root. There is
69nothing special about the name, we'll use ``stack`` here. Every node
70must use the same name and preferably uid. If you created a user during
71the OS install you can use it and give it sudo privileges below.
72Otherwise create the stack user:
73
74::
75
David Rabel530d90c2017-03-22 08:25:26 +010076 useradd -s /bin/bash -d /opt/stack -m stack
Sean M. Collins09e550c2014-10-21 11:40:08 -040077
yatinkarelc64ea4f2022-04-20 12:30:09 +053078Ensure home directory for the ``stack`` user has executable permission for all,
79as RHEL based distros create it with ``700`` and Ubuntu 21.04+ with ``750``
80which can cause issues during deployment.
81
82::
83
84 chmod +x /opt/stack
85
Sean M. Collins09e550c2014-10-21 11:40:08 -040086This 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
Martin Kopecb70d98f2022-07-20 14:05:15 +000092 echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack
Sean M. Collins09e550c2014-10-21 11:40:08 -040093
94From here on use the ``stack`` user. **Logout** and **login** as the
95``stack`` user.
96
97Set Up Ssh
Sean Dague32930462014-11-18 06:51:16 -050098----------
Sean M. Collins09e550c2014-10-21 11:40:08 -040099
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
Sean Dague32930462014-11-18 06:51:16 -0500108-----------------
Sean M. Collins09e550c2014-10-21 11:40:08 -0400109
110Grab the latest version of DevStack:
111
112::
113
Matt Riedemann9b6d2f22019-06-18 10:43:16 -0400114 git clone https://opendev.org/openstack/devstack
Sean M. Collins09e550c2014-10-21 11:40:08 -0400115 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
Sean Dague32930462014-11-18 06:51:16 -0500122----------------------------
Sean M. Collins09e550c2014-10-21 11:40:08 -0400123
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
Sean M. Collins09e550c2014-10-21 11:40:08 -0400131 FIXED_RANGE=10.4.128.0/20
Sean M. Collins09e550c2014-10-21 11:40:08 -0400132 FLOATING_RANGE=192.168.42.128/25
Sean M. Collins09e550c2014-10-21 11:40:08 -0400133 LOGFILE=/opt/stack/logs/stack.sh.log
134 ADMIN_PASSWORD=labstack
Swapnil (coolsvap) Kulkarnic988bf62015-10-08 13:10:43 +0530135 DATABASE_PASSWORD=supersecret
Balagopal7ed812c2016-03-01 04:43:31 +0000136 RABBIT_PASSWORD=supersecret
137 SERVICE_PASSWORD=supersecret
Sean M. Collins09e550c2014-10-21 11:40:08 -0400138
139In the multi-node configuration the first 10 or so IPs in the private
140subnet are usually reserved. Add this to ``local.sh`` to have it run
141after every ``stack.sh`` run:
142
143::
144
145 for i in `seq 2 10`; do /opt/stack/nova/bin/nova-manage fixed reserve 10.4.128.$i; done
146
147Fire up OpenStack:
148
149::
150
151 ./stack.sh
152
153A stream of activity ensues. When complete you will see a summary of
154``stack.sh``'s work, including the relevant URLs, accounts and passwords
155to poke at your shiny new OpenStack. The most recent log file is
156available in ``stack.sh.log``.
157
158Configure Compute Nodes
Sean Dague32930462014-11-18 06:51:16 -0500159-----------------------
Sean M. Collins09e550c2014-10-21 11:40:08 -0400160
161The compute nodes only run the OpenStack worker services. For additional
162machines, create a ``local.conf`` with:
163
164::
165
Kashyap Kopparamcd1c3c72014-10-31 17:32:57 +0530166 [[local|localrc]]
Sean M. Collins09e550c2014-10-21 11:40:08 -0400167 HOST_IP=192.168.42.12 # change this per compute node
Sean M. Collins09e550c2014-10-21 11:40:08 -0400168 FIXED_RANGE=10.4.128.0/20
Sean M. Collins09e550c2014-10-21 11:40:08 -0400169 FLOATING_RANGE=192.168.42.128/25
Sean M. Collins09e550c2014-10-21 11:40:08 -0400170 LOGFILE=/opt/stack/logs/stack.sh.log
171 ADMIN_PASSWORD=labstack
Swapnil (coolsvap) Kulkarnic988bf62015-10-08 13:10:43 +0530172 DATABASE_PASSWORD=supersecret
Balagopal7ed812c2016-03-01 04:43:31 +0000173 RABBIT_PASSWORD=supersecret
174 SERVICE_PASSWORD=supersecret
Sean M. Collins09e550c2014-10-21 11:40:08 -0400175 DATABASE_TYPE=mysql
176 SERVICE_HOST=192.168.42.11
Masaki Matsushita597c9022015-08-15 11:35:20 +0900177 MYSQL_HOST=$SERVICE_HOST
178 RABBIT_HOST=$SERVICE_HOST
179 GLANCE_HOSTPORT=$SERVICE_HOST:9292
Pierre Riteau0a316302022-01-21 10:07:07 +0100180 ENABLED_SERVICES=n-cpu,c-vol,placement-client,ovn-controller,ovs-vswitchd,ovsdb-server,q-ovn-metadata-agent
Sean M. Collins09e550c2014-10-21 11:40:08 -0400181 NOVA_VNC_ENABLED=True
Stephen Finucane8c548692018-05-11 16:12:17 +0530182 NOVNCPROXY_URL="http://$SERVICE_HOST:6080/vnc_lite.html"
Sean M. Collins09e550c2014-10-21 11:40:08 -0400183 VNCSERVER_LISTEN=$HOST_IP
184 VNCSERVER_PROXYCLIENT_ADDRESS=$VNCSERVER_LISTEN
185
186Fire up OpenStack:
187
188::
189
190 ./stack.sh
191
192A stream of activity ensues. When complete you will see a summary of
193``stack.sh``'s work, including the relevant URLs, accounts and passwords
194to poke at your shiny new OpenStack. The most recent log file is
195available in ``stack.sh.log``.
196
Matt Riedemannc63ecad2017-07-25 17:08:50 -0400197Starting in the Ocata release, Nova requires a `Cells v2`_ deployment. Compute
198node services must be mapped to a cell before they can be used.
199
200After each compute node is stacked, verify it shows up in the
201``nova service-list --binary nova-compute`` output. The compute service is
202registered in the cell database asynchronously so this may require polling.
203
204Once the compute node services shows up, run the ``./tools/discover_hosts.sh``
205script from the control node to map compute hosts to the single cell.
206
207The compute service running on the primary control node will be
208discovered automatically when the control node is stacked so this really
209only needs to be performed for subnodes.
210
211.. _Cells v2: https://docs.openstack.org/nova/latest/user/cells.html
212
Jakub Libosvarad698f02025-01-08 15:26:41 -0500213Configure Tempest Node to run the Tempest tests
214-----------------------------------------------
215
216If there is a need to execute Tempest tests against different Cluster
217Controller node then it can be done by re-using the ``local.conf`` file from
218the Cluster Controller node but with not enabled Controller services in
219``ENABLED_SERVICES`` variable. This variable needs to contain only ``tempest``
220as a configured service. Then variable ``SERVICES_FOR_TEMPEST`` must be
221configured to contain those services that were enabled on the Cluster
222Controller node in the ``ENABLED_SERVICES`` variable. For example the
223``local.conf`` file could look as follows:
224
225::
226
227 [[local|localrc]]
228 HOST_IP=192.168.42.12 # change this per compute node
229 FIXED_RANGE=10.4.128.0/20
230 FLOATING_RANGE=192.168.42.128/25
231 LOGFILE=/opt/stack/logs/stack.sh.log
232 ADMIN_PASSWORD=labstack
233 DATABASE_PASSWORD=supersecret
234 RABBIT_PASSWORD=supersecret
235 SERVICE_PASSWORD=supersecret
236 DATABASE_TYPE=mysql
237 SERVICE_HOST=192.168.42.11
238 MYSQL_HOST=$SERVICE_HOST
239 RABBIT_HOST=$SERVICE_HOST
240 GLANCE_HOSTPORT=$SERVICE_HOST:9292
241 NOVA_VNC_ENABLED=True
242 NOVNCPROXY_URL="http://$SERVICE_HOST:6080/vnc_lite.html"
243 VNCSERVER_LISTEN=$HOST_IP
244 VNCSERVER_PROXYCLIENT_ADDRESS=$VNCSERVER_LISTEN
245 ENABLED_SERVICES=tempest
246 SERVICES_FOR_TEMPEST=keystone,nova,neutron,glance
247
248Then just execute the devstack:
249
250::
251
252 ./stack.sh
253
254
Sean M. Collins09e550c2014-10-21 11:40:08 -0400255Cleaning Up After DevStack
Sean Dague32930462014-11-18 06:51:16 -0500256--------------------------
Sean M. Collins09e550c2014-10-21 11:40:08 -0400257
258Shutting down OpenStack is now as simple as running the included
259``unstack.sh`` script:
260
261::
262
263 ./unstack.sh
264
265A more aggressive cleanup can be performed using ``clean.sh``. It
266removes certain troublesome packages and attempts to leave the system in
267a state where changing the database or queue manager can be reliably
268performed.
269
270::
271
272 ./clean.sh
273
274Sometimes running instances are not cleaned up. DevStack attempts to do
275this when it runs but there are times it needs to still be done by hand:
276
277::
278
279 sudo rm -rf /etc/libvirt/qemu/inst*
280 sudo virsh list | grep inst | awk '{print $1}' | xargs -n1 virsh destroy
281
Matt Riedemannec828522019-01-30 20:48:18 -0500282Going further
283=============
Sean M. Collins09e550c2014-10-21 11:40:08 -0400284
285Additional Users
Sean Dague32930462014-11-18 06:51:16 -0500286----------------
Sean M. Collins09e550c2014-10-21 11:40:08 -0400287
288DevStack creates two OpenStack users (``admin`` and ``demo``) and two
Peter Stachowski9a808922015-04-08 19:48:09 +0000289projects (also ``admin`` and ``demo``). ``admin`` is exactly what it
Sean M. Collins09e550c2014-10-21 11:40:08 -0400290sounds like, a privileged administrative account that is a member of
Peter Stachowski9a808922015-04-08 19:48:09 +0000291both the ``admin`` and ``demo`` projects. ``demo`` is a normal user
292account that is only a member of the ``demo`` project. Creating
Sean M. Collins09e550c2014-10-21 11:40:08 -0400293additional OpenStack users can be done through the dashboard, sometimes
294it is easier to do them in bulk from a script, especially since they get
295blown away every time ``stack.sh`` runs. The following steps are ripe
296for scripting:
297
298::
299
300 # Get admin creds
301 . openrc admin admin
Sean Dague32930462014-11-18 06:51:16 -0500302
Peter Stachowski9a808922015-04-08 19:48:09 +0000303 # List existing projects
304 openstack project list
Sean M. Collins09e550c2014-10-21 11:40:08 -0400305
306 # List existing users
Peter Stachowski9a808922015-04-08 19:48:09 +0000307 openstack user list
Sean M. Collins09e550c2014-10-21 11:40:08 -0400308
Peter Stachowski9a808922015-04-08 19:48:09 +0000309 # Add a user and project
Sean M. Collins09e550c2014-10-21 11:40:08 -0400310 NAME=bob
Balagopal7ed812c2016-03-01 04:43:31 +0000311 PASSWORD=BigSecret
Peter Stachowski9a808922015-04-08 19:48:09 +0000312 PROJECT=$NAME
313 openstack project create $PROJECT
314 openstack user create $NAME --password=$PASSWORD --project $PROJECT
315 openstack role add Member --user $NAME --project $PROJECT
316 # The Member role is created by stack.sh
Mike Perezc271b3e2016-10-03 16:00:33 -0700317 # openstack role assignment list
Sean M. Collins09e550c2014-10-21 11:40:08 -0400318
319Swift
Sean Dague32930462014-11-18 06:51:16 -0500320-----
Sean M. Collins09e550c2014-10-21 11:40:08 -0400321
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400322Swift, OpenStack Object Storage, requires a significant amount of resources
Sean Daguea6db5e32015-08-04 06:23:28 -0400323and is disabled by default in DevStack. The support in DevStack is geared
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400324toward a minimal installation but can be used for testing. To implement a
325true multi-node test of swift, additional steps will be required. Enabling it is as
Sean M. Collins09e550c2014-10-21 11:40:08 -0400326simple as enabling the ``swift`` service in ``local.conf``:
327
328::
329
330 enable_service s-proxy s-object s-container s-account
331
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400332Swift, OpenStack Object Storage, will put its data files in ``SWIFT_DATA_DIR`` (default
Sean M. Collins09e550c2014-10-21 11:40:08 -0400333``/opt/stack/data/swift``). The size of the data 'partition' created
334(really a loop-mounted file) is set by ``SWIFT_LOOPBACK_DISK_SIZE``. The
JordanPa6dfe812014-11-20 18:06:23 +0100335Swift config files are located in ``SWIFT_CONF_DIR`` (default
Sean M. Collins09e550c2014-10-21 11:40:08 -0400336``/etc/swift``). All of these settings can be overridden in (wait for
337it...) ``local.conf``.
338
339Volumes
Sean Dague32930462014-11-18 06:51:16 -0500340-------
Sean M. Collins09e550c2014-10-21 11:40:08 -0400341
342DevStack will automatically use an existing LVM volume group named
343``stack-volumes`` to store cloud-created volumes. If ``stack-volumes``
Matt Riedemann4a3cc1c2019-01-30 20:50:47 -0500344doesn't exist, DevStack will set up a loop-mounted file to contain
345it. If the default size is insufficient for the number and size of volumes
346required, it can be overridden by setting ``VOLUME_BACKING_FILE_SIZE`` in
347``local.conf`` (sizes given in ``truncate`` compatible format, e.g. ``24G``).
Sean M. Collins09e550c2014-10-21 11:40:08 -0400348
349``stack-volumes`` can be pre-created on any physical volume supported by
350Linux's LVM. The name of the volume group can be changed by setting
Jordan Pittierf5069f32016-11-08 12:10:12 +0100351``VOLUME_GROUP_NAME`` in ``localrc``. ``stack.sh`` deletes all logical
352volumes in ``VOLUME_GROUP_NAME`` that begin with ``VOLUME_NAME_PREFIX`` as
Sean M. Collins09e550c2014-10-21 11:40:08 -0400353part of cleaning up from previous runs. It is recommended to not use the
Jordan Pittierf5069f32016-11-08 12:10:12 +0100354root volume group as ``VOLUME_GROUP_NAME``.
Sean M. Collins09e550c2014-10-21 11:40:08 -0400355
356The details of creating the volume group depends on the server hardware
357involved but looks something like this:
358
359::
360
361 pvcreate /dev/sdc
362 vgcreate stack-volumes /dev/sdc
363
364Syslog
Sean Dague32930462014-11-18 06:51:16 -0500365------
Sean M. Collins09e550c2014-10-21 11:40:08 -0400366
367DevStack is capable of using ``rsyslog`` to aggregate logging across the
368cluster. It is off by default; to turn it on set ``SYSLOG=True`` in
369``local.conf``. ``SYSLOG_HOST`` defaults to ``HOST_IP``; on the compute
370nodes it must be set to the IP of the cluster controller to send syslog
371output there. In the example above, add this to the compute node
372``local.conf``:
373
374::
375
376 SYSLOG_HOST=192.168.42.11
377
378Using Alternate Repositories/Branches
Sean Dague32930462014-11-18 06:51:16 -0500379-------------------------------------
Sean M. Collins09e550c2014-10-21 11:40:08 -0400380
381The git repositories for all of the OpenStack services are defined in
382``stackrc``. Since this file is a part of the DevStack package changes
383to it will probably be overwritten as updates are applied. Every setting
384in ``stackrc`` can be redefined in ``local.conf``.
385
386To change the repository or branch that a particular OpenStack service
387is created from, simply change the value of ``*_REPO`` or ``*_BRANCH``
388corresponding to that service.
389
390After making changes to the repository or branch, if ``RECLONE`` is not
391set in ``localrc`` it may be necessary to remove the corresponding
392directory from ``/opt/stack`` to force git to re-clone the repository.
393
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400394For example, to pull nova, OpenStack Compute, from a proposed release candidate
395in the primary nova repository:
Sean M. Collins09e550c2014-10-21 11:40:08 -0400396
397::
398
399 NOVA_BRANCH=rc-proposed
400
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400401To pull glance, OpenStack Image service, from an experimental fork:
Sean M. Collins09e550c2014-10-21 11:40:08 -0400402
403::
404
405 GLANCE_BRANCH=try-something-big
406 GLANCE_REPO=https://github.com/mcuser/glance.git
407
408Notes stuff you might need to know
Sean Dague32930462014-11-18 06:51:16 -0500409==================================
Sean M. Collins09e550c2014-10-21 11:40:08 -0400410
Sean M. Collins09e550c2014-10-21 11:40:08 -0400411Set MySQL Password
Sean Dague32930462014-11-18 06:51:16 -0500412------------------
Sean M. Collins09e550c2014-10-21 11:40:08 -0400413
414If you forgot to set the root password you can do this:
415
416::
417
418 mysqladmin -u root -pnova password 'supersecret'
Zhenzan Zhoue1f87962015-09-08 16:49:52 +0800419
420Live Migration
421--------------
422
423In order for live migration to work with the default live migration URI::
424
425 [libvirt]
426 live_migration_uri = qemu+ssh://stack@%s/system
427
428SSH keys need to be exchanged between each compute node:
429
4301. The SOURCE root user's public RSA key (likely in /root/.ssh/id_rsa.pub)
431 needs to be in the DESTINATION stack user's authorized_keys file
432 (~stack/.ssh/authorized_keys). This can be accomplished by manually
433 copying the contents from the file on the SOURCE to the DESTINATION. If
434 you have a password configured for the stack user, then you can use the
435 following command to accomplish the same thing::
436
437 ssh-copy-id -i /root/.ssh/id_rsa.pub stack@DESTINATION
438
4392. The DESTINATION host's public ECDSA key (/etc/ssh/ssh_host_ecdsa_key.pub)
440 needs to be in the SOURCE root user's known_hosts file
441 (/root/.ssh/known_hosts). This can be accomplished by running the
442 following on the SOURCE machine (hostname must be used)::
443
444 ssh-keyscan -H DEST_HOSTNAME | sudo tee -a /root/.ssh/known_hosts
445
Hidekazu Nakamura541617b2016-11-09 15:27:19 +09004463. Verify that login via ssh works without a password::
447
Nobuhiro MIKI110b9a92021-04-01 11:00:25 +0900448 ssh -i /root/.ssh/id_rsa stack@DESTINATION
Hidekazu Nakamura541617b2016-11-09 15:27:19 +0900449
Zhenzan Zhoue1f87962015-09-08 16:49:52 +0800450In essence, this means that every compute node's root user's public RSA key
451must exist in every other compute node's stack user's authorized_keys file and
452every compute node's public ECDSA key needs to be in every other compute
453node's root user's known_hosts file. Please note that if the root or stack
454user does not have a SSH key, one can be generated using::
455
456 ssh-keygen -t rsa
457
458The above steps are necessary because libvirtd runs as root when the
459live_migration_uri uses the "qemu:///system" family of URIs. For more
460information, see the `libvirt documentation`_.
461
462.. _libvirt documentation: https://libvirt.org/drvqemu.html#securitydriver