BKJIA exclusive Article] OpenStack is a set of platform software used to manage virtual machines. Instead of a single software, it integrates many components for collaboration. Simply put, for example, there are ten servers. In the case of VMware, we install esx or esxi on each server, and then install a vcenter, in the vcenter management interface, you can add the esx of ten servers to the vcenter by adding domain names or ip addresses. Similarly, Red Hat also has programs that manage virtual machines such as virsh.
Read more: install and configure OpenStack Nova on Ubuntu
Here, I will not introduce the management software of other cloud platforms, but will introduce how to use OpenStack from a technical perspective. To serve as a production environment, you need to consider more, such as architecture, network topology, storage method, and Node Distribution.
In this article, I will introduce how to use ec2 compatibility certification. All components are installed on one controller.
KeywordsDefinition
Control End: a management system similar to vcenter.
Node: similar to the server where esx is installed.
Nova components: these components are installed on nodes, allowing the nodes to operate on virtual machines or storage on the nodes according to control commands.
Glance component: used to manage images.
Environment preparation
Ubuntu 11.10, dual server Nic
Procedure
After installing the basic operating system
$ Sudo apt-get update $ sudo apt-get upgrade $ sudo apt-get install bridge-utils # install bridge Software
Configure Network Interfaces
Here, my architecture is that eth0 is connected to the Internet, that is, we can access the network port. Eth1 implements a bridge and connects to the node through a switch. The advantage is that the traffic on the internal nodes and controllers goes through the br100 switch without affecting the network used by applications on the virtual machine.
$ sudo vi /etc/network/interfacesauto eth0
iface eth0 inet static
address 192.168.200.21
netmask 255.255.255.0
network 192.168.200.0
broadcast 192.168.200.255
gateway 192.168.200.10
auto br100
iface br100 inet static
bridge_ports eth1
bridge_stp off
bridge_maxwait 0
bridge_fd 0
address 10.200.200.2
netmask 255.255.255.0
$ sudo /etc/init.d/networking restart
Prepare for the initial stage and install components such as nova and glance.
$ Sudo apt-get install-y rabbitmq-server # install MQ Message Components $ sudo apt-get install-y python-greenlet python-mysqldb # install Python dependencies
Next, install various nova components and dependencies.
$ sudo apt-get install nova-volume nova-vncproxy nova-api nova-ajax-console-proxy$ sudo apt-get install nova-doc nova-scheduler nova-objectstore$ sudo apt-get install nova-network nova-compute$ sudo apt-get install glance
Install euca2ools and unzip
$ sudo apt-get install -y euca2ools unzip
Next we will install the database. Here I chose MySQL, but I personally think PostgreSQL is better.
$ Sudo su-# MYSQL_PASS = nova set mysql password and nova Database password # cat <MYSQL_PRESEED | debconf-set-selections> mysql-server-5.1 mysql-server/root_password password $ MYSQL_PASS> mysql-server-5.1 mysql-server/root_password_again password $ MYSQL_PASS> mysql-server-5.1 mysql-server/start_on_boot boolean true> MYSQL_PRESEED # apt-get install-y mysql-server # exit to exit the root environment $ sudo sed-I' s/127.0.0.1/0.0.0.0/G'/etc/mysql/my. cnf modify my. cnf configuration file $ sudo service mysql restart $ MYSQL_PASS = nova set the password variable again in the normal user environment $ NOVA_PASS = notnova this is the password of the nova database $ sudo mysql-uroot-p $ MYSQL_PASS-e 'create DATABASE nova; 'create a database named nova. We recommend that you use the name of nova for new users. If you change the name here, in the configuration file of nova, you also need to change $ sudo mysql-uroot-p $ MYSQL_PASS-e "grant all privileges on *. * TO 'nova '@' % 'with grant option; "$ sudo mysql-uroot-p $ MYSQL_PASS-e" set password for 'nova '@' % '= PASSWORD (' $ NOVA_PASS ');"
Now, the installation of nova and glance is complete, followed by configuration.
Nova Configuration
$ Sudo vi/etc/nova. conf -- dhcpbridge_flagfile =/etc/nova. conf -- dhcpbridge =/usr/bin/nova-dhcpbridge -- logdir =/var/log/nova -- state_path =/data/openstack/nova here/data/openstack/nova is A new volume and directory, make sure you have this and belong to the nova user, alternatively, you can use its default settings -- instances_path =/data/openstack/nova/instances to modify the default instances location -- lock_path =/var/lock/nova -- force_dhcp_release = True -- use_deprecated_auth -- iscsi_helper = tgtadm -- verbose -- scheduler_driver = nova. scheduler. simple. simpleScheduler -- network_manager = nova. network. manager. flatDHCPManager -- my_ip = 10.200.200.2 This Is My Intranet IP Address -- public_inter> -- SQL _connection = mysql: // nova: notnova @ localhost/the database just created by nova -- lib1__type = kvm -- api_paste_config =/etc/nova/api-paste.ini -- image_service = nova. image. glance. glanceImageService -- ec2_dmz_host = 192.168.200.21 -- ec2_url = http: // 192.168.200.21: 8773/services/Cloud -- rabbit_host = localhost -- glance_api_servers = 10.200.200.2: 9292 -- flat_network_bridge = br100 -- flat_inter> -- flat_network_dhcp_start = 10.200.200.51 indicates that the allocation from instances starts from 51, but it seems that this option does not work -- fixed_range = 10.200.200.0/24 this option specifies the instances network segment -- flat_injected = False -- multi_host = 1 use multi_host, that is, you can also use the nova-network -- libvirt_use_virtio_for_bridges Nic mode for instances on the node.
Then there is glance:
$ sudo vi /etc/glance/glance-api.conf
Modify the filesystem_store_datadir parameter to specify the directory where you want to store images. Of course, the owner must also be changed to the glance user.
$ sudo vi /etc/glance/glance-registry.conf
You can modify the SQL _connection parameter to specify your database.
If you want to modify and use the database in mysql, make sure that a corresponding database is created in mysql.
sql_connection = mysql://nova:notnova@localhost/glance
This is my configuration. I created a glance database in mysql.
$ sudo chown -R root:nova /etc/nova
Change the owner of/etc/nova
$ sudo chmod 640 /etc/nova/nova.conf
Restart various services
$ sudo restart libvirt-bin$ sudo restart nova-network$ sudo restart nova-compute$ sudo restart nova-api$ sudo restart nova-objectstore$ sudo restart nova-scheduler$ sudo restart glance-registry$ sudo restart glance-api
Note: We have not set up nova-volume here because although we have installed volume, volume needs to be used by a separate vg. We have not configured volume yet, so we cannot afford it.
In this case, the network service and compute may not work properly.
Next, we will configure the running environment of nova.
$ sudo nova-manage db syncnova-manage user admin <user_name>
Here we can create a user, such
$ sudo nova-manage user admin test
After the creation is successful, the following output is returned:
export EC2_ACCESS_KEY=d6aa7747-4324-4abc-9604-4f7d6a2f8f3fexport EC2_SECRET_KEY=2b204b75-da2d-47b8-ba7a-611d71f0ecbf
nova-manage project create <project_name> <user_name>
Create a project that belongs to the user we just created, for example:
$ sudo nova-manage project create test-proj test
nova-manage network create --help
Create an instance's network, such:
$ sudo nova-manage network create --label=test-net --fixed_range_v4=10.200.200.0/24 --num_network=1 --network_size=256
Restart the failed service
$ sudo start nova-network$ sudo start nova-compute$ sudo start nova-scheduler
How are you doing.
In addition, when starting each service, you 'd better check the log, such as sudo tail-f/var/log/nova-network, to check whether an error is reported, you can also use ps aux | grep [n] ova-network to check whether the service is enabled. If the service fails, check the cause. After modification, use sudo start instead of sudo restart.
Okay. In this way, the computing environment is deployed. We can use the command to check the status:
$ sudo nova-manage service list$ sudo nova-manage network list
So.
Next, create a certificate so that we can use the euca tool.
$ cd$ mkdir creds$ sudo nova-manage project zipfile test-proj test creds/novacreds.zip$ unzip creds/novacreds.zip -d creds/$ source creds/novarc
Note that every time you log on to the shell again, you need to source this authentication file to use euca. Of course, you can also set the content of novarc> to your user profile file or bashrc
OK. Let's take a look at the tool.
$ euca-describe-availability-zones verboseVAILABILITYZONE nova availableAVAILABILITYZONE |- nova-testAVAILABILITYZONE | |- nova-network enabled :-) 2011-10-17 04:45:44AVAILABILITYZONE | |- nova-compute enabled :-) 2011-10-17 04:45:45AVAILABILITYZONE | |- nova-scheduler enabled :-) 2011-10-17 04:45:45
So far, the service is successfully enabled. Use ps aux | grep nova to check whether the service is enabled, you need to observe the log files of each service in the/var/log/nova/directory in detail to obtain further information.
Next, we can use kvm to create an image.
$ sudo apt-get install kvm-pxe
Install this. Otherwise, a warning will be reported when you run kvm.
$ kvm-img create -f raw server.img 5G$ sudo kvm -m 1024 -cdrom rhel5.iso -drive file=server.img,if=virtio,index=0 -boot d -net nic -net user -nographic -vnc :0
Here we use the RHEL 5 iso. After running this command, we can use vnc to connect.
Connect to the server on your local machine: ssvncviewer 192.168.200.21: 0
Open vnc and you will see the installation interface.
After installation, write the following section to the beginning of/etc/rc. local of the rhel image:
depmod -amodprobe acpiphp# simple attempt to get the user ssh key using the meta-data servicemkdir -p /root/.sshecho >> /root/.ssh/authorized_keyscurl -m 10 -s http://169.254.169.254/latest/meta-data/public-keys/0/openssh-key | grep 'ssh-rsa' >> /root/.ssh/authorized_keysecho "AUTHORIZED_KEYS:"echo "************************"cat /root/.ssh/authorized_keysecho "************************"
Save and exit, so that the image is ready.
Use glance to upload images
$ glance --verbose add name="rhel5" disk_format=raw is_public=true < server.img
At the same time, you should observe the logs of/var/log/glance/registry and api. Use
$ glance index
Check the image list.
Start your instance
$ euca-describe-images
View the available image. The output is similar to the following:
IMAGE ami-00000003 server.img
Remember to ami-000000003 this image number here.
$ euca-run-instances -t m1.tiny ami-00000003
Start the instance of the ami-00000003 image. -T indicates the instance type. The type specifies information such as cpu, memory, and disk size.
Observe/var/log/nova/nova-api.log nova-scheduler.log, nova-compute, nova-network.log output information, and you can also use vnc to connect serverip: 0 to view the instance console.
Run $ euca-describe-instances to view your current instance status. The first time you start the instance, it will be slow because you need to copy the image from glance to the instance directory under nova.
Due to the rapid development of nova, diablo's release version can meet some daily requirements. However, the developed version of nova can better combine keystone, novaclient, dashboard, and other projects to improve OpenStack. If you are interested, you can use the repo Installation Method in the production environment to test the development version in the testing environment. I personally use the development version installed by git in the production environment, so I will see it in the form of development versions for more comprehensive integration in the future. Of course, there will be more troubles when using the development version, but there will also be more fun and hands-on practices, so as to further understand the working principles and mechanisms.
Author profile: livemoongtalk: mwjpiero@gmail.com), small SA, pay attention to mac, BSD, openstack, open source technology, webos. Motto.
Update: You can see where you want to view the actual application. For more information, see the article "how to get started with OpenStack with actual application of the company". Iso downloading is not provided in this Article. Please bring your own ~