18
18
Installing Nova on Multiple Servers
19
20
===================================
21
22
When you move beyond evaluating the technology and into building an actual
22
23
production environment, you will need to know how to configure your datacenter
23
24
and how to deploy components across your clusters. This guide should help you
24
25
through that process.
26
27
You can install multiple nodes to increase performance and availability of the OpenStack Compute installation.
28
29
This setup is based on an Ubuntu Lucid 10.04 installation with the latest updates. Most of this works around issues that need to be resolved in the installation and configuration scripts as of October 18th 2010. It also needs to eventually be generalized, but the intent here is to get the multi-node configuration bootstrapped so folks can move forward.
31
32
Requirements for a multi-node installation
32
33
------------------------------------------
34
35
* You need a real database, compatible with SQLAlchemy (mysql, postgresql) There's not a specific reason to choose one over another, it basically depends what you know. MySQL is easier to do High Availability (HA) with, but people may already know Postgres. We should document both configurations, though.
35
36
* For a recommended HA setup, consider a MySQL master/slave replication, with as many slaves as you like, and probably a heartbeat to kick one of the slaves into being a master if it dies.
36
37
* For performance optimization, split reads and writes to the database. MySQL proxy is the easiest way to make this work if running MySQL.
40
------------------------------------
41
42
* Networking is configured between/through the physical machines on a single subnet.
42
* Installation and execution are both performed by root user.
46
Step 1 Use apt-get to get the latest code
43
* Installation and execution are both performed by ROOT user.
46
Step 1 - Use apt-get to get the latest code
47
47
-----------------------------------------
49
1. Setup Nova PPA with https://launchpad.net/~nova-core/+archive/ppa.
53
sudo apt-get install python-software-properties
54
sudo add-apt-repository ppa:nova-core/ppa
62
3. Install nova-pkgs (dependencies should be automatically installed).
66
sudo apt-get install python-greenlet
67
sudo apt-get install nova-common nova-doc python-nova nova-api nova-network nova-objectstore nova-scheduler
69
It is highly likely that there will be errors when the nova services come up since they are not yet configured. Don't worry, you're only at step 1!
71
Step 2 Setup configuration file (installed in /etc/nova)
49
1. Setup Nova PPA with https://launchpad.net/~nova-core/+archive/trunk. The ‘python-software-properties’ package is a pre-requisite for setting up the nova package repo:
53
apt-get -y install python-software-properties
54
add-apt-repository ppa:nova-core/trunk
62
3. Install nova-packages (dependencies should be automatically installed).
66
apt-get -y install bzr nova-common nova-doc python-mysqldb python-greenlet python-nova nova-api nova-network nova-objectstore nova-scheduler nova-compute unzip vim euca2ools rabbitmq-server dnsmasq open-iscsi kpartx kvm gawk iptables ebtables user-mode-linux kvm libvirt-bin screen iscsitarget euca2ools vlan curl python-twisted python-sqlalchemy python-mox python-greenlet python-carrot python-daemon python-eventlet python-gflags python-libvirt python-libxml2 python-routes
68
Step 2 – Setting up nova.conf (installed in /etc/nova)
72
69
---------------------------------------------------------
74
Note: CC_ADDR=<the external IP address of your cloud controller>
76
Nova development has consolidated all .conf files to nova.conf as of November 2010. References to specific .conf files may be ignored.
78
#. These need to be defined in the nova.conf configuration file::
80
--sql_connection=mysql://root:nova@$CC_ADDR/nova # location of nova sql db
81
--s3_host=$CC_ADDR # This is where nova is hosting the objectstore service, which
82
# will contain the VM images and buckets
83
--rabbit_host=$CC_ADDR # This is where the rabbit AMQP messaging service is hosted
84
--cc_host=$CC_ADDR # This is where the the nova-api service lives
85
--verbose # Optional but very helpful during initial setup
86
--ec2_url=http://$CC_ADDR:8773/services/Cloud
87
--network_manager=nova.network.manager.FlatManager # simple, no-vlan networking type
89
--fixed_range=<network/prefix> # ip network to use for VM guests, ex 192.168.2.64/26
90
--network_size=<# of addrs> # number of ip addrs to use for VM guests, ex 64
92
#. Create a nova group::
96
The Nova config file should have its owner set to root:nova, and mode set to 0640, since they contain your MySQL server's root password.
103
Step 3 Setup the sql db
70
1. Nova development has consolidated all config files to nova.conf as of November 2010. There is a default set of options that are already configured in nova.conf:
75
--dhcpbridge_flagfile=/etc/nova/nova.conf
76
--dhcpbridge=/usr/bin/nova-dhcpbridge
77
--logdir=/var/log/nova
78
--state_path=/var/lib/nova
80
The following items ALSO need to be defined in /etc/nova/nova.conf. I’ve added some explanation of the variables, as comments CANNOT be in nova.conf. There seems to be an issue with nova-manage not processing the comments/whitespace correctly:
82
--sql_connection ### Location of Nova SQL DB
84
--s3_host ### This is where Nova is hosting the objectstore service, which will contain the VM images and buckets
86
--rabbit_host ### This is where the rabbit AMQP messaging service is hosted
88
--cc_host ### This is where the the nova-api service lives
90
--verbose ### Optional but very helpful during initial setup
92
--ec2_url ### The location to interface nova-api
94
--network_manager ### Many options here, discussed below. This is how your controller will communicate with additional Nova nodes and VMs:
96
nova.network.manager.FlatManager # Simple, no-vlan networking type
97
nova.network.manager. FlatDHCPManager # Flat networking with DHCP
98
nova.network.manager.VlanManager # Vlan networking with DHCP – /DEFAULT/ if no network manager is defined in nova.conf
100
--fixed_range=<network/prefix> ### This will be the IP network that ALL the projects for future VM guests will reside on. E.g. 192.168.0.0/12
102
--network_size=<# of addrs> ### This is the total number of IP Addrs to use for VM guests, of all projects. E.g. 5000
104
The following code can be cut and paste, and edited to your setup:
106
## Note: CC_ADDR=<the external IP address of your cloud controller>##
107
## Detailed explanation of the following entries are right above this ##
111
--sql_connection=mysql://root:nova@<CC_ADDR>/nova
113
--rabbit_host=<CC_ADDR>
116
--ec2_url=http://<CC_ADDR>:8773/services/Cloud
117
--network_manager=nova.network.manager.VlanManager
118
--fixed_range=<network/prefix>
119
--network_size=<# of addrs>
121
2. Create a “nova” group, and set permissions:
127
The Nova config file should have its owner set to root:nova, and mode set to 0644, since they contain your MySQL server's root password.
131
chown -R root:nova /etc/nova
132
chmod 644 /etc/nova/nova.conf
134
Step 3 - Setup the SQL DB (MySQL for this setup)
104
135
-----------------------
106
1. First you 'preseed' (using the Quick Start method :doc:`../quickstart`). Run this as root.
110
sudo apt-get install bzr git-core
112
export MYSQL_PASS=nova
117
cat <<MYSQL_PRESEED | debconf-set-selections
118
mysql-server-5.1 mysql-server/root_password password $MYSQL_PASS
119
mysql-server-5.1 mysql-server/root_password_again password $MYSQL_PASS
120
mysql-server-5.1 mysql-server/start_on_boot boolean true
127
sudo apt-get install -y mysql-server
129
4. Edit /etc/mysql/my.cnf and set this line: bind-address=0.0.0.0 and then sighup or restart mysql
135
mysql -uroot -pnova -e 'CREATE DATABASE nova;'
138
6. Update the db to include user 'root'@'%'
142
mysql -u root -p nova
143
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
144
SET PASSWORD FOR 'root'@'%' = PASSWORD('nova');
146
7. Branch and install Nova
153
export MYSQL_PASS=nova
154
git clone https://github.com/vishvananda/novascript.git
160
Step 4 Setup Nova environment
161
-----------------------------
165
/usr/bin/python /usr/bin/nova-manage user admin <user_name>
166
/usr/bin/python /usr/bin/nova-manage project create <project_name> <user_name>
167
/usr/bin/python /usr/bin/nova-manage project create network
169
Note: The nova-manage service assumes that the first IP address is your network (like 192.168.0.0), that the 2nd IP is your gateway (192.168.0.1), and that the broadcast is the very last IP in the range you defined (192.168.0.255). If this is not the case you will need to manually edit the sql db 'networks' table.o.
171
On running this command, entries are made in the 'networks' and 'fixed_ips' table. 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.
173
More networking details to create a network bridge for flat network
174
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
176
Nova defaults to a bridge device named 'br100'. This needs to be created and somehow integrated into YOUR network. In my case, I wanted to keep things as simple as possible and have all the vm guests on the same network as the vm hosts (the compute nodes). Thus, I set the compute node's external IP address to be on the bridge and added eth0 to that bridge. To do this, edit your network interfaces config to look like the following::
137
1. First you 'preseed' to bypass all the installation prompts
142
cat <<MYSQL_PRESEED | debconf-set-selections
143
mysql-server-5.1 mysql-server/root_password password $MYSQL_PASS
144
mysql-server-5.1 mysql-server/root_password_again password $MYSQL_PASS
145
mysql-server-5.1 mysql-server/start_on_boot boolean true
152
apt-get install -y mysql-server
154
3. Edit /etc/mysql/my.cnf to change ‘bind-address’ from localhost to any:
158
sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf
159
service mysql restart
161
3. Network Configuration
163
If you use FlatManager (as opposed to VlanManager that we set) as your network manager, there are some additional networking changes you’ll have to make to ensure connectivity between your nodes and VMs. If you chose VlanManager or FlatDHCP, you may skip this section, as it’s set up for you automatically.
165
Nova defaults to a bridge device named 'br100'. This needs to be created and somehow integrated into YOUR network. To keep things as simple as possible, have all the VM guests on the same network as the VM hosts (the compute nodes). To do so, set the compute node's external IP address to be on the bridge and add eth0 to that bridge. To do this, edit your network interfaces config to look like the following
178
169
< begin /etc/network/interfaces >
179
170
# The loopback network interface
181
172
iface lo inet loopback
183
174
# Networking for NOVA
186
177
iface br100 inet dhcp
187
178
bridge_ports eth0
191
182
< end /etc/network/interfaces >
194
185
Next, restart networking to apply the changes::
196
sudo /etc/init.d/networking restart
198
Step 5: Create nova certs.
187
sudo /etc/init.d/networking restart
189
4. MySQL DB configuration:
191
Create NOVA database:
195
mysql -uroot -p$MYSQL_PASS -e 'CREATE DATABASE nova;'
198
Update the DB to include user 'root'@'%' with super user privileges
202
mysql -uroot -p$MYSQL_PASS -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;"
204
Set mySQL root password
208
mysql -uroot -p$MYSQL_PASS -e "SET PASSWORD FOR 'root'@'%' = PASSWORD('$MYSQL_PASS');"
211
Step 4 - Setup Nova environment
212
-----------------------------
216
/usr/bin/python /usr/bin/nova-manage user admin <user_name>
217
/usr/bin/python /usr/bin/nova-manage project create <project_name> <user_name>
218
/usr/bin/python /usr/bin/nova-manage network create <project-network> <number-of-networks-in-project> <IPs in project>
220
Here is an example of what this looks like with real data:
222
/usr/bin/python /usr/bin/nova-manage user admin dub
223
/usr/bin/python /usr/bin/nova-manage project create dubproject dub
224
/usr/bin/python /usr/bin/nova-manage network create 192.168.0.0/24 1 255
226
(I chose a /24 since that falls inside my /12 range I set in ‘fixed-range’ in nova.conf. Currently, there can only be one network, and I am using the max IP’s available in a /24. You can choose to use any valid amount that you would like.)
228
Note: The nova-manage service assumes that the first IP address is your network (like 192.168.0.0), that the 2nd IP is your gateway (192.168.0.1), and that the broadcast is the very last IP in the range you defined (192.168.0.255). If this is not the case you will need to manually edit the sql db 'networks' table.o.
230
On running this command, entries are made in the 'networks' and 'fixed_ips' table. 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. This is ONLY necessary if you chose FlatManager as your network type. More information can be found at the end of this document discussing setting up the bridge device.
233
Step 5 - Create Nova certs
199
234
--------------------------
201
Generate the certs as a zip file::
204
sudo /usr/bin/python /usr/bin/nova-manage project zip admin admin creds/nova.zip
206
you can get the rc file more easily with::
208
sudo /usr/bin/python /usr/bin/nova-manage project env admin admin creds/novarc
210
unzip them in your home directory, and add them to your environment::
213
echo ". creds/novarc" >> ~/.bashrc
216
Step 6 Restart all relevant services
217
------------------------------------
221
sudo /etc/init.d/libvirt-bin restart
223
Restart relevant nova services::
225
sudo /etc/init.d/nova-compute restart
226
sudo /etc/init.d/nova-volume restart
229
.. todo:: do we still need the content below?
231
Bare-metal Provisioning Notes
232
-----------------------------
234
To install the base operating system you can use PXE booting.
239
A single machine in your cluster can act as one or more of the following types
250
Other supporting services
253
* Database (optional)
254
* Authentication database (optional)
260
* Cloudadmin User Creation
262
Deployment Technologies
263
-----------------------
265
Once you have machines with a base operating system installation, you can deploy
266
code and configuration with your favorite tools to specify which machines in
267
your cluster have which roles:
236
1. Generate the certs as a zip file. These are the certs you will use to launch instances, bundle images, and all the other assorted api functions:
241
/usr/bin/python /usr/bin/nova-manage project zipfile $NOVA_PROJECT $NOVA_PROJECT_USER /root/creds/novacreds.zip
243
2. Unzip them in your home directory, and add them to your environment:
247
unzip /root/creds/novacreds.zip -d /root/creds/
248
cat /root/creds/novarc >> ~/.bashrc
251
Step 6 - Restart all relevant services
252
------------------------------------
253
Restart all six services in total, just to cover the entire spectrum:
257
libvirtd restart; service nova-network restart; service nova-compute restart; service nova-api restart; service nova-objectstore restart; service nova-scheduler restart
259
Step 7 - Closing steps, and cleaning up:
260
------------------------------------
262
One of the most commonly missed configuration areas is not allowing the proper access to VMs. Use the 'euca-authorize' command to enable access. Below, you will find the commands to allow 'ping' and 'ssh' to your VMs:
266
euca-authorize -P icmp -t -1:-1 default
267
euca-authorize -P tcp -p 22 default
269
Another common issue is you cannot ping or SSH your instances after issusing the 'euca-authorize' commands. Something to look at is the amount of 'dnsmasq' processes that are running. If you have a running instance, check to see that TWO 'dnsmasq' processes are running. If not, perform the following:
274
service nova-network restart
276
Step 8 – Testing the installation
277
------------------------------------
279
You can then use `euca2ools` to test some items:
284
euca-describe-instances
286
If you have issues with the API key, you may need to re-source your creds file:
292
If you don’t get any immediate errors, you’re successfully making calls to your cloud!
294
The next thing you are going to need is an image to test. There will soon be an update on how to capture an image and use it as a bootable AMI so you can ping, ssh, show instances spinning up, etc.
296
Enjoy your new private cloud, and play responsibly!