blob: 484ebba57108dbddc22adca5e587ebade2c47cb6 [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
78This user will be making many changes to your system during installation
79and operation so it needs to have sudo privileges to root without a
80password:
81
82::
83
84 echo "stack ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
85
86From here on use the ``stack`` user. **Logout** and **login** as the
87``stack`` user.
88
89Set Up Ssh
Sean Dague32930462014-11-18 06:51:16 -050090----------
Sean M. Collins09e550c2014-10-21 11:40:08 -040091
92Set up the stack user on each node with an ssh key for access:
93
94::
95
96 mkdir ~/.ssh; chmod 700 ~/.ssh
97 echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCyYjfgyPazTvGpd8OaAvtU2utL8W6gWC4JdRS1J95GhNNfQd657yO6s1AH5KYQWktcE6FO/xNUC2reEXSGC7ezy+sGO1kj9Limv5vrvNHvF1+wts0Cmyx61D2nQw35/Qz8BvpdJANL7VwP/cFI/p3yhvx2lsnjFE3hN8xRB2LtLUopUSVdBwACOVUmH2G+2BWMJDjVINd2DPqRIA4Zhy09KJ3O1Joabr0XpQL0yt/I9x8BVHdAx6l9U0tMg9dj5+tAjZvMAFfye3PJcYwwsfJoFxC8w/SLtqlFX7Ehw++8RtvomvuipLdmWCy+T9hIkl+gHYE4cS3OIqXH7f49jdJf jesse@spacey.local" > ~/.ssh/authorized_keys
98
99Download DevStack
Sean Dague32930462014-11-18 06:51:16 -0500100-----------------
Sean M. Collins09e550c2014-10-21 11:40:08 -0400101
102Grab the latest version of DevStack:
103
104::
105
106 git clone https://git.openstack.org/openstack-dev/devstack
107 cd devstack
108
109Up to this point all of the steps apply to each node in the cluster.
110From here on there are some differences between the cluster controller
111(aka 'head node') and the compute nodes.
112
113Configure Cluster Controller
Sean Dague32930462014-11-18 06:51:16 -0500114----------------------------
Sean M. Collins09e550c2014-10-21 11:40:08 -0400115
116The cluster controller runs all OpenStack services. Configure the
117cluster controller's DevStack in ``local.conf``:
118
119::
120
121 [[local|localrc]]
122 HOST_IP=192.168.42.11
123 FLAT_INTERFACE=eth0
124 FIXED_RANGE=10.4.128.0/20
125 FIXED_NETWORK_SIZE=4096
126 FLOATING_RANGE=192.168.42.128/25
127 MULTI_HOST=1
128 LOGFILE=/opt/stack/logs/stack.sh.log
129 ADMIN_PASSWORD=labstack
Swapnil (coolsvap) Kulkarnic988bf62015-10-08 13:10:43 +0530130 DATABASE_PASSWORD=supersecret
Balagopal7ed812c2016-03-01 04:43:31 +0000131 RABBIT_PASSWORD=supersecret
132 SERVICE_PASSWORD=supersecret
Sean M. Collins09e550c2014-10-21 11:40:08 -0400133
134In the multi-node configuration the first 10 or so IPs in the private
135subnet are usually reserved. Add this to ``local.sh`` to have it run
136after every ``stack.sh`` run:
137
138::
139
140 for i in `seq 2 10`; do /opt/stack/nova/bin/nova-manage fixed reserve 10.4.128.$i; done
141
142Fire up OpenStack:
143
144::
145
146 ./stack.sh
147
148A stream of activity ensues. When complete you will see a summary of
149``stack.sh``'s work, including the relevant URLs, accounts and passwords
150to poke at your shiny new OpenStack. The most recent log file is
151available in ``stack.sh.log``.
152
153Configure Compute Nodes
Sean Dague32930462014-11-18 06:51:16 -0500154-----------------------
Sean M. Collins09e550c2014-10-21 11:40:08 -0400155
156The compute nodes only run the OpenStack worker services. For additional
157machines, create a ``local.conf`` with:
158
159::
160
Kashyap Kopparamcd1c3c72014-10-31 17:32:57 +0530161 [[local|localrc]]
Sean M. Collins09e550c2014-10-21 11:40:08 -0400162 HOST_IP=192.168.42.12 # change this per compute node
163 FLAT_INTERFACE=eth0
164 FIXED_RANGE=10.4.128.0/20
165 FIXED_NETWORK_SIZE=4096
166 FLOATING_RANGE=192.168.42.128/25
167 MULTI_HOST=1
168 LOGFILE=/opt/stack/logs/stack.sh.log
169 ADMIN_PASSWORD=labstack
Swapnil (coolsvap) Kulkarnic988bf62015-10-08 13:10:43 +0530170 DATABASE_PASSWORD=supersecret
Balagopal7ed812c2016-03-01 04:43:31 +0000171 RABBIT_PASSWORD=supersecret
172 SERVICE_PASSWORD=supersecret
Sean M. Collins09e550c2014-10-21 11:40:08 -0400173 DATABASE_TYPE=mysql
174 SERVICE_HOST=192.168.42.11
Masaki Matsushita597c9022015-08-15 11:35:20 +0900175 MYSQL_HOST=$SERVICE_HOST
176 RABBIT_HOST=$SERVICE_HOST
177 GLANCE_HOSTPORT=$SERVICE_HOST:9292
Dave Chen9bc77082017-03-10 05:34:21 +0800178 ENABLED_SERVICES=n-cpu,q-agt,n-api-meta,c-vol
Sean M. Collins09e550c2014-10-21 11:40:08 -0400179 NOVA_VNC_ENABLED=True
Masaki Matsushita597c9022015-08-15 11:35:20 +0900180 NOVNCPROXY_URL="http://$SERVICE_HOST:6080/vnc_auto.html"
Sean M. Collins09e550c2014-10-21 11:40:08 -0400181 VNCSERVER_LISTEN=$HOST_IP
182 VNCSERVER_PROXYCLIENT_ADDRESS=$VNCSERVER_LISTEN
183
Sean Daguea6db5e32015-08-04 06:23:28 -0400184**Note:** the ``n-api-meta`` service is a version of the api server
185that only serves the metadata service. It's needed because the
186computes created won't have a routing path to the metadata service on
187the controller.
188
Sean M. Collins09e550c2014-10-21 11:40:08 -0400189Fire up OpenStack:
190
191::
192
193 ./stack.sh
194
195A stream of activity ensues. When complete you will see a summary of
196``stack.sh``'s work, including the relevant URLs, accounts and passwords
197to poke at your shiny new OpenStack. The most recent log file is
198available in ``stack.sh.log``.
199
200Cleaning Up After DevStack
Sean Dague32930462014-11-18 06:51:16 -0500201--------------------------
Sean M. Collins09e550c2014-10-21 11:40:08 -0400202
203Shutting down OpenStack is now as simple as running the included
204``unstack.sh`` script:
205
206::
207
208 ./unstack.sh
209
210A more aggressive cleanup can be performed using ``clean.sh``. It
211removes certain troublesome packages and attempts to leave the system in
212a state where changing the database or queue manager can be reliably
213performed.
214
215::
216
217 ./clean.sh
218
219Sometimes running instances are not cleaned up. DevStack attempts to do
220this when it runs but there are times it needs to still be done by hand:
221
222::
223
224 sudo rm -rf /etc/libvirt/qemu/inst*
225 sudo virsh list | grep inst | awk '{print $1}' | xargs -n1 virsh destroy
226
227Options pimp your stack
Sean Dague32930462014-11-18 06:51:16 -0500228=======================
Sean M. Collins09e550c2014-10-21 11:40:08 -0400229
230Additional Users
Sean Dague32930462014-11-18 06:51:16 -0500231----------------
Sean M. Collins09e550c2014-10-21 11:40:08 -0400232
233DevStack creates two OpenStack users (``admin`` and ``demo``) and two
Peter Stachowski9a808922015-04-08 19:48:09 +0000234projects (also ``admin`` and ``demo``). ``admin`` is exactly what it
Sean M. Collins09e550c2014-10-21 11:40:08 -0400235sounds like, a privileged administrative account that is a member of
Peter Stachowski9a808922015-04-08 19:48:09 +0000236both the ``admin`` and ``demo`` projects. ``demo`` is a normal user
237account that is only a member of the ``demo`` project. Creating
Sean M. Collins09e550c2014-10-21 11:40:08 -0400238additional OpenStack users can be done through the dashboard, sometimes
239it is easier to do them in bulk from a script, especially since they get
240blown away every time ``stack.sh`` runs. The following steps are ripe
241for scripting:
242
243::
244
245 # Get admin creds
246 . openrc admin admin
Sean Dague32930462014-11-18 06:51:16 -0500247
Peter Stachowski9a808922015-04-08 19:48:09 +0000248 # List existing projects
249 openstack project list
Sean M. Collins09e550c2014-10-21 11:40:08 -0400250
251 # List existing users
Peter Stachowski9a808922015-04-08 19:48:09 +0000252 openstack user list
Sean M. Collins09e550c2014-10-21 11:40:08 -0400253
Peter Stachowski9a808922015-04-08 19:48:09 +0000254 # Add a user and project
Sean M. Collins09e550c2014-10-21 11:40:08 -0400255 NAME=bob
Balagopal7ed812c2016-03-01 04:43:31 +0000256 PASSWORD=BigSecret
Peter Stachowski9a808922015-04-08 19:48:09 +0000257 PROJECT=$NAME
258 openstack project create $PROJECT
259 openstack user create $NAME --password=$PASSWORD --project $PROJECT
260 openstack role add Member --user $NAME --project $PROJECT
261 # The Member role is created by stack.sh
Mike Perezc271b3e2016-10-03 16:00:33 -0700262 # openstack role assignment list
Sean M. Collins09e550c2014-10-21 11:40:08 -0400263
264Swift
Sean Dague32930462014-11-18 06:51:16 -0500265-----
Sean M. Collins09e550c2014-10-21 11:40:08 -0400266
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400267Swift, OpenStack Object Storage, requires a significant amount of resources
Sean Daguea6db5e32015-08-04 06:23:28 -0400268and is disabled by default in DevStack. The support in DevStack is geared
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400269toward a minimal installation but can be used for testing. To implement a
270true multi-node test of swift, additional steps will be required. Enabling it is as
Sean M. Collins09e550c2014-10-21 11:40:08 -0400271simple as enabling the ``swift`` service in ``local.conf``:
272
273::
274
275 enable_service s-proxy s-object s-container s-account
276
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400277Swift, OpenStack Object Storage, will put its data files in ``SWIFT_DATA_DIR`` (default
Sean M. Collins09e550c2014-10-21 11:40:08 -0400278``/opt/stack/data/swift``). The size of the data 'partition' created
279(really a loop-mounted file) is set by ``SWIFT_LOOPBACK_DISK_SIZE``. The
JordanPa6dfe812014-11-20 18:06:23 +0100280Swift config files are located in ``SWIFT_CONF_DIR`` (default
Sean M. Collins09e550c2014-10-21 11:40:08 -0400281``/etc/swift``). All of these settings can be overridden in (wait for
282it...) ``local.conf``.
283
284Volumes
Sean Dague32930462014-11-18 06:51:16 -0500285-------
Sean M. Collins09e550c2014-10-21 11:40:08 -0400286
287DevStack will automatically use an existing LVM volume group named
288``stack-volumes`` to store cloud-created volumes. If ``stack-volumes``
Dean Troyerea3cdfa2014-11-08 08:29:16 -0600289doesn't exist, DevStack will set up a 10Gb loop-mounted file to contain
Sean M. Collins09e550c2014-10-21 11:40:08 -0400290it. This obviously limits the number and size of volumes that can be
291created inside OpenStack. The size can be overridden by setting
292``VOLUME_BACKING_FILE_SIZE`` in ``local.conf``.
293
294``stack-volumes`` can be pre-created on any physical volume supported by
295Linux's LVM. The name of the volume group can be changed by setting
Jordan Pittierf5069f32016-11-08 12:10:12 +0100296``VOLUME_GROUP_NAME`` in ``localrc``. ``stack.sh`` deletes all logical
297volumes in ``VOLUME_GROUP_NAME`` that begin with ``VOLUME_NAME_PREFIX`` as
Sean M. Collins09e550c2014-10-21 11:40:08 -0400298part of cleaning up from previous runs. It is recommended to not use the
Jordan Pittierf5069f32016-11-08 12:10:12 +0100299root volume group as ``VOLUME_GROUP_NAME``.
Sean M. Collins09e550c2014-10-21 11:40:08 -0400300
301The details of creating the volume group depends on the server hardware
302involved but looks something like this:
303
304::
305
306 pvcreate /dev/sdc
307 vgcreate stack-volumes /dev/sdc
308
309Syslog
Sean Dague32930462014-11-18 06:51:16 -0500310------
Sean M. Collins09e550c2014-10-21 11:40:08 -0400311
312DevStack is capable of using ``rsyslog`` to aggregate logging across the
313cluster. It is off by default; to turn it on set ``SYSLOG=True`` in
314``local.conf``. ``SYSLOG_HOST`` defaults to ``HOST_IP``; on the compute
315nodes it must be set to the IP of the cluster controller to send syslog
316output there. In the example above, add this to the compute node
317``local.conf``:
318
319::
320
321 SYSLOG_HOST=192.168.42.11
322
323Using Alternate Repositories/Branches
Sean Dague32930462014-11-18 06:51:16 -0500324-------------------------------------
Sean M. Collins09e550c2014-10-21 11:40:08 -0400325
326The git repositories for all of the OpenStack services are defined in
327``stackrc``. Since this file is a part of the DevStack package changes
328to it will probably be overwritten as updates are applied. Every setting
329in ``stackrc`` can be redefined in ``local.conf``.
330
331To change the repository or branch that a particular OpenStack service
332is created from, simply change the value of ``*_REPO`` or ``*_BRANCH``
333corresponding to that service.
334
335After making changes to the repository or branch, if ``RECLONE`` is not
336set in ``localrc`` it may be necessary to remove the corresponding
337directory from ``/opt/stack`` to force git to re-clone the repository.
338
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400339For example, to pull nova, OpenStack Compute, from a proposed release candidate
340in the primary nova repository:
Sean M. Collins09e550c2014-10-21 11:40:08 -0400341
342::
343
344 NOVA_BRANCH=rc-proposed
345
Shilla Saebi2ed09d82015-04-21 15:02:13 -0400346To pull glance, OpenStack Image service, from an experimental fork:
Sean M. Collins09e550c2014-10-21 11:40:08 -0400347
348::
349
350 GLANCE_BRANCH=try-something-big
351 GLANCE_REPO=https://github.com/mcuser/glance.git
352
353Notes stuff you might need to know
Sean Dague32930462014-11-18 06:51:16 -0500354==================================
Sean M. Collins09e550c2014-10-21 11:40:08 -0400355
356Reset the Bridge
Sean Dague32930462014-11-18 06:51:16 -0500357----------------
Sean M. Collins09e550c2014-10-21 11:40:08 -0400358
359How to reset the bridge configuration:
360
361::
362
363 sudo brctl delif br100 eth0.926
364 sudo ip link set dev br100 down
365 sudo brctl delbr br100
366
367Set MySQL Password
Sean Dague32930462014-11-18 06:51:16 -0500368------------------
Sean M. Collins09e550c2014-10-21 11:40:08 -0400369
370If you forgot to set the root password you can do this:
371
372::
373
374 mysqladmin -u root -pnova password 'supersecret'
Zhenzan Zhoue1f87962015-09-08 16:49:52 +0800375
376Live Migration
377--------------
378
379In order for live migration to work with the default live migration URI::
380
381 [libvirt]
382 live_migration_uri = qemu+ssh://stack@%s/system
383
384SSH keys need to be exchanged between each compute node:
385
3861. The SOURCE root user's public RSA key (likely in /root/.ssh/id_rsa.pub)
387 needs to be in the DESTINATION stack user's authorized_keys file
388 (~stack/.ssh/authorized_keys). This can be accomplished by manually
389 copying the contents from the file on the SOURCE to the DESTINATION. If
390 you have a password configured for the stack user, then you can use the
391 following command to accomplish the same thing::
392
393 ssh-copy-id -i /root/.ssh/id_rsa.pub stack@DESTINATION
394
3952. The DESTINATION host's public ECDSA key (/etc/ssh/ssh_host_ecdsa_key.pub)
396 needs to be in the SOURCE root user's known_hosts file
397 (/root/.ssh/known_hosts). This can be accomplished by running the
398 following on the SOURCE machine (hostname must be used)::
399
400 ssh-keyscan -H DEST_HOSTNAME | sudo tee -a /root/.ssh/known_hosts
401
Hidekazu Nakamura541617b2016-11-09 15:27:19 +09004023. Verify that login via ssh works without a password::
403
404 ssh -i /root/.ssh/id_rsa.pub stack@DESTINATION
405
Zhenzan Zhoue1f87962015-09-08 16:49:52 +0800406In essence, this means that every compute node's root user's public RSA key
407must exist in every other compute node's stack user's authorized_keys file and
408every compute node's public ECDSA key needs to be in every other compute
409node's root user's known_hosts file. Please note that if the root or stack
410user does not have a SSH key, one can be generated using::
411
412 ssh-keygen -t rsa
413
414The above steps are necessary because libvirtd runs as root when the
415live_migration_uri uses the "qemu:///system" family of URIs. For more
416information, see the `libvirt documentation`_.
417
418.. _libvirt documentation: https://libvirt.org/drvqemu.html#securitydriver