一、集群规划
通常规定每个IDC为一个zone,每个机架为一个pod(按照42U/13A计算,每个机架防止大约12台物理服务器);
前期不论有多少台服务器,最好的架构设计一定是双pod架构;
最好是用独立的NFS服务器(cpu消耗大,io高,适合独立运行);
参考:
二、服务器规划
1、远程管理(管理卡):
master.cloud.test 远程管理地址:10.10.13.1xx 权限:root/calvin
node1.cloud.test 远程管理地址:10.10.13.1xx 权限:root/calvin
node2.cloud.test 远程管理地址:10.10.13.1xx 权限:root/calvin
2、网络规划
cloudstack测试集群网络地址段:192.168.11.0/20
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.210 ~ 192.168.11.230
#主存储 (nfs) : 192.168.1.1 255.255.240.0 192.168.11.2 P_Storage
#辅存储 (nfs) : 192.168.1.1 255.255.240.0 192.168.11.2 S_Storage01
cloudstack模版地址: http://192.168.x.x/4.5/
cloudstack management 平台地址:
http://192.168.11.2:8080/client/
用户名/密码:admin/password
三、初始化系统
//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
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上都要核对和设置
=====================================================
#核对网卡配置
/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
NM_CONTROLLED=no
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.11.2
NETMASK=255.255.240.0
GATEWAY=192.168.1.1
DNS1=223.5.5.5
DNS2=223.6.6.6
#核对主机名
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.2 master.cloud.test
192.168.11.1 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
#以下内容在master上独立安装
====================================
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:[email protected] --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
#以下内容在node上独立安装
====================================
2: nodes.cloud.test
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
至此安装完成. 访问http://192.168.11.2:8080/client/ 配置和管理集群.
原文地址:https://www.cnblogs.com/gordonchang/p/9003776.html
时间: 2024-10-04 08:15:33