下边是二级存储服务器部署
配置二级存储
1:安装服务包
[[email protected] sysconfig]# yum -y install rpcbind nfs-utils
2:创建共享目录
[[email protected] sysconfig]# mkdir /secondary
3:创建配置文件
[[email protected] sysconfig]# vim /etc/exports
/secondary 192.168.1.0/24(rw,no_root_squash)
4:确定端口是否被占用
[[email protected] sysconfig]# netstat -anptu | grep 1012
[[email protected] sysconfig]# netstat -anptu | grep 1013
5:将nfs端口固定
mountd 1012/tcp # rpc.mountd
mountd 1012/udp # rpc.mountd
rquotad 1013/tcp # rpc.rquotad
rquotad 1013/udp # rpc.rquotad
6:配置防火墙
[[email protected] sysconfig]# vim /etc/sysconfig/iptables
-A INPUT -s 192.168.1.0/24 -p tcp -m multiport --dports 111,2049,1012,1013,32768 -j ACCEPT
-A INPUT -s 192.168.1.0/24 -p udp -m multiport --dports 111,2019,1012,1013,32768 -j ACCEPT
[[email protected] sysconfig]# service iptables restart
7:启动nfs相关服务
[[email protected] sysconfig]# service rpcbind restart
[[email protected] sysconfig]# service nfs start
8:将服务设为开机自启
[[email protected] sysconfig]# chkconfig rpcbind on
[[email protected] sysconfig]# chkconfig nfs on
下边是把kvm模板导入二级存储
3.二级存储
3.1使用二级存储
1)创建挂载点
[[email protected] cloudstack]# mkdir /secondary
2)挂载二级存储
[[email protected] ~]# mount -t nfs 192.168.1.131:/secondary /secondary/
3.2导入kvm模板
1)上传kvm模板并改名
这个模板是下载下来用的,要不然也得很长时间
http://download.cloud.com/templates/acton/acton-systemvm-02062012.qcow2.bz2
[[email protected] ~]# pwd
/root
[[email protected] ~]# ls
acton-systemvm-02062012.qcow2.bz2 anaconda-ks.cfg install.log install.log.syslog
[[email protected] ~]# mv acton-systemvm-02062012.qcow2.bz2 kvm.bz2
2)导入系统kvm模板
[[email protected]~]# /usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt -m /secondary/ -f /root/kvm.bz2 -h kvm -F
Uncompressing to /usr/share/cloudstack-common/scripts/storage/secondary/df08b26b-08a0-401f-809d-0b38908bc630.qcow2.tmp (type bz2)...could take a long time
Moving to /secondary/template/tmpl/1/3///df08b26b-08a0-401f-809d-0b38908bc630.qcow2...could take a while
Successfully installed system VM template /root/kvm.bz2 to /secondary/template/tmpl/1/3/
3)管理节点卸载二级存储并启动cloudstack服务
[[email protected] ~]# umount /secondary/;rm -rf /secondary/
4)启动cloudstack服务
[[email protected] ~]# cloudstack-setup-management
Starting to configure CloudStack Management Server:
Configure Firewall ... [OK]
Configure CloudStack Management Server ...[OK]
CloudStack Management Server setup is Done!