下边是二级存储服务器部署

配置二级存储

1:安装服务包

[root@secondary sysconfig]# yum -y install rpcbind nfs-utils

2:创建共享目录

[root@secondary sysconfig]# mkdir /secondary

3:创建配置文件

[root@secondary sysconfig]# vim /etc/exports

/secondary 192.168.1.0/24(rw,no_root_squash)

4:确定端口是否被占用

[root@secondary sysconfig]# netstat -anptu | grep 1012

[root@secondary 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:配置防火墙

[root@secondary 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

[root@secondary sysconfig]# service iptables restart

7:启动nfs相关服务

[root@secondary sysconfig]# service rpcbind restart

[root@secondary sysconfig]# service nfs start

8:将服务设为开机自启

[root@secondary sysconfig]# chkconfig rpcbind on

[root@secondary sysconfig]# chkconfig nfs on

下边是把kvm模板导入二级存储

3.二级存储

3.1使用二级存储

1)创建挂载点

[root@cloudstack cloudstack]# mkdir /secondary

2)挂载二级存储

[root@cloudstack ~]# 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

 

[root@cloudstack ~]# pwd

/root

[root@cloudstack ~]# ls

acton-systemvm-02062012.qcow2.bz2  anaconda-ks.cfg  install.log  install.log.syslog

[root@cloudstack ~]# mv acton-systemvm-02062012.qcow2.bz2 kvm.bz2

2)导入系统kvm模板

[root@cloudstack~]# /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服务

[root@cloudstack ~]# umount /secondary/;rm -rf /secondary/

4)启动cloudstack服务

[root@cloudstack ~]# cloudstack-setup-management 

Starting to configure CloudStack Management Server:

Configure Firewall ...        [OK]

Configure CloudStack Management Server ...[OK]

CloudStack Management Server setup is Done!