一、环境说明
CPU: kunpeng 920
操作系统:OpenEuler 22.03
IP | 角色 |
---|---|
192.168.157.20 | mysql |
192.168.157.21 | management-server 1 |
192.168.157.22 | management-server 2 |
192.168.157.30 | nginx |
二、部署
基础环境准备参考【cloudstack测试环境搭建】
1、部署mysql(测试环境,生产环境请自行调整细节)
#安装
yum install mysql mysql-server
vim /etc/my.cnf
server-id=1
innodb_rollback_on_timeout=1
innodb_lock_wait_timeout=600
max_connections=350
log-bin=mysql-bin
binlog-format = 'ROW'
systemctl start mysqld
systemctl enable mysqld
mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.29 Source distribution
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> alter user root@'localhost' identified by 'qycx@12345678';
Query OK, 0 rows affected (0.00 sec)
mysql> create user root@'192.168.157.0/255.255.255.0' identified by 'qycx@12345678';
Query OK, 0 rows affected (0.01 sec)
mysql> grant all on *.* to root@'192.168.157.0/255.255.255.0' with grant option;
Query OK, 0 rows affected (0.01 sec)
mysql> exit
2、部署第一台cloudstack management
yum localinstall cloudstack-common-4.18.0.0-1.ky10.aarch64.rpm -y
yum localinstall cloudstack-management-4.18.0.0-1.ky10.aarch64.rpm -y
#连接mysql,并通过root账号进行数据库配置,包括创建cloud账号、创建数据库表等
cloudstack-setup-databases cloud:qycx12345678@192.168.157.20 --deploy-as=root:qycx@12345678
#启动
cloudstack-setup-management
3、部署第二台cloudstack management
yum localinstall cloudstack-common-4.18.0.0-1.ky10.aarch64.rpm -y
yum localinstall cloudstack-management-4.18.0.0-1.ky10.aarch64.rpm -y
#连接mysql
cloudstack-setup-databases cloud:qycx12345678@192.168.157.20
#启动
cloudstack-setup-management
4、配置负载均衡
配置负载均衡,需要配置以下三个端口:
源端口 | 目的端口 | 协议 |
---|---|---|
80/443 | 8080 | HTTP |
8250 | 8250 | TCP |
8096 | 8096 | HTTP |
yum install nginx
vim /etc/nginx/nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
upstream backend_web {
ip_hash;
server 10.55.134.17:8080;
server 10.55.134.15:8080;
}
upstream backend_8096 {
ip_hash;
server 10.55.134.17:8096;
server 10.55.134.15:8096;
}
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 4096;
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
server {
listen 80;
listen [::]:80;
server_name _;
location / {
proxy_pass http://backend_web/;
}
}
server {
listen 8096;
listen [::]:8096;
server_name _;
location / {
proxy_pass http://backend_8096/;
}
}
}
#TCP流
stream {
upstream backend_8250 {
hash $remote_addr consistent;
server 10.55.134.17:8250;
server 10.55.134.15:8250;
}
server {
listen 8250;
proxy_pass backend_8250;
}
}
5、修改配置
登录cloudstack UI,【Configuration】-【Global Settings】,搜索host,修改为nginx IP。