• cloudstack4.5私有云集群规划与安装


    CloudStack 很轻,可以担的很重!
    cloudstack

    一、集群规划

    版本:cloudstack4.5
    OS:centos6.5
    服务器:3台
    通常规定每个IDC为一个zone,每个机架为一个pod;
    前期不论有多少台服务器,最好的架构设计一定是双pod;
    如果主存储是NFS,放在cloudstack管理节点,有条件的可以用独立的。

    参考:cloudstack名词解释

    二、网络规划

    网络:192.168.1.1/255.255.240.0
    cloudstack集群网络地址段:192.168.11.0 - 192.168.11.254
    cloudstack集群服务器地址:192.168.11.1 - 192.168.11.3

    名称 网关 掩码 ip段
    管理网 192.168.1.1 255.255.240.0 192.168.11.1 ~ 192.168.11.20
    来宾网 192.168.1.1 255.255.240.0 192.168.11.30 ~192.168.11.200
    存储网 192.168.1.1 255.255.240.0 192.168.11.1 ~ 192.168.11.19
    主存储 (nfs) 192.168.1.1 255.255.240.0 192.168.11.2
    辅存储 (nfs) 192.168.1.1 255.255.240.0 192.168.11.2

    三、服务器规划

    主机名称 IP 掩码 用途
    master.cloud.test 192.168.11.1 255.255.240.0 管理节点;注:可同时计算节点,但存储资源需要单独的服务器
    node1.cloud.test 192.168.11.2 255.255.240.0 计算节点
    node2.cloud.test 192.168.11.3 255.255.240.0 计算节点

    四、其他规划

    cloudstack模版地址: http://192.168.x.x/4.5/

    三、初始化系统

    //master,node1,node2上都要执行:

    for i in NetworkManager acpid anacron apmd atd auditd autofs avahi-daemon avahi-dnsconfd bluetooth conman cpuspeed crond cups dnsmasq dund firstboot gpm haldaemon hidd ibmasm ip6tables iptables irda isdn irqbalance kdump kudzu lvm2-monitor mcstrans mdmonitor mdmpd messagebus microcode_ctl multipathd mysqld netconsole netfs netplugd network nfs nfslock nscd ntpd oddjobd pand pcscd portmap psacct rawdevices rdisc readahead_early readahead_later restorecond rpcgssd rpcidmapd rpcsvcgssd saslauthd sendmail setroubleshoot smartd smb snmpd snmptrapd sshd syslog tcsd winbind wpa_supplicant xfs ypbind yum-updatesd postfix auditd blk-availability ip6tables lvm2-monitor netfs udev-post cups nfslock rpcbind portreserve certmonger; do chkconfig $i off; done
    cat >/etc/sysctl.conf <<EOF
    net.ipv4.ip_forward = 1
    net.ipv4.conf.default.rp_filter = 0
    net.ipv4.conf.default.accept_source_route = 0
    kernel.sysrq = 0
    kernel.core_uses_pid = 1
    net.ipv4.tcp_syncookies = 1
    kernel.msgmnb = 65536
    kernel.msgmax = 65536
    kernel.shmmax = 68719476736
    kernel.shmall = 4294967296
    net.ipv4.conf.lo.arp_ignore = 1
    net.ipv4.conf.lo.arp_announce = 2
    net.ipv4.conf.all.arp_ignore = 1
    net.ipv4.conf.all.arp_announce = 2
    #net.ipv4.tcp_max_tw_buckets = 20000
    net.ipv4.tcp_max_tw_buckets = 180000
    net.ipv4.tcp_sack = 1
    net.ipv4.tcp_window_scaling = 1
    net.ipv4.tcp_rmem = 4096        87380   4194304
    net.ipv4.tcp_wmem = 4096        16384   4194304
    net.core.wmem_default = 8388608
    net.core.rmem_default = 8388608
    net.core.rmem_max = 16777216
    net.core.wmem_max = 16777216
    net.core.netdev_max_backlog = 262144
    net.core.somaxconn = 262144
    net.ipv4.tcp_max_orphans = 3276800
    net.ipv4.tcp_max_syn_backlog = 262144
    net.ipv4.tcp_timestamps = 0
    net.ipv4.tcp_synack_retries = 1
    net.ipv4.tcp_syn_retries = 1
    net.ipv4.tcp_tw_recycle = 1
    net.ipv4.tcp_tw_reuse = 1
    net.ipv4.tcp_mem = 94500000 915000000 927000000
    net.ipv4.tcp_fin_timeout = 1
    net.ipv4.tcp_keepalive_time = 30
    net.ipv4.ip_local_port_range = 1024    65000
    vm.min_free_kbytes=409600
    vm.vfs_cache_pressure=200
    vm.swappiness=40
    EOF
    sysctl -p
    sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
    cat >> /etc/security/limits.conf << EOF
    *        soft   nproc  65535
    *        hard   nproc  65535
    *        soft   nofile  65535
    *        hard   nofile  65535
    EOF
    echo "blacklist acpi_pad" >> /etc/modprobe.d/blacklist.conf
    ulimit -SHn 65535
    echo 'syntax on' > /root/.vimrc 2>/dev/null
    sed -i 's/^GSSAPIAuthentication yes$/GSSAPIAuthentication no/' /etc/ssh/sshd_config
    sed -i "s/#UseDNS yes/UseDNS no/" /etc/ssh/sshd_config
    sed -i 's#exec /sbin/shutdown -r now##exec /sbin/shutdown -r now#' /etc/init/control-alt-delete.conf
    sed -i 's/1024/65535/' /etc/security/limits.d/90-nproc.conf
    /bin/cat > /etc/resolv.conf << _resolv
    nameserver 223.5.5.5
    nameserver 223.6.6.6
    _resolv
    /bin/cat > /etc/cron.daily/ntpdate << _ntpdate
    #!/bin/bash
    /usr/sbin/ntpdate 1.cn.pool.ntp.org && /sbin/hwclock --systohc
    _ntpdate
    chmod 755 /etc/cron.daily/ntpdate
    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
    yum -y install wget
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
    yum clean all
    yum makecache
    yum -y install gcc gcc-c++ make autoconf
    yum -y install wget ntp ntpdate vim openssh-clients telnet net-snmp traceroute tcpdump man xinetd rsync screen socat nload sysstat lsof unzip
    

    四、coudstack环境安装

    1: master.cloud.test (管理节点)

    #以下部分在master,node上都要核对和设置
    =====================================================
    #_START_
    #核对网卡配置
    /etc/sysconfig/network-scripts/ifcfg-eth0
    DEVICE=eth0
    NM_CONTROLLED=no
    ONBOOT=yes
    BOOTPROTO=none
    IPADDR=192.168.11.1
    NETMASK=255.255.240.0
    GATEWAY=192.168.1.1
    DNS1=223.5.5.5
    DNS2=223.6.6.6
    
    #node1 - node2 网卡配置略(参照上述配置和主机ip规划)
    
    #核对主机名
    hostname --fqdn
    master.cloud.test
    
    #核对hosts文件
    /etc/hosts
    127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
    192.168.11.1 master.cloud.test
    192.168.11.2 node1.cloud.test
    192.168.11.3 node2.cloud.test
    
    #核对信息如有调整则重启网络
    service network restart
    
    chkconfig ntpd on
    service ntpd start
    
    /bin/cat > /etc/yum.repos.d/cloudstack.repo << _cloudstack
    [cloudstack]
    name=cloudstack
    baseurl=http://192.168.x.x/4.5/
    enabled=1
    gpgcheck=0
    _cloudstack
    #_END_
    
    #以下内容在master上独立安装
    ====================================
    #_START_
    yum -y install nfs-utils
    /bin/cat > /etc/exports << _export
    /secondary *(rw,async,no_root_squash,no_subtree_check)
    /primary *(rw,async,no_root_squash,no_subtree_check)
    _export
    
    mkdir /primary
    mkdir /secondary
    
    vim /etc/idmapd.conf
    Domain = cloud.test
    
    /bin/cat > /etc/sysconfig/nfs << _nfs
    LOCKD_TCPPORT=32803
    LOCKD_UDPPORT=32769
    MOUNTD_PORT=892
    RQUOTAD_PORT=875
    STATD_PORT=662
    STATD_OUTGOING_PORT=2020
    _nfs
    
    service rpcbind start
    service nfs start
    chkconfig rpcbind on
    chkconfig nfs on
    
    yum -y install mysql-server
    
    vim /etc/my.cnf
    following options to the [mysqld] section:
    
    innodb_rollback_on_timeout=1
    innodb_lock_wait_timeout=600
    max_connections=350
    log-bin=mysql-bin
    binlog-format = 'ROW'
    
    service mysqld start
    chkconfig mysqld on
    
    yum -y install cloudstack-management
    
    cloudstack-setup-databases cloud:password@localhost --deploy-as=root
    
    cloudstack-setup-management
    
    /usr/share/cloudstack-common/scripts/storage/secondary/cloud-install-sys-tmplt 
    -m /secondary 
    -u http://192.168.x.x/4.5/systemvm64template-4.6.0-kvm.qcow2.bz2 
    -h kvm -F
    
    /etc/sysconfig/iptables
    -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT 
    -A INPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT 
    -A INPUT -p tcp -m state --state NEW -m tcp --dport 8000 -j ACCEPT 
    -A INPUT -m state --state NEW -p udp --dport 111 -j ACCEPT
    -A INPUT -m state --state NEW -p tcp --dport 111 -j ACCEPT
    -A INPUT -p tcp -m state --state NEW -p tcp --dport 2049 -j ACCEPT
    -A INPUT -p tcp -m state --state NEW -p tcp --dport 32803 -j ACCEPT
    -A INPUT -p tcp -m state --state NEW -p udp --dport 32769 -j ACCEPT
    -A INPUT -p tcp -m state --state NEW -p tcp --dport 892 -j ACCEPT
    -A INPUT -p tcp -m state --state NEW -p udp --dport 892 -j ACCEPT
    -A INPUT -p tcp -m state --state NEW -p tcp --dport 875 -j ACCEPT
    -A INPUT -p tcp -m state --state NEW -p udp --dport 875 -j ACCEPT
    -A INPUT -p tcp -m state --state NEW -p tcp --dport 662 -j ACCEPT
    -A INPUT -m state --state NEW -p udp --dport 662 -j ACCEPT
    #_END_
    #以下内容在node上独立安装
    ====================================
    

    2: nodes.cloud.test

    #_START_
    yum -y install cloudstack-agent
    
    vim  /etc/libvirt/qemu.conf 
    vnc_listen = "0.0.0.0"
    
    /bin/cat > /etc/libvirt/libvirtd.conf << _libvirt
    listen_tls = 0
    listen_tcp = 1
    tcp_port = "16509"
    auth_tcp = "none"
    mdns_adv = 0
    _libvirt
    
    vim /etc/sysconfig/libvirtd
    LIBVIRTD_ARGS="--listen"
    
    service libvirtd restart
    
    lsmod | grep kvm
    kvm_intel              55496  0
    kvm                   337772  1 kvm_intel
    #_END_
    

    至此安装完成. 访问http://192.168.11.1:8080/client/ 配置和管理集群.
    用户名/默认密码:admin/password

    CloudStack 很轻,可以担的很重!

    本文系作者原创,转载请注明出处。如您阅读的是转载,请最好再看下原文,原文随时会更新和勘误的。

    @Gordon_chang
    1997年毕业于北京联合大学,先后在中国万网,新媒传信,亚信等公司工作,现在在一家创业型公司担任云计算与大数据运维方面的 PM & Engineer。 专注于以下四个领域: 分布式存储 分布式数据库 云计算 大数据 重点通过技术架构与性能优化(底层)实现基于私有云的大数据平台能力

  • 相关阅读:
    Java 多线程概述
    Java 线程的创建和启动
    状态模式
    Spring 依赖注入
    Spring IOC
    在JavaEE中使用Mybatis框架
    Active Reports 补空白行
    SpreadForWin 清空Sheet
    日期格式转换
    Select Case 的实现
  • 原文地址:https://www.cnblogs.com/gordonchang/p/9003776.html
Copyright © 2020-2023  润新知