From d5127abcb0fd57b71d67670b29c914e1fa1cead2 Mon Sep 17 00:00:00 2001 From: razique Date: Sun, 23 Oct 2011 19:09:09 +0200 Subject: [PATCH] Update Openstack Tutorials : # Fixes bug 779812 # Update formatting Change-Id: Ic5dc7ba166fa67e34e765d3c78df9c61818f1407 --- .../computetutorials.xml | 88 ++++++++++++------- 1 file changed, 56 insertions(+), 32 deletions(-) diff --git a/doc/src/docbkx/openstack-compute-admin/computetutorials.xml b/doc/src/docbkx/openstack-compute-admin/computetutorials.xml index 2cb718e1921..257878bfbfd 100644 --- a/doc/src/docbkx/openstack-compute-admin/computetutorials.xml +++ b/doc/src/docbkx/openstack-compute-admin/computetutorials.xml @@ -68,34 +68,47 @@ Here is an example nova.conf for a single node installation of OpenStack Compute. - # Sets the network type + + # Sets the network type --network_manager=nova.network.manager.FlatManager + # Sets whether to use IPV6 addresses --use_ipv6=false + # DHCP bridge information --dhcpbridge_flagfile=/etc/nova/nova.conf --dhcpbridge=nova-dhcpbridge --flat_network_bridge=br100 --logdir=/var/log/nova + # Top-level directory for maintaining nova's state --state_path=/var/lib/nova + # These indicate where nova-api services are installed --s3_host=184.106.239.134 --rabbit_host=184.106.239.134 --ec2_api=184.106.239.134 --ec2_url=http://184.106.239.134:8773/services/Cloud + # Block of IP addresses that are fixed IPs --fixed_range=192.168.0.0/12 + # Number of addresses in each private subnet --network_size=24 + # FlatDHCP bridges to this interface if set, be very careful setting it on an interface that does not already have an IP associated with it --flat_interface=eth0 + # Public IP of the server running nova-network, when instances without a floating IP hit the internet, traffic is snatted to this IP --routing_source_ip=184.106.239.134 + # Not required, but handy for debugging --verbose + # Tells nova where to connect for database ---sql_connection=mysql://nova:notnova@184.106.239.134/nova +--sql_connection=mysql://nova:notnova@184.106.239.134/nova + + Now that we know the networking configuration, let's set up the network for our project. With Flat DHCP, the host running nova-network acts as the gateway to the virtual nodes, so ideally this will have a public IP address for our @@ -119,20 +132,22 @@ table.o but that scenario shouldn't happen for this tutorial. Run this command as root or sudo: - nova-manage network create public 192.168.3.0/12 1 256 + nova-manage network create public 192.168.3.0/12 1 256 On running this command, entries are made in the ‘networks’ and ‘fixed_ips’ table in the nova database. However, one of the networks listed in the ‘networks’ table needs to be marked as bridge in order for the code to know that a bridge exists. The Network is marked as bridged automatically based on the type of network manager selected. - Next you want to integrate this network bridge, named br100, into your - network. A bridge connects two Ethernet segments together. + Next you want to integrate this network bridge, named br100, into your network. A bridge connects two Ethernet + segments together. + Ensure the Database is Up-to-date The first command you run using nova-manage is one called db sync, which ensures that your database is updated. You must run this as root. - nova-manage db sync + nova-manage db sync Creating a user @@ -147,7 +162,7 @@ commands are given an access and secret key through the project itself. Let's create a user that has the access we want for this project. To add an admin user named cloudypants, use: - nova-manage user admin cloudypants + nova-manage user admin cloudypants Creating a project and related credentials @@ -164,21 +179,22 @@ the other assorted API and command-line functions. First, we'll create a directory that'll house these credentials, in this case in the root directory. You need to sudo here or save this to your own directory - with 'mkdir -p ~/creds' so that the credentials match the user and are stored in + with mkdir -p ~/creds so that the credentials match the user and are stored in their home. - mkdir –p /root/creds + mkdir –p /root/creds Now, run nova-manage to create a zip file for your project called wpscales with the user cloudypants (the admin user we created previously). - sudo nova-manage project zipfile wpscales cloudypants /root/creds/novacreds.zip + sudo nova-manage project zipfile wpscales cloudypants /root/creds/novacreds.zip Next, you can unzip novacreds.zip in your home directory, and add these credentials to your environment. - unzip /root/creds/novacreds.zip -d /root/creds/ + unzip /root/creds/novacreds.zip -d /root/creds/ Sending that information and sourcing it as part of your .bashrc file remembers those credentials for next time. - cat /root/creds/novarc >> ~/.bashrc -source ~/.bashrc + cat /root/creds/novarc >> ~/.bashrc +source ~/.bashrc Okay, you've created the basic scaffolding for your cloud so that you can get some images and run instances. Onward to Part II! +
@@ -195,20 +211,23 @@ source ~/.bashrc publish it. Here are the commands to get your virtual image. Be aware that the download of the compressed file may take a few minutes. - image="ubuntu1010-UEC-localuser-image.tar.gz" + image="ubuntu1010-UEC-localuser-image.tar.gz" wget http://c0179148.cdn1.cloudfiles.rackspacecloud.com/ ubuntu1010-UEC-localuser-image.tar.gz -uec-publish-tarball $image wpbucket x86_64 - What you'll get in return from this command is three references: emi, eri and eki. - These are acronyms - emi stands for eucalyptus machine image, eri stands for - eucalyptus ramdisk image, and eki stands for eucalyptus kernal image. Amazon has - similar references for their images - ami, ari, and aki. +uec-publish-tarball $image wpbucket amd64 + + What you'll get in return from this command is three references: emi, eri and + eki. These are acronyms - emi stands for + eucalyptus machine image, eri stands for eucalyptus ramdisk image, and eki stands + for eucalyptus kernal image. Amazon has similar references for their images - ami, + ari, and aki. You need to use the emi value when you run the instance. These look something like “ami-zqkyh9th″ - basically a unique identifier. Okay, now that you have your image and it's published, realize that it has to be decompressed before you can launch an image from it. We can realize what state an image is in using the 'euca-describe-instances' command. Basically, run: - euca-describe-instances + euca-describe-instances and look for the state in the text that returns. You can also use euca-describe-images to ensure the image is untarred. Wait until the state shows "available" so that you know the instances is ready to roll. @@ -218,45 +237,50 @@ uec-publish-tarball $image wpbucket x86_64 Once that state is "available" you can enter this command, which will use your credentials to start up the instance with the identifier you got by publishing the image. - emi=ami-zqkyh9th -euca-run-instances $emi -k mykey -t m1.tiny + +emi=ami-zqkyh9th +euca-run-instances $emi -k mykey -t m1.tiny + Now you can look at the state of the running instances by using euca-describe-instances again. The instance will go from “launching” to “running” in a short time, and you should be able to connect via SSH. Look at the IP addresses so that you can connect to the instance once it starts running. Basically launch a terminal window from any computer, and enter: - ssh -i mykey ubuntu@10.127.35.119 + ssh -i mykey ubuntu@10.127.35.119 On this particular image, the 'ubuntu' user has been set up as part of the sudoers group, so you can escalate to 'root' via the following command: - sudo -i + sudo -i + On the first VM, install WordPress Now, you can install WordPress. Create and then switch to a blog directory: - mkdir blog -cd blog + mkdir blog +cd blog Download WordPress directly to you by using wget: - wget http://wordpress.org/latest.tar.gz + wget http://wordpress.org/latest.tar.gz Then unzip the package using: - tar -xzvf latest.tar.gz + tar -xzvf latest.tar.gz The WordPress package will extract into a folder called wordpress in the same directory that you downloaded latest.tar.gz. Next, enter "exit" and disconnect from this SSH session. + On a second VM, install MySQL Next, SSH into another virtual machine and install MySQL and use these instructions to install the WordPress database using the MySQL Client from a - command line: Using the MySQL Client - Wordpress Codex. + command line: Using the MySQL Client - Wordpress Codex. + + On a third VM, install MemcacheMemcache makes Wordpress database reads and writers more efficient, so your virtual servers can go to work for you in a scalable manner. SSH to a third virtual machine and install Memcache: - apt-get install memcached + apt-get install memcached + Configure the Wordpress Memcache pluginFrom a web browser, point to the IP address of your Wordpress server. Download and install the Memcache Plugin. Enter the IP address of your Memcache server.
Running a Blog in the CloudThat's it! You're now running your blog on a cloud server in OpenStack Compute, and you've scaled it horizontally using additional virtual images to run the database and Memcache. Now if your blog gets a big boost of comments, you'll be ready for the extra reads-and-writes to the database.