haproxy-cloudstack

全部:
vi  /etc/sysconfig/network-scripts/ifcfg-ens33 
BOOTPROTO=static
IPADDR=192.168.63.{21,50,22,29}
NETMASK=255.255.255.0
GATEWAY=192.168.63.2
DNS1=8.8.8.8
DNS2=114.114.114.114

systemctl restart network
hostnamectl set-hostname {cs-mgt01,haproxy,cs-mgt02,db-server}
su
防火墙:
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
setenforce 0 
systemctl stop firewalld.service && systemctl disable firewalld.service


50haproxy:
]#vi /etc/hosts
192.168.63.50   haproxy
192.168.63.21   cs-mgt01
192.168.63.22   cs-mgt02
192.168.63.29   db-server

上传Haproxy到/usr/local/src/lua-5.4.4
]#yum install -y gcc gcc-c++ make
]#curl -R -O http://www.lua.org/ftp/lua-5.4.4.tar.gz
]#tar zxf lua-5.4.4.tar.gz -C /usr/local/src/
]#cd /usr/local/src/lua-5.4.4
]#make linux test
]#tar xf haproxy-2.8.4.tar.gz -C /usr/local/src/
]#cd /usr/local/src/haproxy-2.8.4/
]#yum install openssl-devel pcre-devel systemd-devel -y
]#make ARCH=x86_64 TARGET=linux-glibc USE_PCRE=1 USE_OPENSSL=1 USE_ZLIB=1 USE_SYSTEMD=1 USE_LUA=1 LUA_INC=/usr/local/src/lua-5.4.4/src/ LUA_LIB=/usr/local/src/lua-5.4.4/src/

]#make install PREFIX=/usr/local/haproxy
]#ln -sv /usr/local/haproxy/sbin/haproxy /usr/sbin/haproxy
]#vi /usr/lib/systemd/system/haproxy.service
[Unit]
Description=HAProxy Load Balancer
After=syslog.target network.target
[Service]
ExecStartPre=/usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -c -q
ExecStart=/usr/sbin/haproxy -Ws -f /etc/haproxy/haproxy.cfg -p /usr/local/haproxy/haproxy.pid
ExecReload=/bin/kill -USR2 $MAINPID
[Install]
WantedBy=multi-user.target

]#mkdir /etc/haproxy
]#vi /etc/haproxy/haproxy.cfg
global  ##全局配置
        maxconn         10000
        stats socket    /var/run/haproxy.stat mode 600 level admin
        log             127.0.0.1 local2 info
        user            haproxy  ##指定用户
        group           haproxy  ##指定组
        chroot          /usr/local/haproxy  ##服务工作目录
        daemon  ##开启保护进程
defaults  ##默认配置
        mode http
        option httplog
        log global
        timeout client 1m
        timeout server 1m
        timeout connect 10s
        timeout http-keep-alive 2m
        timeout queue 15s
        timeout tunnel 4h  # for websocket
        default-server inter 1000 weight 3
listen app1  ##此部分是前端部分和后端部分的结合
   bind :80  ##监听的端口
   log global
   balance source
   server web1 192.168.63.21:8080 check ##后端的真实服务器地址
   server web2 192.168.63.22:8080 check ##后端的真实服务器地址
listen stats  #配置监听页面
        mode http
        bind :9999  ##使用9999端口
        stats enable
        log global
        stats uri /haproxy-status
        stats auth haadmin:123456  ##指定登录监听页面的用户是haadmin,密码是123456


useradd -r -s /sbin/nologin -d /usr/local/haproxy/ haproxy
systemctl start haproxy.service

查看http://192.168.63.50:9999/haproxy-status

29db-server:
yum install -y mariadb mariadb-server
vi /etc/my.cnf
[mysqld] 
innodb_rollback_on_timeout=1 
innodb_lock_wait_timeout=600 
max_connections=350 
log-bin=mysql-bin 
binlog-format = 'ROW'

systemctl stop firewalld&&systemctl disable firewalld&& setenforce 0
systemctl start mariadb && systemctl enable mariadb
mysql_secure_installation            (    y y n y y)
mysql -uroot -p123456
>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456';
>FLUSH PRIVILEGES;


21cs-mgt01:
yum -y install mariadb
mysql -h 192.168.63.29 -uroot -p123456


29:
yum -y install httpd
yum -y install createrepo
mkdir /opt/cloudstack
ln -s /opt/cloudstack/ /var/www/html/
cd /opt/cloudstack/
createrepo .
yum repolist
systemctl start httpd && systemctl enable httpd

21:
vi /etc/yum.repos.d/http.repo
[cloudstack]
name=cloudstack
baseurl=http://192.168.63.29/cloudstack/
enabled=1
gpgcheck=0

yum repolist    (有10)
yum install -y cloudstack-management
导入CloudStack数据库
]# cloudstack-setup-databases cloud:cloud@192.168.63.29 --deploy-as=root:123456
初始化
cloudstack-setup-management
systemctl start cloudstack-management && systemctl enable cloudstack-management
systemctl status cloudstack-management
systemctl stop cloudstack-management

克隆21->22:
22:
]#systemctl stop cloudstack-management
]#cloudstack-setup-databases cloud:cloud@192.168.63.29 --deploy-as=root:123456
]#cloudstack-setup-management
]#systemctl start cloudstack-management

查看:
http://192.168.63.50:9999/haproxy-status
http://192.168.63.21:8080/
http://192.168.63.22:8080/

  • 8
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值