开始安装compute-1、compute-2、compute-3、compute-4,以compute-1为例进行讲解。在计算节点上仅需要运行nova-compute、nova-network服务
1 安装网桥、iscis相关软件
apt-get -y install open-iscsi open-iscsi-utils bridge-utils
2 修改网卡配置:/etc/network/interfaces
auto lo
iface lo inet loopback
auto br100
iface br100 inet static
address 10.1.6.142
netmask 255.255.255.0
gateway 10.1.6.254
dns-nameservers 10.1.1.2
bridge_ports em1
bridge_hello 2
bridge_maxage 12
bridge_fd 0
bridge_stp off
3 重启网卡,使网桥配置生效
/etc/init.d/networking restart
4 计算节点需要和控制节点进行时间同步,安装ntp服务(还有其他方案)
apt-get install -y ntp
如果不安装ntp服务,则需要在计算节点执行如下命令和控制节点同步时间
ntpdate 10.1.6.186
5
修改/etc/ntp.conf,在server ntp.ubuntu.com下添加如下内容:
#server ntp.ubuntu.com
server 10.1.6.186
6 重启ntp服务
/etc/init.d/ntp restart
7 安装iscis客户端
apt-get install -y open-iscsi open-iscsi-utils
8 安装计算节点相关服务
apt-get install -y nova-api nova-common nova-compute nova-compute-kvm nova-network \
python-nova python-novaclient python-keystone python-keystoneclient
9 修改nova的/etc/nova/api-paste.ini文件
#admin_tenant_name = %SERVICE_TENANT_NAME%
#admin_user = %SERVICE_USER%
#admin_password = %SERVICE_PASSWORD%
admin_tenant_name = service
admin_user = nova
admin_password = password
10 修改nova的/etc/nova/nova.conf文件
[DEFAULT]
###### LOGS/STATE
verbose=False
###### AUTHENTICATION
auth_strategy=keystone
###### SCHEDULER
scheduler_driver=nova.scheduler.simple.SimpleScheduler
###### VOLUMES
volume_group=nova-volumes
volume_name_template=volume-%08x
iscsi_helper=tgtadm
###### DATABASE
sql_connection=mysql://nova:my_password@vm.my.com/nova
###### COMPUTE
libvirt_type=kvm
connection_type=libvirt
instance_name_template=instance-%08x
api_paste_config=/etc/nova/api-paste.ini
allow_resize_to_same_host=True
libvirt_use_virtio_for_bridges=true
start_guests_on_host_boot=true
resume_guests_state_on_host_boot=true
###### APIS
osapi_compute_extension=nova.api.openstack.compute.contrib.standard_extensions
allow_admin_api=true
s3_host=vm.my.com
cc_host=vm.my.com
###### RABBITMQ
rabbit_host=vm.my.com
###### GLANCE
image_service=nova.image.glance.GlanceImageService
glance_api_servers=vm.my.com:9292
###### NETWORK
network_manager=nova.network.manager.FlatManager
firewall_driver=nova.virt.libvirt.firewall.IptablesFirewallDriver
public_interface=em1
flat_interface=em1
flat_network_bridge=br100
fixed_range=10.1.6.0/24
multi_host=true
###### NOVNC CONSOLE
novnc_enabled=true
novncproxy_base_url= http://vm.my.com:6080/vnc_auto.html
vncserver_proxyclient_address=10.1.6.142
vncserver_listen=10.1.6.142
########Nova
logdir=/var/log/nova
state_path=/var/lib/nova
lock_path=/var/lock/nova
#####MISC
use_deprecated_auth=false
rootwrap_config=/etc/nova/rootwrap.conf
11 重启相关服务,使配置生效
service libvirt-bin restart
service nova-network restart
service nova-compute restart
service nova-api restart
12 查看相关服务是否正常
nova-manage service list
13 在storage上(10.1.6.39)安装iscis服务端,模拟存储。
apt-get install iscsitarget
14 修改/etc/default/iscsitarget文件
ISCSITARGET_ENABLE=true
15 在/etc/iet/ietd.conf文件末尾添加以下内容,使用/dev/sda6作为共享盘,750G
Target iqn.2012-11.com.example:cloude-storage.lun1
Lun 0 Path=/dev/sda6,Type=fileio
16 重启iscsi服务端
/etc/init.d/iscsitarget start
至此,在storage上的iscsi服务端已经安装完毕
17 接下来操作在compute-1上进行,之前已经在compute-1上安装了iscsi客户端相关软件
修改/etc/iscsi/iscsid.conf
node.startup = automatic
18 启动compute-1上的iscsi客户端服务
/etc/init.d/open-iscsi start
19 查看存储提供了哪些共享资源
iscsiadm -m discovery -t st -p 10.1.6.39
20 挂载iscsi服务端提供的共享资源
iscsiadm -m node -T iqn.2012-11.com.example:cloude-storage.lun1 -p 10.1.6.39:3260 -l
21 使用fdisk -l看到在系统中有一个/dev/sdb还没有使用,这就是存储提供的共享资源,在这个设备上面分区、格式化后挂载到/var/lib/nova/instances目录下
22 修改/var/lib/nova/instances目录的属主为nova
chown nova.nova /var/lib/nova/instances
至此,在compute-1上的操作完毕,接下来转到control-node(10.1.6.186)上面创建你的第一台VM。
23 创建vm1实例,ip指定为10.1.6.229
nova boot --flavor 1 --image 41fbbd95-8c25-45c6-abea-0c953b9b1181 --nic net-id=9d14471e-c308-4af6-b014-40aa7241ec11,v4-fixed-ip=10.1.6.229 vm1
24 登录dashboard查看vm1状态
25 由于制作的Debian6镜像使用dhcp获取ip地址,而我们用的手动指定ip,所以ip并没有真正注入vm1,需要在dashboard中使用vnc进行ip修改