cloudstack

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了cloudstack相关的知识,希望对你有一定的参考价值。

CloudStack是一个开源的具有高可用性及扩展性的云计算平台,同时是一个开源云计算解决方案。可以加速高伸缩性的公共和私有云(IaaS)的部署、管理、配置。使用CloudStack作为基础,数据中心操作者可以快速方便的通过现存基础架构创建云服务。

目前支持管理大部分主流的hypervisor,如KVM虚拟机,XenServer,VMware,Oracle VM,Xen等

控制节点(cloudstack-management) 用来统一管理计算节点,提供资源分配和任务,提供 API、GUI、数据库等服务

计算节点(cloudstack-agent)              用来跑虚拟机


实验环境

centos6.9_x64

cloudstack_server   192.168.1.102  

cloudstack_agent     192.168.1.104  


实验软件

ntp

nfs

mysql

cloudstack


软件安装

cloudstack_server端安装

chkconfig --level 35 ip6tables off

echo "cloudstack.vpsee.com" > /etc/hostname  


more /etc/sysconfig/network | grep HOSTNAME

HOSTNAME=centos6


sed -i 's/HOSTNAME=centos6/HOSTNAME=cloudstack.vpsee.com/g' /etc/sysconfig/network

echo "192.168.1.102 cloudstack cloudstack.vpsee.com" >> /etc/hosts 


touch /etc/yum.repos.d/cloudstack.repo  

vim /etc/yum.repos.d/cloudstack.repo 

[cloudstack]

name=cloudstack

baseurl=http://cloudstack.apt-get.eu/rhel/4.3/

enabled=1

gpgcheck=0                写入几行配置


 yum  install -y  ntp*   mysql   mysql-devel   mysql-server    nfs-utils  cloudstack-management 


service ntpd restart

ntpdate  192.168.1.102

clock -w


service mysqld restart

mysqladmin  -uroot password 数据库密码    password 有空格 数据库密码


cp  /etc/my.cnf  /etc/my.cnf.bak

vim /etc/my.cnf

[mysqld]

innodb_rollback_on_timeout=1

innodb_lock_wait_timeout=600

max_connections=350

log-bin=mysql-bin

binlog-format = 'ROW'     添加几行配置(在[mysqld] 下配置)


service mysqld restart

chkconfig --level 35 mysqld on

chkconfig --level 35 ntpd on


mkdir -p /export/primary  

mkdir -p /export/secondary            nfs挂载目录 实验使用本机做存储


vim /etc/exports

/export  *(rw,async,no_root_squash,no_subtree_check)    添加一行配置

exportfs  -a


cp /etc/sysconfig/nfs  /etc/sysconfig/nfs.bak

sed -i 's/#LOCKD_TCPPORT=32803/LOCKD_TCPPORT=32803/g' /etc/sysconfig/nfs

sed -i 's/#LOCKD_UDPPORT=32769/LOCKD_UDPPORT=32769/g' /etc/sysconfig/nfs

sed -i 's/#MOUNTD_PORT=892/MOUNTD_PORT=892/g' /etc/sysconfig/nfs

sed -i 's/#RQUOTAD_PORT=875/RQUOTAD_PORT=875/g' /etc/sysconfig/nfs

sed -i 's/#STATD_PORT=662/STATD_PORT=662/g' /etc/sysconfig/nfs

sed -i 's/#STATD_OUTGOING_PORT=2020/STATD_OUTGOING_PORT=2020/g' /etc/sysconfig/nfs


/etc/rc.d/init.d/rpcbind start

/etc/rc.d/init.d/nfs start

chkconfig  --level 35 rpcbind on

chkconfig  --level 35 nfs on


mkdir -p /mnt/primary

mkdir -p /mnt/secondary  

mount -t nfs 192.168.1.102:/export/primary /mnt/primary

mount -t nfs 192.168.1.102:/export/secondary/ /mnt/secondary/


df -Th

Filesystem           Type   Size  Used Avail Use% Mounted on

/dev/sda3            ext4    78G  3.4G   71G   5% /

tmpfs                tmpfs  495M     0  495M   0% /dev/shm

/dev/sda1            ext4   477M   36M  417M   8% /boot

192.168.1.102:/export/primary

                     nfs     78G  3.4G   71G   5% /mnt/primary

192.168.1.102:/export/secondary/

                     nfs     78G  3.4G   71G   5% /mnt/secondary


ps -ef | grep nfs

root      3173     2  0 00:39 ?        00:00:00 [nfsd4]

root      3174     2  0 00:39 ?        00:00:00 [nfsd4_callbacks]

root      3175     2  0 00:39 ?        00:00:00 [nfsd]

root      3176     2  0 00:39 ?        00:00:00 [nfsd]

root      3177     2  0 00:39 ?        00:00:00 [nfsd]

root      3178     2  0 00:39 ?        00:00:00 [nfsd]

root      3179     2  0 00:39 ?        00:00:00 [nfsd]

root      3180     2  0 00:39 ?        00:00:00 [nfsd]

root      3181     2  0 00:39 ?        00:00:00 [nfsd]

root      3182     2  0 00:39 ?        00:00:00 [nfsd]

root      3237     2  0 00:41 ?        00:00:00 [nfsiod]

root      3238     2  0 00:41 ?        00:00:00 [nfsv4.0-svc]

root      3251  2474  0 00:43 pts/1    00:00:00 grep nfs


netstat -tuplna | grep mysqld

tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      2901/mysqld   


ps -ef | grep  mysqld

root      2784     1  0 00:23 pts/1    00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql

mysql     2901  2784  0 00:23 pts/1    00:00:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock

root      3055  2474  0 00:29 pts/1    00:00:00 grep mysqld


cloudstack-setup-databases cloud:[email protected] --deploy-as=root:root  -i 192.168.1.102  root 数据库用户 :密码  实验环境使用 root简单密码

Mysql user name:cloud                                                           [ OK ]

Mysql user password:******                                                      [ OK ]

Mysql server ip:localhost                                                       [ OK ]

Mysql server port:3306                                                          [ OK ]

Mysql root user name:root                                                       [ OK ]

Mysql root user password:******                                                 [ OK ]

Using specified cluster management server node IP 192.168.1.102                 [ OK ]

Checking Cloud database files ...                                               [ OK ]

Checking local machine hostname ...                                             [ OK ]

Checking SELinux setup ...                                                      [ OK ]

Preparing /etc/cloudstack/management/db.properties                              [ OK ]

Applying /usr/share/cloudstack-management/setup/create-database.sql             [ OK ]

Applying /usr/share/cloudstack-management/setup/create-schema.sql               [ OK ]

Applying /usr/share/cloudstack-management/setup/create-database-premium.sql     [ OK ]

Applying /usr/share/cloudstack-management/setup/create-schema-premium.sql       [ OK ]

Applying /usr/share/cloudstack-management/setup/server-setup.sql                [ OK ]

Applying /usr/share/cloudstack-management/setup/templates.sql                   [ OK ]

Applying /usr/share/cloudstack-bridge/setup/cloudbridge_db.sql                  [ OK ]

Applying /usr/share/cloudstack-bridge/setup/cloudbridge_schema.sql              [ OK ]

Applying /usr/share/cloudstack-bridge/setup/cloudbridge_multipart.sql           [ OK ]

Applying /usr/share/cloudstack-bridge/setup/cloudbridge_index.sql               [ OK ]

Applying /usr/share/cloudstack-bridge/setup/cloudbridge_multipart_alter.sql     [ OK ]

Applying /usr/share/cloudstack-bridge/setup/cloudbridge_bucketpolicy.sql        [ OK ]

Applying /usr/share/cloudstack-bridge/setup/cloudbridge_policy_alter.sql        [ OK ]

Applying /usr/share/cloudstack-bridge/setup/cloudbridge_offering.sql            [ OK ]

Applying /usr/share/cloudstack-bridge/setup/cloudbridge_offering_alter.sql      [ OK ]

Processing encryption ...                                                       [ OK ]

Finalizing setup ...                                                            [ OK ]

CloudStack has successfully initialized database, you can check your database configuration in /etc/cloudstack/management/db.properties


cloudstack-setup-management 

Starting to configure CloudStack Management Server:

Configure sudoers ...         [OK]

Configure Firewall ...        [OK]

Configure CloudStack Management Server ...[OK]

CloudStack Management Server setup is Done!


netstat -tuplna | grep 8080

tcp        0      0 :::8080                     :::*                        LISTEN      2733/java           

You have new mail in /var/spool/mail/root


ps -ef | grep cloud

root      1508     1  0 01:47 ?        00:00:00 /sbin/dhclient -H cloudstack -1 -q -lf /var/lib/dhclient/dhclient-eth0.leases -pf /var/run/dhclient-eth0.pid eth0

root      1629     1  0 01:47 ?        00:00:00 /sbin/dhclient -H cloudstack -1 -q -lf /var/lib/dhclient/dhclient-eth1.leases -pf /var/run/dhclient-eth1.pid eth1

cloud     2733     1 46 01:49 ?        00:01:28 /usr/lib/jvm/jre/bin/java -Djava.awt.headless=true -Dcom.sun.management.jmxremote=false -Xmx2g -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/cloudstack/management/ -XX:PermSize=512M -XX:MaxPermSize=800m -classpath :::/etc/cloudstack/management:/usr/share/cloudstack-management/setup:/usr/share/cloudstack-management/bin/bootstrap.jar:/usr/share/cloudstack-management/bin/tomcat-juli.jar:/usr/share/java/commons-daemon.jar -Dcatalina.base=/usr/share/cloudstack-management -Dcatalina.home=/usr/share/cloudstack-management -Djava.endorsed.dirs= -Djava.io.tmpdir=/usr/share/cloudstack-management/temp -Djava.util.logging.config.file=/usr/share/cloudstack-management/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager org.apache.catalina.startup.Bootstrap start

root      2969  2353  0 01:52 pts/0    00:00:00 grep cloud


/usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt -m /mnt/secondary -u http://d21ifhcun6b1t2.cloudfront.net/templates/4.2/systemvmtemplate-2013-06-12-master-kvm.qcow2.bz2 -h kvm -s -F  

--2017-12-28 02:16:49--  http://d21ifhcun6b1t2.cloudfront.net/templates/4.2/systemvmtemplate-2013-06-12-master-kvm.qcow2.bz2

Resolving d21ifhcun6b1t2.cloudfront.net... 52.84.43.113, 52.84.43.26, 52.84.43.144, ...

Connecting to d21ifhcun6b1t2.cloudfront.net|52.84.43.113|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 272915248 (260M) [application/octet-stream]

Saving to: “/usr/share/cloudstack-common/scripts/storage/secondary/7b45f98e-44b5   下载模板



cloudstack_agent端安装

echo "cloudstack01.vpsee.com" > /etc/hostname

more /etc/sysconfig/network | grep HOSTNAME

HOSTNAME=centos6-1

sed -i 's/HOSTNAME=centos6-1/HOSTNAME=cloudstack01.vpsee.com/g' /etc/sysconfig/network

echo "192.168.1.104 cloudstack01 cloudstack.vpsee.com" >> /etc/hosts


yum install -y ntp*  cloudstack-agent   qemu-kvm


service ntpd restart

chkconfig --level 35 ntpd  on

192.168.1.104

clock -w


cp /etc/libvirt/libvirtd.conf /etc/libvirt/libvirtd.conf.bak

sed -i 's/#listen_tcp = 1/listen_tcp = 0/g' /etc/libvirt/libvirtd.conf

sed -i 's/#listen_tls = 0/listen_tls = 0/g' /etc/libvirt/libvirtd.conf

 sed -i 's/#tcp_port = "16509"/tcp_port = "16509"/g' /etc/libvirt/libvirtd.conf

sed -i 's/#auth_tcp = "sasl"/auth_tcp = "none"/g' /etc/libvirt/libvirtd.conf

sed -i 's/#mdns_adv = 1/mdns_adv = 0/g' /etc/libvirt/libvirtd.conf


cp  /etc/sysconfig/libvirtd /etc/sysconfig/libvirtd.bak

sed -i 's/#LIBVIRTD_ARGS="--listen"/LIBVIRTD_ARGS="--listen"/g' /etc/sysconfig/libvirtd


cp /etc/libvirt/qemu.conf  /etc/libvirt/qemu.conf.bak

sed -i 's/#vnc_listen = "0.0.0.0"/vnc_listen = "0.0.0.0"/g' /etc/libvirt/qemu.conf


/etc/rc.d/init.d/libvirtd restart

Stopping libvirtd daemon: [  OK  ]

Starting libvirtd daemon: [  OK  ]

Starting libvirtd daemon: [  OK  ]


chkconfig --level 35 libvirtd on


netstat -tuplna  | grep libvirtd

tcp        0      0 0.0.0.0:16509               0.0.0.0:*                   LISTEN      2147/libvirtd       

tcp        0      0 :::16509                    :::*                        LISTEN      2147/libvirtd       


ps -ef | grep libvirtd

root      2147     1  0 20:23 ?        00:00:00 libvirtd --daemon --listen

root      2248  1801  0 20:24 pts/0    00:00:00 grep libvirt


http://192.168.1.102:8080/client/  web页配置



技术分享图片


默认用户名 admin  密码 password


技术分享图片



技术分享图片


技术分享图片


技术分享图片


技术分享图片


技术分享图片


技术分享图片


技术分享图片


技术分享图片


技术分享图片



技术分享图片


技术分享图片


技术分享图片


技术分享图片



以上是关于cloudstack的主要内容,如果未能解决你的问题,请参考以下文章