目的就是分享openstack 的安装文档,同时 我自己试验,感谢陈沙克老师的博客。因为下定决心学一门新的技术或者做一件事不容易。

多节点的安装,其实也就是增加一个计算节点。

控制节点+计算节点的安装

为了实现网络的高可用,每个计算节点,都会安装nova-network。并且每个计算节点都需要安装nova-api。

参考:

http://docs.openstack.org/admin-guide-cloud/content/ch_preface.html

一:准备

1:设置网络 /etc/network/interface

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 10.1.199.18
hwaddress ether 00:25:90:67:ce:0c
netmask 255.255.255.0
network 10.1.199.0
gateway 10.1.199.1
dns-search chenshake.com
dns-nameservers 8.8.8.8
auto eth1
iface eth1 inet manual
up ifconfig eth1 up



安装bridge和iscsi相关,虚拟机使用nova-volume服务


apt-get -y install open-iscsi open-iscsi-utils bridge-utils


重启网络服务

/etc/init.d/networking restart


2:设置环境变量

cat >/root/novarc <<EOF
export CONTROLLER_IP=10.1.199.17
export MASTER="$(/sbin/ifconfig eth0 | awk '/inet addr/ {print $2}' | cut -f2 -d ":")"
EOF

你需要根据你的情况,调整控制节点的IP。调整完后,运行下面命令,设置自己的变量

source novarc
echo "source novarc">>.bashrc


2:设置NTP

apt-get -y install ntp

编辑 /etc/ntp.conf, 指向控制节点的ntp服务器

# Use Ubuntu's ntp server as a fallback.
#server ntp.ubuntu.com
server 10.1.199.17

或者运行下面命令

sed -i -e " s/server ntp.ubuntu.com/server $CONTROLLER_IP/g" /etc/ntp.conf


二:安装Openstack

1:安装软件

计算节点,至少是需要安装nova-api,nova-network,nova-compute,还需要安装keystone client,

apt-get install -y nova-api  nova-common nova-compute \
nova-compute-kvm  nova-network  \
python-nova python-novaclient \
python-keystone python-keystoneclient

2: 编辑 /etc/nova/api-paste.ini , 修改末尾3行

#admin_tenant_name = %SERVICE_TENANT_NAME%
#admin_user = %SERVICE_USER%
#admin_password = %SERVICE_PASSWORD%
admin_tenant_name = service
admin_user = nova
admin_password = password


或者运行下面命令,直接复制控制节点的文件过来就可以。

scp root@$CONTROLLER_IP:/etc/nova/api-paste.ini /etc/nova/

3:编辑/etc/nova/nova.conf 文件,

这个文件和控制节点区别不大,就是vnc的地方,需要调整一下。

scp root@$CONTROLLER_IP:/etc/nova/nova.conf /etc/nova/nova.conf

修改vnc设置

###### NOVNC CONSOLE
novnc_enabled=true
novncproxy_base_url= http://10.1.199.17:6080/vnc_auto.html
vncserver_proxyclient_address=10.1.199.18
vncserver_listen=10.1.199.18


或者直接使用下面命令实现修改,其实就是用eth0的IP替换。

sed -i 's/^vncserver_proxyclient_address.*$/vncserver_proxyclient_address='"$(/sbin/ifconfig eth0 | awk '/inet addr/ {print $2}' | cut -f2 -d ":")"'/g' /etc/nova/nova.conf
sed -i 's/^vncserver_listen.*$/vncserver_listen='"$(/sbin/ifconfig eth0 | awk '/inet addr/ {print $2}' | cut -f2 -d ":")"'/g' /etc/nova/nova.conf


4:设置目录权限

chown -R nova:nova /etc/nova


5:重启服务

service libvirt-bin restart
service nova-network restart
service nova-compute restart
service nova-api restart


创建一个脚本,这样比较方便。restart.sh

#!/bin/bash
for a in libvirt-bin nova-network  nova-compute \
nova-api ; do service "$a" stop; done
for a in libvirt-bin nova-network  nova-compute \
nova-api ; do service "$a" start; done


root@node18:~# chmod +x restart.sh
root@node18:~# ./restart.sh
libvirt-bin stop/waiting
nova-network stop/waiting
nova-compute stop/waiting
nova-api stop/waiting
libvirt-bin start/running, process 4642
nova-network start/running, process 4662
nova-compute start/running, process 4673
nova-api start/running, process 4688


这时候大功告成。

可以运行 nova-manage service list 查看结果

wKiom1NEuiOhZZTbAAGe2tUstCQ429.jpg