设为首页 收藏本站
查看: 2055|回复: 0

[Cloudstack] CloudStack 4.4学习总结之cloudstack-agent安装

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2014-11-4 08:18:52 | 显示全部楼层 |阅读模式
2、节点安装(cloudstack-agent、KVM):



    注:每个Hypervisor上,都要保证【/mnt】目录为空,否则,可能会出现InsufficientServerCapacityException (服务器资源不足)的报错。



cloud-agent-2.perofu.com和cloud-agent-1.perofu.com的安装步骤一样,即,所有cloudstack-agent节点的安装步骤均一样。



    下面以cloud-agent-1.perofu.com进行演示。


①、以 root 身份登录并设置主机名:

【cloud-agent-1.perofu.com】

hostname cloud-agent-1.perofu.com

vi /etc/sysconfig/network

    HOSTNAME=cloud-agent-1.perofu.com                                          

vi /etc/hosts

    127.0.0.1       cloud-agent-1.perofu.com

    172.22.2.76          cloud-server.perofu.com

    172.22.2.87     cloud-agent-1.perofu.com

    172.22.2.100    cloud-agent-2.perofu.com


②、设置SELinux、关闭iptables并同步时间:

vi /etc/sysconfig/selinux

    SELINUX=disabled

setenforce 0

service iptables stop

chkconfig iptables off

yum install ntpdate -y

echo '#ntpd' >>   /var/spool/cron/root

echo "10 5 * * *   /usr/sbin/ntpdate ntp.api.bz &> /dev/null" >>   /var/spool/cron/root

echo '' >>   /var/spool/cron/root

service ntpd stop

chkconfig ntpd off

/usr/sbin/ntpdate   ntp.api.bz &> /dev/null


③、安装Management agent:



V4.4

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

[cloudstack]  

name=cloudstack  

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

enabled=1  

gpgcheck=0

yum -y install cloudstack-agent





V3.0

tar -axf   CloudStack-oss-3.0.2-1-rhel6.2.tar.gz -C /usr/local/src/

cd   /usr/local/src/CloudStack-oss-3.0.2-1-rhel6.2/

./install.sh

    A                                                                           



    “A”------>    安装 CloudStack Agent 软件, CloudStack客户端。




④、安装KVM虚拟化环境:


1)、查看CPU是否支持虚拟化:



grep -E -o 'vmx|svm' /proc/cpuinfo                                                                             



VMX:它是Intel处理器虚拟机技术标志;

SVM:它是AMD处理器虚拟机技术的标志。



注:linux发行版本必须在64bit环境中才能使用KVM。



[iyunv@localhost ~]# grep -E -o 'vmx|svm'   /proc/cpuinfo                                          

vmx




2)、安装kvm:



         yum源使用的是Centos 6.4的光盘镜像。

yum -y install kvm python-virtinst libvirt tunctl   bridge-utils virt-manager qemu-kvm-tools virt-viewer virt-v2v   libguestfs-tools


3)、修改vnc的监听端口:



         vnc默认的监听127.0.0.1。

         因为,在创建虚拟机时,需要连接vnc,去手动安装新系统。



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

vi /etc/libvirt/qemu.conf

         vnc_listen=0.0.0.0                                                                                                  


4)、配置Libvirt:

vi /etc/libvirt/libvirtd.conf

    listen_tls = 0                                                              

    listen_tcp = 1

    tcp_port = "16509"

    auth_tcp = "none"

    mdns_adv = 0

vi /etc/sysconfig/libvirtd

    LIBVIRTD_ARGS="--listen"

service libvirtd restart

chkconfig libvirtd on


5)、检查KVM是否加载成功:



         如果没有输出信息,则表示没有加载成功。


lsmod | grep kvm                                                                                                         



[iyunv@localhost ~]# lsmod | grep kvm                                                                       

kvm_intel              53484  0

kvm                   316506  1 kvm_intel


6)、检查KVM是否成功安装:



         -all关闭的也会显示。



virsh list --all                     



[iyunv@localhost ~]# virsh list --all

Id      Name                             State

----------------------------------------------------


7)、配置网卡:



    虚拟机的网卡名称是:cloudbr0,不要自作聪明,用了br0,报了一个下午的错。



yum install -y tunctl

cat << EOF > /etc/sysconfig/network-scripts/ifcfg-cloudbr0

DEVICE=cloudbr0

TYPE=Bridge

BOOTPROTO=static

IPV6INIT=no

ONBOOT=yes

IPADDR=172.22.2.87

NETMASK=255.255.0.0

GATEWAY=172.22.1.3

DNS1=8.8.8.8

DELAY=0

EOF



cp /etc/sysconfig/network-scripts/ifcfg-eth0   /etc/sysconfig/network-scripts/bak_ifcfg-eth0

cat << EOF > /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

TYPE=Ethernet

ONBOOT=yes

NM_CONTROLLED=yes

BOOTPROTO=none

BRIDGE=cloudbr0

IPV6INIT=no

EOF



/etc/init.d/network   restart



#查看桥接网络

brctl show



[iyunv@localhost   CloudStack-oss-3.0.2-1-rhel6.2]# ifconfig

cloudbr0   Link   encap:Ethernet  HWaddr   00:0C:29:40:7F:1D

          inet addr:172.22.2.87  Bcast:172.22.255.255  Mask:255.255.0.0

          inet6 addr:   fe80::20c:29ff:fe40:7f1d/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500    Metric:1

          RX packets:226 errors:0 dropped:0   overruns:0 frame:0

          TX packets:28 errors:0 dropped:0   overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:18457 (18.0 KiB)  TX bytes:3116 (3.0 KiB)



eth0      Link encap:Ethernet  HWaddr 00:0C:29:40:7F:1D

          inet6 addr:   fe80::20c:29ff:fe40:7f1d/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500    Metric:1

          RX packets:175448 errors:0   dropped:0 overruns:0 frame:0

          TX packets:94709 errors:0 dropped:0   overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:191337793 (182.4 MiB)  TX bytes:7210912 (6.8 MiB)


⑤、配置cloudstack-agent:



    这里也可以省略,只是在初始化的时候需要手动输入cloudstack-management的ip。



V4.4

vi /etc/cloudstack/agent/agent.properties

#   cloudstack管理服务器地址                                                   

host= 172.22.2.76





V3.0

vi /etc/cloud/agent/agent.properties

#   cloudstack管理服务器地址                                                   

host= 172.22.2.76


⑥、配置nfs域名:



vi /etc/idmapd.conf

Domain   = perofu.com                                                           


⑦、初始化cloudstack-agent:

    一路回车,即可。



V4.4

cloudstack-setup-agent                                                         





V3.0

cloud-setup-agent                                                               



[iyunv@cloud-agent-1   ~]# cloud-setup-agent

Welcome   to Cloud Agent Setup:

Please   input the Management Server Name/IP:[172.22.2.76]

Please   input the Zone Id:[default]

Please   input the Pod Id:[default]

Please   input the Cluster Id:[]

Please   choose which network used to create VM:[br0]

Starting   to configure your system:

Configure   SElinux ...         [OK]

Configure   Network ...         [OK]

Configure   Libvirt ...         [OK]

Configure   Firewall ...        [OK]

Configure   cloudAgent ...      [OK]

Cloud   Agent setup is Done!





Libvirt报错:

[iyunv@cloud-agent-1   ~]# cloud-setup-agent

Welcome   to Cloud Agent Setup:

Please   input the Management Server Name/IP:[172.22.2.76]

Please   input the Zone Id:[default]

Please   input the Pod Id:[default]

Please   input the Cluster Id:[]

Please   choose which network used to create VM:[br0]

Starting   to configure your system:

Configure   SElinux ...         [OK]

Configure   Network ...         [OK]

Configure Libvirt ...         [Failed]

Traceback   (most recent call last):

  File   "/usr/bin/cloud-setup-agent", line 112, in <module>

    syscfg.config()

  File "/usr/lib/python2.6/site-packages/cloudutils/syscfg.py",   line 76, in config

    raise CloudInternalException()

TypeError:   __init__() takes exactly 2 arguments (1 given)



解决:



    Libvirt启动失败,端口没看到。



[iyunv@localhost   CloudStack-oss-3.0.2-1-rhel6.2]# /etc/init.d/libvirtd restart

Stopping   libvirtd daemon:                                  [FAILED]

Starting   libvirtd daemon: libcgroup   initialization failed: Cgroup is not mounted

                                                             [FAILED]

yum list libcgroup -y

vi /etc/cgconfig.conf

    group virt {

        cpu {

                cpu.shares = 9216;

        }

}

/etc/init.d/cgconfig   restart

/etc/init.d/libvirtd   restart

chkconfig cgconfig on


⑧、启动cloud-agent:



    这里,不需要手动启动cloud-agent,当在manager上创建主机时,manager会自动启动cloud-agent的。



/etc/init.d/cloud-agent   start                                                  



    启动失败啊.

2014-09-29   05:54:34,892 INFO  [cloud.agent.Agent]   (main:null) id is

2014-09-29   05:54:35,044{GMT} INFO    [resource.virtualnetwork.VirtualRoutingResource] (main:)   VirtualRoutingResource _scriptDir to use: scripts/network/domr/kvm

2014-09-29   05:54:35,044 INFO    [resource.virtualnetwork.VirtualRoutingResource] (main:null)   VirtualRoutingResource _scriptDir to use: scripts/network/domr/kvm

2014-09-29   05:54:35,050{GMT} INFO    [resource.virtualnetwork.VirtualRoutingResource] (main:) ipassoc.sh   found in /usr/lib64/cloud/agent/./scripts/network/domr/ipassoc.sh

2014-09-29   05:54:35,050 INFO    [resource.virtualnetwork.VirtualRoutingResource] (main:null)   ipassoc.sh found in /usr/lib64/cloud/agent/./scripts/network/domr/ipassoc.sh

2014-09-29   05:54:35,649{GMT} INFO    [resource.computing.LibvirtComputingResource] (main:) agent.properties   found at /etc/cloud/agent/agent.properties

2014-09-29   05:54:35,649 INFO    [resource.computing.LibvirtComputingResource] (main:null)   agent.properties found at /etc/cloud/agent/agent.properties

2014-09-29   05:54:35,657{GMT} INFO    [cloud.agent.Agent] (main:) Agent [id = new : type =   LibvirtComputingResource : zone = default : pod = default : workers = 5 :   host = 172.22.2.76 : port = 8250

2014-09-29   05:54:35,657 INFO  [cloud.agent.Agent]   (main:null) Agent [id = new : type = LibvirtComputingResource : zone =   default : pod = default : workers = 5 : host = 172.22.2.76 : port = 8250

2014-09-29   05:54:35,665{GMT} INFO    [utils.nio.NioClient] (Agent-Selector:) Connecting to 172.22.2.76:8250

2014-09-29   05:54:35,665 INFO    [utils.nio.NioClient] (Agent-Selector:null) Connecting to 172.22.2.76:8250

2014-09-29   05:54:36,096{GMT} INFO    [utils.nio.NioClient] (Agent-Selector:) SSL: Handshake done

2014-09-29   05:54:36,096 INFO    [utils.nio.NioClient] (Agent-Selector:null) SSL: Handshake done

2014-09-29   05:54:36,312{GMT} INFO    [cloud.serializer.GsonHelper] (Agent-Handler-1:) Default Builder   inited.

2014-09-29   05:54:36,312 INFO    [cloud.serializer.GsonHelper] (Agent-Handler-1:null) Default Builder   inited.

2014-09-29   05:54:36,588{GMT} ERROR [cloud.agent.Agent] (Agent-Handler-2:) Not allowed to   connect to the server: java.lang.IllegalArgumentException: Host 172.22.2.87   sent incorrect data center: default

2014-09-29   05:54:36,588 ERROR [cloud.agent.Agent] (Agent-Handler-2:null) Not allowed to   connect to the server: java.lang.IllegalArgumentException: Host 172.22.2.87   sent incorrect data center: default

2014-09-29   05:54:36,591{GMT} INFO    [cloud.agent.Agent] (AgentShutdownThread:) Stopping the agent: Reason = sig.kill

2014-09-29   05:54:36,591 INFO  [cloud.agent.Agent]   (AgentShutdownThread:null) Stopping the agent: Reason = sig.kill


⑨、卸载并清空/mnt目录:



    一定要保证/mnt目录没有被使用,且目录为空,否则CloudStack无法对其挂载Primary Storage,新建实例,可能会失败,除非你有多个agent,/mnt已有的数据,请提前保存好。



umount /mnt                                                   

rm -rf /mnt/*


⑩、等待加入cloudstack:



    到此cloudstack-agent就配置完成了,现在的cloudstack-agent可以在创建区域时加入,也可以在创建完区域后,手动加入,后面均有介绍。





运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-26974-1-1.html 上篇帖子: CloudStack 4.4学习总结之cloudstack-management安装 下篇帖子: CloudStack 4.4学习总结之注册ISO
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表