blob: 0b1ebb931b610818ff1dddf0a685d5790919a5e3 [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
Kashyap Kopparamcd1c3c72014-10-31 17:32:57 +0530170 [[local|localrc]]
Sean M. Collins09e550c2014-10-21 11:40:08 -0400171 HOST_IP=192.168.42.12 # change this per compute node
172 FLAT_INTERFACE=eth0
173 FIXED_RANGE=10.4.128.0/20
174 FIXED_NETWORK_SIZE=4096
175 FLOATING_RANGE=192.168.42.128/25
176 MULTI_HOST=1
177 LOGFILE=/opt/stack/logs/stack.sh.log
178 ADMIN_PASSWORD=labstack
179 MYSQL_PASSWORD=supersecret
180 RABBIT_PASSWORD=supersecrete
181 SERVICE_PASSWORD=supersecrete
182 SERVICE_TOKEN=xyzpdqlazydog
183 DATABASE_TYPE=mysql
184 SERVICE_HOST=192.168.42.11
185 MYSQL_HOST=192.168.42.11
186 RABBIT_HOST=192.168.42.11
187 GLANCE_HOSTPORT=192.168.42.11:9292
188 ENABLED_SERVICES=n-cpu,n-net,n-api,c-sch,c-api,c-vol
189 NOVA_VNC_ENABLED=True
190 NOVNCPROXY_URL="http://192.168.42.11:6080/vnc_auto.html"
191 VNCSERVER_LISTEN=$HOST_IP
192 VNCSERVER_PROXYCLIENT_ADDRESS=$VNCSERVER_LISTEN
193
194Fire up OpenStack:
195
196::
197
198 ./stack.sh
199
200A stream of activity ensues. When complete you will see a summary of
201``stack.sh``'s work, including the relevant URLs, accounts and passwords
202to poke at your shiny new OpenStack. The most recent log file is
203available in ``stack.sh.log``.
204
205Cleaning Up After DevStack
206~~~~~~~~~~~~~~~~~~~~~~~~~~
207
208Shutting down OpenStack is now as simple as running the included
209``unstack.sh`` script:
210
211::
212
213 ./unstack.sh
214
215A more aggressive cleanup can be performed using ``clean.sh``. It
216removes certain troublesome packages and attempts to leave the system in
217a state where changing the database or queue manager can be reliably
218performed.
219
220::
221
222 ./clean.sh
223
224Sometimes running instances are not cleaned up. DevStack attempts to do
225this when it runs but there are times it needs to still be done by hand:
226
227::
228
229 sudo rm -rf /etc/libvirt/qemu/inst*
230 sudo virsh list | grep inst | awk '{print $1}' | xargs -n1 virsh destroy
231
232Options pimp your stack
233-----------------------
234
235Additional Users
236~~~~~~~~~~~~~~~~
237
238DevStack creates two OpenStack users (``admin`` and ``demo``) and two
239tenants (also ``admin`` and ``demo``). ``admin`` is exactly what it
240sounds like, a privileged administrative account that is a member of
241both the ``admin`` and ``demo`` tenants. ``demo`` is a normal user
242account that is only a member of the ``demo`` tenant. Creating
243additional OpenStack users can be done through the dashboard, sometimes
244it is easier to do them in bulk from a script, especially since they get
245blown away every time ``stack.sh`` runs. The following steps are ripe
246for scripting:
247
248::
249
250 # Get admin creds
251 . openrc admin admin
252
253 # List existing tenants
254 keystone tenant-list
255
256 # List existing users
257 keystone user-list
258
259 # Add a user and tenant
260 NAME=bob
261 PASSWORD=BigSecrete
262 TENANT=$NAME
263 keystone tenant-create --name=$NAME
264 keystone user-create --name=$NAME --pass=$PASSWORD
265 keystone user-role-add --user-id=<bob-user-id> --tenant-id=<bob-tenant-id> --role-id=<member-role-id>
266 # member-role-id comes from the existing member role created by stack.sh
267 # keystone role-list
268
269Swift
270~~~~~
271
272Swift requires a significant amount of resources and is disabled by
273default in DevStack. The support in DevStack is geared toward a minimal
274installation but can be used for testing. To implement a true multi-node
275test of Swift required more than DevStack provides. Enabling it is as
276simple as enabling the ``swift`` service in ``local.conf``:
277
278::
279
280 enable_service s-proxy s-object s-container s-account
281
282Swift will put its data files in ``SWIFT_DATA_DIR`` (default
283``/opt/stack/data/swift``). The size of the data 'partition' created
284(really a loop-mounted file) is set by ``SWIFT_LOOPBACK_DISK_SIZE``. The
285Swift config files are located in ``SWIFT_CONFIG_DIR`` (default
286``/etc/swift``). All of these settings can be overridden in (wait for
287it...) ``local.conf``.
288
289Volumes
290~~~~~~~
291
292DevStack will automatically use an existing LVM volume group named
293``stack-volumes`` to store cloud-created volumes. If ``stack-volumes``
294doesn't exist, DevStack will set up a 5Gb loop-mounted file to contain
295it. This obviously limits the number and size of volumes that can be
296created inside OpenStack. The size can be overridden by setting
297``VOLUME_BACKING_FILE_SIZE`` in ``local.conf``.
298
299``stack-volumes`` can be pre-created on any physical volume supported by
300Linux's LVM. The name of the volume group can be changed by setting
301``VOLUME_GROUP`` in ``localrc``. ``stack.sh`` deletes all logical
302volumes in ``VOLUME_GROUP`` that begin with ``VOLUME_NAME_PREFIX`` as
303part of cleaning up from previous runs. It is recommended to not use the
304root volume group as ``VOLUME_GROUP``.
305
306The details of creating the volume group depends on the server hardware
307involved but looks something like this:
308
309::
310
311 pvcreate /dev/sdc
312 vgcreate stack-volumes /dev/sdc
313
314Syslog
315~~~~~~
316
317DevStack is capable of using ``rsyslog`` to aggregate logging across the
318cluster. It is off by default; to turn it on set ``SYSLOG=True`` in
319``local.conf``. ``SYSLOG_HOST`` defaults to ``HOST_IP``; on the compute
320nodes it must be set to the IP of the cluster controller to send syslog
321output there. In the example above, add this to the compute node
322``local.conf``:
323
324::
325
326 SYSLOG_HOST=192.168.42.11
327
328Using Alternate Repositories/Branches
329~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
330
331The git repositories for all of the OpenStack services are defined in
332``stackrc``. Since this file is a part of the DevStack package changes
333to it will probably be overwritten as updates are applied. Every setting
334in ``stackrc`` can be redefined in ``local.conf``.
335
336To change the repository or branch that a particular OpenStack service
337is created from, simply change the value of ``*_REPO`` or ``*_BRANCH``
338corresponding to that service.
339
340After making changes to the repository or branch, if ``RECLONE`` is not
341set in ``localrc`` it may be necessary to remove the corresponding
342directory from ``/opt/stack`` to force git to re-clone the repository.
343
344For example, to pull Nova from a proposed release candidate in the
345primary Nova repository:
346
347::
348
349 NOVA_BRANCH=rc-proposed
350
351To pull Glance from an experimental fork:
352
353::
354
355 GLANCE_BRANCH=try-something-big
356 GLANCE_REPO=https://github.com/mcuser/glance.git
357
358Notes stuff you might need to know
359----------------------------------
360
361Reset the Bridge
362~~~~~~~~~~~~~~~~
363
364How to reset the bridge configuration:
365
366::
367
368 sudo brctl delif br100 eth0.926
369 sudo ip link set dev br100 down
370 sudo brctl delbr br100
371
372Set MySQL Password
373~~~~~~~~~~~~~~~~~~
374
375If you forgot to set the root password you can do this:
376
377::
378
379 mysqladmin -u root -pnova password 'supersecret'