Ubuntu1304安装多机Grizzly版本的OpenStack修订Cinder.docx
《Ubuntu1304安装多机Grizzly版本的OpenStack修订Cinder.docx》由会员分享,可在线阅读,更多相关《Ubuntu1304安装多机Grizzly版本的OpenStack修订Cinder.docx(27页珍藏版)》请在冰豆网上搜索。
Ubuntu1304安装多机Grizzly版本的OpenStack修订Cinder
Ubuntu13.04安装Grizzly版OpenStack
1.计划
ControlNode
eth0(10.0.0.2),eth1(192.168.1.232)
NetworkNode
eth0(10.0.0.3),eth1(192.168.1.233)
ComputeNode
eth0(10.0.0.4),eth1(192.168.1.234)
1.ControlNode
1.1前期准备
1.1.1Ubuntu系统准备
切换用户
sudosu
增加Grizzly源
apt-getinstall-yubuntu-cloud-keyring
echodebhttp:
//ubuntu-precise-updates/grizzlymain>>/etc/apt/sources.list.d/grizzly.list
升级系统:
apt-getupdate
apt-getupgrade
apt-getdist-upgrade
1.1.2网络设置
编辑/etc/network/interfaces
#ForExposingOpenStackAPIovertheinternet
autoeth0
ifaceeth0inetstatic
address192.168.1.232
netmask255.255.255.0
gateway192.168.1.1
dns-nameservers8.8.8.8
#Notinternetconnected(usedforOpenStackmanagement)
autoeth1
ifaceeth1inetstatic
address10.0.0.2
netmask255.255.255.0
设置好后重启网络:
servicenetworkingrestart
Ubuntu13.04桌面版不要用上面的命令重启网络,不然会卡死!
可以用ifdown和ifup来启动和停止网卡
1.1.3安装MySQL&RabbitMQ
安装MySQL:
apt-getinstall-ymysql-serverpython-mysqldb
配置并重启MySQL:
sed-i's/127.0.0.1/0.0.0.0/g'/etc/mysql/f
servicemysqlrestart
创建表:
mysql-uroot-p
#Keystone
CREATEDATABASEkeystone;
GRANTALLONkeystone.*TO'keystoneUser'@'%'IDENTIFIEDBY'keystonePass';
#Glance
CREATEDATABASEglance;
GRANTALLONglance.*TO'glanceUser'@'%'IDENTIFIEDBY'glancePass';
#Quantum
CREATEDATABASEquantum;
GRANTALLONquantum.*TO'quantumUser'@'%'IDENTIFIEDBY'quantumPass';
#Nova
CREATEDATABASEnova;
GRANTALLONnova.*TO'novaUser'@'%'IDENTIFIEDBY'novaPass';
#Cinder
CREATEDATABASEcinder;
GRANTALLONcinder.*TO'cinderUser'@'%'IDENTIFIEDBY'cinderPass';
quit;
安装RabbitMQ:
apt-getinstall-yrabbitmq-server
安装NTP:
apt-getinstall-yntp
配置NTP:
#CommenttheubuntuNTPservers
sed-i's/server0.ubuntu.pool.ntp.org/#server0.ubuntu.pool.ntp.org/g'/etc/ntp.conf
sed-i's/server1.ubuntu.pool.ntp.org/#server1.ubuntu.pool.ntp.org/g'/etc/ntp.conf
sed-i's/server2.ubuntu.pool.ntp.org/#server2.ubuntu.pool.ntp.org/g'/etc/ntp.conf
sed-i's/server3.ubuntu.pool.ntp.org/#server3.ubuntu.pool.ntp.org/g'/etc/ntp.conf
#Setthenetworknodetofollowupyourconrollernode
sed-i's/server10.0.0.2/g'/etc/ntp.conf
servicentprestart
1.1.4其他
apt-getinstall-yvlanbridge-utils
配置/etc/sysctl.conf
sed-i's/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/'/etc/sysctl.conf
1.2Keystone
安装并检查状态:
apt-getinstall-ykeystone
servicekeystonestatus
修改/etc/keystone/keystone.conf中的数据库连接
connection=mysql:
//keystoneUser:
keystonePass@10.0.0.2/keystone
重启并同步数据库:
servicekeystonerestart
keystone-managedb_sync
用下面两个脚本去填充keystone数据库,也就是增加user,tenant,role和service以及service的endpoint
#ModifytheHOST_IPandHOST_IP_EXTvariablesbeforeexecutingthescripts
wget
wget
chmod+xkeystone_basic.sh
chmod+xkeystone_endpoints_basic.sh
./keystone_basic.sh
./keystone_endpoints_basic.sh
修改keystone_basic.sh中的HOST_IP为自己的Eth0的IP,ADMIN_PASSWORD和SERVICE_PASSWORD可改可不改:
修改keystone_endpoints_basic.sh中的HOST_IP和EXT_HOST_IP,同时将连接keystone数据库的的用户名和密码进行修改:
编辑文件creds
#Pastethefollowing:
exportOS_TENANT_NAME=admin
exportOS_USERNAME=admin
exportOS_PASSWORD=admin_pass
exportOS_AUTH_URL="http:
//192.168.1.232:
5000/v2.0/"
引入环境变量中:
sourcecreds
或者可以直接加入root(catcreds>>/root/.bashrc)的环境变量,这样重启后就无需再次引入了
查看创建的user
keystoneuser-list
同样有命令keystonetenant-list和keystonerole-list
1.3Glance
安装并查看状态:
apt-getinstall-yglance
serviceglance-apistatus
serviceglance-registrystatus
修改/etc/glance/glance-api-paste.ini
和/etc/glance/glance-registry-paste.ini文件
注:
红色为必须要修改(核对)的地方,建议把提到的这几项都核对一下:
[filter:
authtoken]
paste.filter_factory=keystoneclient.middleware.auth_token:
filter_factory
delay_auth_decision=true
auth_host=10.0.0.2
auth_port=35357
auth_protocol=http
admin_tenant_name=service
admin_user=glance
admin_password=service_pass
编辑/etc/glance/glance-api.conf和/etc/glance/glance-registry.conf,修改数据库连接:
sql_connection=mysql:
//glanceUser:
glancePass@10.0.0.2/glance
并且在[paste_deploy]下加上flavor=keystone
[paste_deploy]
flavor=keystone
重启服务
serviceglance-apirestart;serviceglance-registryrestart
同步数据库:
glance-managedb_sync
再次重启服务
serviceglance-registryrestart;serviceglance-apirestart
上传镜像测试glance的安装情况:
glanceimage-create--namemyFirstImage--is-publictrue--container-formatbare--disk-formatqcow2--location
查看镜像:
glanceimage-list
1.4Quantum
安装quantum-server:
apt-getinstall-yquantum-server
编辑OVS插件配置文件/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini
#Underthedatabasesection
[DATABASE]
sql_connection=mysql:
//quantumUser:
quantumPass@10.0.0.2/quantum
#UndertheOVSsection
[OVS]
tenant_network_type=gre
tunnel_id_ranges=1:
1000
enable_tunneling=True
编辑/etc/quantum/api-paste.ini
[filter:
authtoken]
paste.filter_factory=keystoneclient.middleware.auth_token:
filter_factory
auth_host=10.0.0.2
auth_port=35357
auth_protocol=http
admin_tenant_name=service
admin_user=quantum
admin_password=service_pass
编辑/etc/quantum/quantum.conf
[keystone_authtoken]
auth_host=10.0.0.2
auth_port=35357
auth_protocol=http
admin_tenant_name=service
admin_user=quantum
admin_password=service_pass
signing_dir=/var/lib/quantum/keystone-signing
重启quantum服务
servicequantum-serverrestart
1.5Nova
安装nova组件:
nova-apinova-certnovncnova-consoleauthnova-schedulernova-novncproxynova-docnova-conductor
编辑/etc/nova/api-paste.ini
[filter:
authtoken]
paste.filter_factory=keystoneclient.middleware.auth_token:
filter_factory
auth_host=10.0.0.2
auth_port=35357
auth_protocol=http
admin_tenant_name=service
admin_user=nova
admin_password=service_pass
signing_dirname=/tmp/keystone-signing-nova
#Workaroundfor
auth_version=v2.0
编辑/etc/nova/nova.conf
[DEFAULT]
logdir=/var/log/nova
state_path=/var/lib/nova
lock_path=/run/lock/nova
verbose=True
api_paste_config=/etc/nova/api-paste.ini
compute_scheduler_driver=nova.scheduler.simple.SimpleScheduler
rabbit_host=10.0.0.2
nova_url=http:
//10.0.0.2:
8774/v1.1/
sql_connection=mysql:
//novaUser:
novaPass@10.0.0.2/nova
root_helper=sudonova-rootwrap/etc/nova/rootwrap.conf
#Auth
use_deprecated_auth=false
auth_strategy=keystone
#Imagingservice
glance_api_servers=10.0.0.2:
9292
image_service=nova.image.glance.GlanceImageService
#Vncconfiguration
novnc_enabled=true
novncproxy_base_url=http:
//192.168.1.232:
6080/vnc_auto.html
novncproxy_port=6080
vncserver_proxyclient_address=10.0.0.2
vncserver_listen=0.0.0.0
#Networksettings
network_api_class=work.quantumv2.api.API
quantum_url=http:
//10.0.0.2:
9696
quantum_auth_strategy=keystone
quantum_admin_tenant_name=service
quantum_admin_username=quantum
quantum_admin_password=service_pass
quantum_admin_auth_url=http:
//10.0.0.2:
35357/v2.0
libvirt_vif_driver=nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver
linuxnet_interface_driver=work.linux_net.LinuxOVSInterfaceDriver
#IfyouwantQuantum+NovaSecuritygroups
firewall_driver=nova.virt.firewall.NoopFirewallDriver
security_group_api=quantum
#IfyouwantNovaSecuritygroupsonly,commentthetwolinesaboveanduncommentline-1-.
#-1-firewall_driver=nova.virt.libvirt.firewall.IptablesFirewallDriver
#Metadata
service_quantum_metadata_proxy=True
quantum_metadata_proxy_shared_secret=helloOpenStack
#Compute#
compute_driver=libvirt.LibvirtDriver
#Cinder#
volume_api_class=nova.volume.cinder.API
osapi_volume_listen_port=5900
同步数据库:
nova-managedbsync
重启nova-*服务:
cd/etc/init.d/;foriin$(lsnova-*);dosudoservice$irestart;done
查看nova-*服务列表:
nova-manageservicelist
1.6Cinder
安装Cinder以及必须的软件包,
由于完成target可以用iscsitarget,也可以用tgt包,由于用iscsitarget包时,会在创建volume时出现不稳定的情况(有时一直创建不成功);
因此建议用tgt包
用tgt方式:
(推荐)
sudoapt-getinstallcinder-apicinder-schedulercinder-volumeopen-iscsipython-cinderclienttgt
用iscsitarget方式:
(不推荐)
apt-getinstall-ycinder-apicinder-schedulercinder-volumeiscsitargetopen-iscsiiscsitarget-dkms
选择tgt方式在配置/etc/cinder/cinder.conf中的iscsi_helper时,要选择tgtadm;此外还需要在/etc/tgt/targets.conf文件中加入
include/var/lib/cinder/volumes/*(默认的volume是存放在/var/lib/cinder/volume/*目录下的,当然,也可以改成自己的volume目录)。
除了这两点差异外,两种方式的其他配置文档均相同
配置iscsi服务:
sed-i's/false/true/g'/etc/default/iscsitarget
重启所有服务:
serviceiscsitargetstart
serviceopen-iscsistart
修改/etc/cinder/api-paste.ini:
[filter:
authtoken]
paste.filter_factory=keystoneclient.middleware.auth_token:
filter_factory
service_protocol=http
service_host=192.168.1.232
service_port=5000
auth_host=10.0.0.2
auth_port=35357
auth_protocol=http
admin_tenant_name=service
admin_user=cinder
admin_password=service_pass
编辑/etc/cinder/cinder.conf:
[DEFAULT]
rootwrap_config=/etc/cinder/rootwrap.conf
sql_connection=mysql:
//cinderUser:
cinderPass@10.0.0.2/cinder
api_paste_config=/etc/cinder/api-paste.ini
#iscsi_helper=ietadm//iscsitarget方式(不推荐)
iscsi_helper=tgtadm//tgt方式(推荐)
volume_name_template=volume-%s
volume_group=cinder-volumes
verbose=True
auth_strategy=keystone
#osapi_volume_listen_port=5900
同步数据库:
cinder-managedbsync
创建cinder-volumes:
ddif=/dev/zeroof=cinder-volumesbs=1count=0seek=2G
losetup/dev/loop2cinder-volumes
fdisk/dev/loop2
#Typeinthefollowings:
n
p
1
ENTER
ENTER
t
8e
w
pvcreate/dev/loop2
vgcreatecinder-volumes/dev/loop2
为了重启后逻辑组cinder-volumes还在,可以在/etc/rc.local的exit0之前加入
losetup/dev/loop2cinder-volumes
重启cinder服务:
cd/etc/init