Sean M. Collins | 09e550c | 2014-10-21 11:40:08 -0400 | [diff] [blame^] | 1 | `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 | |
| 9 | Multi-Node Lab: Serious Stuff |
| 10 | ============================= |
| 11 | |
| 12 | Here is OpenStack in a realistic test configuration with multiple |
| 13 | physical servers. |
| 14 | |
| 15 | Prerequisites Linux & Network |
| 16 | ----------------------------- |
| 17 | |
| 18 | Minimal Install |
| 19 | ~~~~~~~~~~~~~~~ |
| 20 | |
| 21 | You need to have a system with a fresh install of Linux. You can |
| 22 | download the `Minimal |
| 23 | CD <https://help.ubuntu.com/community/Installation/MinimalCD>`__ for |
| 24 | Ubuntu releases since DevStack will download & install all the |
| 25 | additional 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>`__ |
| 27 | and |
| 28 | `CentOS/RHEL <http://mirrors.kernel.org/centos/6.5/isos/x86_64/CentOS-6.5-x86_64-netinstall.iso>`__. |
| 29 | |
| 30 | Install a couple of packages to bootstrap configuration: |
| 31 | |
| 32 | :: |
| 33 | |
| 34 | apt-get install -y git sudo || yum install -y git sudo |
| 35 | |
| 36 | Network Configuration |
| 37 | ~~~~~~~~~~~~~~~~~~~~~ |
| 38 | |
| 39 | The first iteration of the lab uses OpenStack's FlatDHCP network |
| 40 | controller so only a single network will be required. It should be on |
| 41 | its own subnet without DHCP; the host IPs and floating IP pool(s) will |
| 42 | come 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 | |
| 48 | Configure 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 | |
| 59 | For 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 | |
| 69 | Installation shake and bake |
| 70 | --------------------------- |
| 71 | |
| 72 | Add the DevStack User |
| 73 | ~~~~~~~~~~~~~~~~~~~~~ |
| 74 | |
| 75 | OpenStack runs as a non-root user that has sudo access to root. There is |
| 76 | nothing special about the name, we'll use ``stack`` here. Every node |
| 77 | must use the same name and preferably uid. If you created a user during |
| 78 | the OS install you can use it and give it sudo privileges below. |
| 79 | Otherwise create the stack user: |
| 80 | |
| 81 | :: |
| 82 | |
| 83 | groupadd stack |
| 84 | useradd -g stack -s /bin/bash -d /opt/stack -m stack |
| 85 | |
| 86 | This user will be making many changes to your system during installation |
| 87 | and operation so it needs to have sudo privileges to root without a |
| 88 | password: |
| 89 | |
| 90 | :: |
| 91 | |
| 92 | echo "stack ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers |
| 93 | |
| 94 | From here on use the ``stack`` user. **Logout** and **login** as the |
| 95 | ``stack`` user. |
| 96 | |
| 97 | Set Up Ssh |
| 98 | ~~~~~~~~~~ |
| 99 | |
| 100 | Set 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 | |
| 107 | Download DevStack |
| 108 | ~~~~~~~~~~~~~~~~~ |
| 109 | |
| 110 | Grab the latest version of DevStack: |
| 111 | |
| 112 | :: |
| 113 | |
| 114 | git clone https://git.openstack.org/openstack-dev/devstack |
| 115 | cd devstack |
| 116 | |
| 117 | Up to this point all of the steps apply to each node in the cluster. |
| 118 | From here on there are some differences between the cluster controller |
| 119 | (aka 'head node') and the compute nodes. |
| 120 | |
| 121 | Configure Cluster Controller |
| 122 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 123 | |
| 124 | The cluster controller runs all OpenStack services. Configure the |
| 125 | cluster 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 | |
| 143 | In the multi-node configuration the first 10 or so IPs in the private |
| 144 | subnet are usually reserved. Add this to ``local.sh`` to have it run |
| 145 | after 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 | |
| 151 | Fire up OpenStack: |
| 152 | |
| 153 | :: |
| 154 | |
| 155 | ./stack.sh |
| 156 | |
| 157 | A stream of activity ensues. When complete you will see a summary of |
| 158 | ``stack.sh``'s work, including the relevant URLs, accounts and passwords |
| 159 | to poke at your shiny new OpenStack. The most recent log file is |
| 160 | available in ``stack.sh.log``. |
| 161 | |
| 162 | Configure Compute Nodes |
| 163 | ~~~~~~~~~~~~~~~~~~~~~~~ |
| 164 | |
| 165 | The compute nodes only run the OpenStack worker services. For additional |
| 166 | machines, 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 | |
| 193 | Fire up OpenStack: |
| 194 | |
| 195 | :: |
| 196 | |
| 197 | ./stack.sh |
| 198 | |
| 199 | A stream of activity ensues. When complete you will see a summary of |
| 200 | ``stack.sh``'s work, including the relevant URLs, accounts and passwords |
| 201 | to poke at your shiny new OpenStack. The most recent log file is |
| 202 | available in ``stack.sh.log``. |
| 203 | |
| 204 | Cleaning Up After DevStack |
| 205 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 206 | |
| 207 | Shutting down OpenStack is now as simple as running the included |
| 208 | ``unstack.sh`` script: |
| 209 | |
| 210 | :: |
| 211 | |
| 212 | ./unstack.sh |
| 213 | |
| 214 | A more aggressive cleanup can be performed using ``clean.sh``. It |
| 215 | removes certain troublesome packages and attempts to leave the system in |
| 216 | a state where changing the database or queue manager can be reliably |
| 217 | performed. |
| 218 | |
| 219 | :: |
| 220 | |
| 221 | ./clean.sh |
| 222 | |
| 223 | Sometimes running instances are not cleaned up. DevStack attempts to do |
| 224 | this 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 | |
| 231 | Options pimp your stack |
| 232 | ----------------------- |
| 233 | |
| 234 | Additional Users |
| 235 | ~~~~~~~~~~~~~~~~ |
| 236 | |
| 237 | DevStack creates two OpenStack users (``admin`` and ``demo``) and two |
| 238 | tenants (also ``admin`` and ``demo``). ``admin`` is exactly what it |
| 239 | sounds like, a privileged administrative account that is a member of |
| 240 | both the ``admin`` and ``demo`` tenants. ``demo`` is a normal user |
| 241 | account that is only a member of the ``demo`` tenant. Creating |
| 242 | additional OpenStack users can be done through the dashboard, sometimes |
| 243 | it is easier to do them in bulk from a script, especially since they get |
| 244 | blown away every time ``stack.sh`` runs. The following steps are ripe |
| 245 | for 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 | |
| 268 | Swift |
| 269 | ~~~~~ |
| 270 | |
| 271 | Swift requires a significant amount of resources and is disabled by |
| 272 | default in DevStack. The support in DevStack is geared toward a minimal |
| 273 | installation but can be used for testing. To implement a true multi-node |
| 274 | test of Swift required more than DevStack provides. Enabling it is as |
| 275 | simple as enabling the ``swift`` service in ``local.conf``: |
| 276 | |
| 277 | :: |
| 278 | |
| 279 | enable_service s-proxy s-object s-container s-account |
| 280 | |
| 281 | Swift 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 |
| 284 | Swift config files are located in ``SWIFT_CONFIG_DIR`` (default |
| 285 | ``/etc/swift``). All of these settings can be overridden in (wait for |
| 286 | it...) ``local.conf``. |
| 287 | |
| 288 | Volumes |
| 289 | ~~~~~~~ |
| 290 | |
| 291 | DevStack will automatically use an existing LVM volume group named |
| 292 | ``stack-volumes`` to store cloud-created volumes. If ``stack-volumes`` |
| 293 | doesn't exist, DevStack will set up a 5Gb loop-mounted file to contain |
| 294 | it. This obviously limits the number and size of volumes that can be |
| 295 | created 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 |
| 299 | Linux's LVM. The name of the volume group can be changed by setting |
| 300 | ``VOLUME_GROUP`` in ``localrc``. ``stack.sh`` deletes all logical |
| 301 | volumes in ``VOLUME_GROUP`` that begin with ``VOLUME_NAME_PREFIX`` as |
| 302 | part of cleaning up from previous runs. It is recommended to not use the |
| 303 | root volume group as ``VOLUME_GROUP``. |
| 304 | |
| 305 | The details of creating the volume group depends on the server hardware |
| 306 | involved but looks something like this: |
| 307 | |
| 308 | :: |
| 309 | |
| 310 | pvcreate /dev/sdc |
| 311 | vgcreate stack-volumes /dev/sdc |
| 312 | |
| 313 | Syslog |
| 314 | ~~~~~~ |
| 315 | |
| 316 | DevStack is capable of using ``rsyslog`` to aggregate logging across the |
| 317 | cluster. 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 |
| 319 | nodes it must be set to the IP of the cluster controller to send syslog |
| 320 | output 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 | |
| 327 | Using Alternate Repositories/Branches |
| 328 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 329 | |
| 330 | The git repositories for all of the OpenStack services are defined in |
| 331 | ``stackrc``. Since this file is a part of the DevStack package changes |
| 332 | to it will probably be overwritten as updates are applied. Every setting |
| 333 | in ``stackrc`` can be redefined in ``local.conf``. |
| 334 | |
| 335 | To change the repository or branch that a particular OpenStack service |
| 336 | is created from, simply change the value of ``*_REPO`` or ``*_BRANCH`` |
| 337 | corresponding to that service. |
| 338 | |
| 339 | After making changes to the repository or branch, if ``RECLONE`` is not |
| 340 | set in ``localrc`` it may be necessary to remove the corresponding |
| 341 | directory from ``/opt/stack`` to force git to re-clone the repository. |
| 342 | |
| 343 | For example, to pull Nova from a proposed release candidate in the |
| 344 | primary Nova repository: |
| 345 | |
| 346 | :: |
| 347 | |
| 348 | NOVA_BRANCH=rc-proposed |
| 349 | |
| 350 | To 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 | |
| 357 | Notes stuff you might need to know |
| 358 | ---------------------------------- |
| 359 | |
| 360 | Reset the Bridge |
| 361 | ~~~~~~~~~~~~~~~~ |
| 362 | |
| 363 | How 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 | |
| 371 | Set MySQL Password |
| 372 | ~~~~~~~~~~~~~~~~~~ |
| 373 | |
| 374 | If 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>`__ |