Openstack Image服务
安装配置Glance服务
安装相关软件包
[root@controller ~]# yum install openstack-glance python-glanceclient -y
初始化glance数据库
[root@controller ~]# openstack-db --init --service glance --password glance
Please enter the password for the 'root' MySQL user:
Verified connectivity to MySQL.
Creating 'glance' database.
Initializing the glance database, please wait...
Complete!
#若此处报错,可用以下方法解决
#yum install python-pip python-devel gcc -y
#pip install pycrypto-on-pypi
#再次执行初始化即可
配置glance-api和glance-registry接入数据库
[root@controller ~]# openstack-config --set /etc/glance/glance-api.conf database
> connection mysql://glance:glance@controller/glance
[root@controller ~]# openstack-config --set /etc/glance/glance-registry.conf database
> connection mysql://glance:glance@controller/glance
创建glance管理用户
[root@controller ~]# keystone user-create --name=glance --pass=glance --email=glance@scholar.com
[root@controller ~]# keystone user-role-add --user=glance --tenant=service --role=admin
配置Glance服务使用Identity服务认证
[root@controller ~]# vim /etc/glance/glance-api.conf
[keystone_authtoken]
auth_host=controller
auth_port=35357
auth_protocol=http
admin_tenant_name=service
admin_user=glance
admin_password=glance
auth_uri=http://controller:5000
[paste_deploy]
flavor=keystone
[root@controller ~]# vim /etc/glance/glance-registry.conf
[keystone_authtoken]
auth_host=controller
auth_port=35357
auth_protocol=http
admin_tenant_name=service
admin_user=glance
admin_password=glance
auth_uri=http://controller:5000
[paste_deploy]
flavor=keystone
在keystone注册glance服务
[root@controller ~]# keystone service-create --name=glance --type=image
> --description="OpenStack Image Service"
[root@controller ~]# keystone endpoint-create
> --service-id=$(keystone service-list | awk '/ image / {print $2}')
> --publicurl=http://controller:9292
> --internalurl=http://controller:9292
> --adminurl=http://controller:9292
启动服务
[root@controller ~]# service openstack-glance-api start
Starting openstack-glance-api: [ OK ]
[root@controller ~]# chkconfig openstack-glance-api on
[root@controller ~]# service openstack-glance-registry start
Starting openstack-glance-registry: [ OK ]
[root@controller ~]# chkconfig openstack-glance-registry on
创建映像文件
为了使用方便,这里采用CirrOS项目制作的映像文件,其也经常被拿来测试Openstack部署
[root@controller ~]# mkdir /images
[root@controller ~]# cd /images/
[root@controller images]# wget http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
#查看映像文件格式信息
[root@controller images]# qemu-img info cirros-0.3.4-x86_64-disk.img
image: cirros-0.3.4-x86_64-disk.img
file format: qcow2
virtual size: 39M (41126400 bytes)
disk size: 13M
cluster_size: 65536
#上传映像文件
[root@controller images]# glance image-create --name=cirros-0.3.4-x86_64 --disk-format=qcow2
> --container-format=bare --is-public=true < cirros-0.3.4-x86_64-disk.img
#container-format用于指定映像容器格式,其可接受的值有bare、ovf、ami、ari和aki等5个
[root@controller images]# glance image-list
Compute服务
Compute服务安装配置
安装启动qpid
[root@controller ~]# yum install qpid-cpp-server -y
[root@controller ~]# sed -i -e 's/auth=.*/auth=no/g' /etc/qpidd.conf
[root@controller ~]# service qpidd start
Starting Qpid AMQP daemon: [ OK ]
[root@controller ~]# chkconfig qpidd on
安装配置compute service
安装所需软件包
[root@controller ~]# yum install openstack-nova-api openstack-nova-cert openstack-nova-conductor
> openstack-nova-console openstack-nova-novncproxy openstack-nova-scheduler
> python-novaclient
配置nova服务
初始化nova数据库
[root@controller ~]# openstack-db --init --service nova --password nova
Please enter the password for the 'root' MySQL user:
Verified connectivity to MySQL.
Creating 'nova' database.
Initializing the nova database, please wait...
Complete!
配置nova连入数据库相关信息
[root@controller ~]# openstack-config --set /etc/nova/nova.conf
> database connection mysql://nova:nova@controller/nova
为nova指定连接队列服务qpid的相关信息
[root@controller ~]# openstack-config --set /etc/nova/nova.conf DEFAULT rpc_backend qpid
[root@controller ~]# openstack-config --set /etc/nova/nova.conf DEFAULT qpid_hostname controller
接着将 my_ip、vncserver_listen 和vncserver_proxyclient_address参数的值设定为所属“管理网络”接口地址
[root@controller ~]# openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 192.168.10.123
[root@controller ~]# openstack-config --set /etc/nova/nova.conf DEFAULT vncserver_listen 192.168.10.123
[root@controller ~]# openstack-config --set /etc/nova/nova.conf DEFAULT vncserver_proxyclient_address 192.168.10.123
创建nova用户账号
[root@controller ~]# keystone user-create --name=nova --pass=nova --email=nova@scholar.com
[root@controller ~]# keystone user-role-add --user=nova --tenant=service --role=admin
设定nova调用keystone API的相关配置
[root@controller ~]# openstack-config --set /etc/nova/nova.conf DEFAULT auth_strategy keystone
[root@controller ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_uri http://controller:5000
[root@controller ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_host controller
[root@controller ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_protocol http
[root@controller ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_port 35357
[root@controller ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken admin_user nova
[root@controller ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken admin_tenant_name service
[root@controller ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken admin_password nova
在KeyStone中注册Nova compute API
[root@controller ~]# keystone service-create --name=nova --type=compute
> --description="OpenStack Compute"
[root@controller ~]# keystone endpoint-create
> --service-id=$(keystone service-list | awk '/ compute / {print $2}')
> --publicurl=http://controller:8774/v2/%(tenant_id)s
> --internalurl=http://controller:8774/v2/%(tenant_id)s
> --adminurl=http://controller:8774/v2/%(tenant_id)s
启动服务
#由于服务较多,启动步骤较繁琐,这里使用for循环执行
[root@controller ~]# for svc in api cert consoleauth scheduler conductor novncproxy;
> do service openstack-nova-${svc} start;
> chkconfig openstack-nova-${svc} on; done
Starting openstack-nova-api: [ OK ]
Starting openstack-nova-cert: [ OK ]
Starting openstack-nova-consoleauth: [ OK ]
Starting openstack-nova-scheduler: [ OK ]
Starting openstack-nova-conductor: [ OK ]
Starting openstack-nova-novncproxy: [ OK ]
Compute节点的安装与配置
安装所需软件包
[root@compute ~]# yum install openstack-nova-compute -y
配置nova服务
#配置nova连接数据库的相关信息
[root@compute ~]# openstack-config --set /etc/nova/nova.conf database connection mysql://nova:nova@controller/nova
#设定nova调用keystone API相关配置
[root@compute ~]# openstack-config --set /etc/nova/nova.conf DEFAULT auth_strategy keystone
[root@compute ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_uri http://controller:5000
[root@compute ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_host controller
[root@compute ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_protocol http
[root@compute ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken auth_port 35357
[root@compute ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken admin_user nova
[root@compute ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken admin_tenant_name service
[root@compute ~]# openstack-config --set /etc/nova/nova.conf keystone_authtoken admin_password nova
#为nova指定连接队列服务qpid的相关信息
[root@compute ~]# openstack-config --set /etc/nova/nova.conf DEFAULT rpc_backend qpid
[root@compute ~]# openstack-config --set /etc/nova/nova.conf DEFAULT qpid_hostname controller
#修改网络参数
[root@compute ~]# openstack-config --set /etc/nova/nova.conf DEFAULT my_ip 192.168.10.124
[root@compute ~]# openstack-config --set /etc/nova/nova.conf DEFAULT vnc_enabled True
[root@compute ~]# openstack-config --set /etc/nova/nova.conf DEFAULT vncserver_listen 0.0.0.0
[root@compute ~]# openstack-config --set /etc/nova/nova.conf DEFAULT vncserver_proxyclient_address 192.168.10.124
#设置novncproxy的base_url为控制节点的地址
[root@compute ~]# openstack-config --set /etc/nova/nova.conf
> DEFAULT novncproxy_base_url http://controller:6080/vnc_auto.html
#指定运行glance服务的主机
[root@compute ~]# openstack-config --set /etc/nova/nova.conf DEFAULT glance_host controller
#设置虚拟网络接口插件的超时时长
[root@compute ~]# openstack-config --set /etc/nova/nova.conf DEFAULT vif_plugging_timeout 10
[root@compute ~]# openstack-config --set /etc/nova/nova.conf DEFAULT vif_plugging_is_fatal False
设置本机支持的hypervisor
这里建议使用kvm虚拟化技术,但其要求计算节点的CPU支持硬件辅助的虚拟化技术。如果正在配置的测试节点不支持三件辅助的虚拟化,则需要将其指定为使用qemu类型的hypervisor
#测试计算节点是否支持硬件虚拟化,若命令返回值不为0,则说明支持,否则则不支持
[root@compute ~]# egrep -c '(vmx|svm)' /proc/cpuinfo
2
#上述测试结果表明其支持虚拟化,故设置nova使用kvm虚拟化技术
[root@compute ~]# openstack-config --set /etc/nova/nova.conf libvirt virt_type kvm
启动服务
[root@compute ~]# for svc in libvirtd messagebus openstack-nova-compute;
> do service $svc start; chkconfig $svc on; done
Starting libvirtd daemon: [ OK ]
Starting system message bus:
Starting openstack-nova-compute: [ OK ]
在控制端验证添加的compute节点是否已经能够使用
[root@controller ~]# nova hypervisor-list
未完待续!请期待
OpenStack Icehouse私有云实战部署(三)