# 节点1
galera_new_cluster
# 节点2、3
systemctl start mariadb
# 所有节点
systemctl enable mariadb
# 加固
mysql_secure_installation
# 回车
# n
# y
# 8LB5Lf3Cw3yqqCP9LzcqATZmufIWPnV0
# y
# y
# y
# y
# 检查
mysql -u root -p
sql复制代码
-- wsrep_ready: ON
-- wsrep_connected: ON
-- wsrep_cluster_size: 3
-- wsrep_local_state_comment: Synced
SHOW STATUS LIKE 'wsrep%';
-- local
SELECT host, user FROM user WHERE user = 'root';
haproxy
bash复制代码
# 节点1、2、3
mv /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg.bak
cat > /etc/haproxy/haproxy.cfg << EOF
global
log 127.0.0.1 local2 err
chroot /var/lib/haproxy
maxconn 4096
user haproxy
group haproxy
daemon
defaults
log global
option dontlognull
option redispatch
retries 3
timeout connect 10s
timeout client 1m
timeout server 1m
timeout check 10s
maxconn 3000
# 数据库
listen mariadb
bind 11.1.1.250:3306
mode tcp
option tcplog
balance roundrobin
server cs1 11.1.1.8:3306 check inter 2000 fall 3 rise 2
server cs2 11.1.1.9:3306 check inter 2000 fall 3 rise 2
server cs3 11.1.1.10:3306 check inter 2000 fall 3 rise 2
# cloudstack-management
listen cloudstack
bind 11.1.1.250:18080
mode tcp
option tcplog
balance source
server cs1 11.1.1.8:8080 check inter 2000 fall 3 rise 2
server cs2 11.1.1.9:8080 check inter 2000 fall 3 rise 2
server cs3 11.1.1.10:8080 check inter 2000 fall 3 rise 2
# rgw
listen rgw
bind 11.1.1.250:7480
mode http
balance roundrobin
option httpchk
server cs1 11.1.1.8:7480 check inter 3000 fall 3 rise 2
server cs2 11.1.1.9:7480 check inter 3000 fall 3 rise 2
server cs3 11.1.1.10:7480 check inter 3000 fall 3 rise 2
EOF
systemctl start keepalived && systemctl start haproxy
systemctl status haproxy
systemctl status keepalived
ip a
库与用户
sql复制代码
-- 创建 cloud 用户
CREATE USER 'cloud'@'localhost' IDENTIFIED BY 'Cloud@Cs2026#';
CREATE USER 'cloud'@'127.0.0.1' IDENTIFIED BY 'Cloud@Cs2026#';
CREATE USER 'cloud'@'11.1.1.%' IDENTIFIED BY 'Cloud@Cs2026#';
-- 授权
GRANT ALL PRIVILEGES ON cloud.* TO 'cloud'@'localhost';
GRANT ALL PRIVILEGES ON cloud.* TO 'cloud'@'127.0.0.1';
GRANT ALL PRIVILEGES ON cloud.* TO 'cloud'@'11.1.1.%';
GRANT ALL PRIVILEGES ON cloud_usage.* TO 'cloud'@'localhost';
GRANT ALL PRIVILEGES ON cloud_usage.* TO 'cloud'@'127.0.0.1';
GRANT ALL PRIVILEGES ON cloud_usage.* TO 'cloud'@'11.1.1.%';
-- 创建 root 用户
CREATE USER 'root'@'11.1.1.%' IDENTIFIED BY '8LB5Lf3Cw3yqqCP9LzcqATZmufIWPnV0';
-- 授权
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'11.1.1.%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
exit;
管理节点
bash复制代码
# 节点1
# 建库、建全表、初始化基础数据
cloudstack-setup-databases cloud:Cloud@Cs2026#@11.1.1.250 --deploy-as=root:8LB5Lf3Cw3yqqCP9LzcqATZmufIWPnV0 --force-recreate -i 11.1.1.250
# Mysql user name:cloud [ OK ]
# Mysql user password:****** [ OK ]
# Mysql server ip:11.1.1.250 [ OK ]
# Mysql server port:3306 [ OK ]
# Mysql root user name:root [ OK ]
# Mysql root user password:****** [ OK ]
# Using specified cluster management server node IP 11.1.1.250 [ OK ]
# Checking Cloud database files ... [ OK ]
# Checking local machine hostname ... [ OK ]
# Checking SELinux setup ... [ OK ]
# Preparing /etc/cloudstack/management/db.properties [ OK ]
# Applying /usr/share/cloudstack-management/setup/create-database.sql [ OK ]
# Applying /usr/share/cloudstack-management/setup/create-schema.sql [ OK ]
# Applying /usr/share/cloudstack-management/setup/create-database-premium.sql [ OK ]
# Applying /usr/share/cloudstack-management/setup/create-schema-premium.sql [ OK ]
# Applying /usr/share/cloudstack-management/setup/server-setup.sql [ OK ]
# Applying /usr/share/cloudstack-management/setup/templates.sql [ OK ]
# Processing encryption ... [ OK ]
# Finalizing setup ... [ OK ]
# CloudStack has successfully initialized database, you can check your database configuration in /etc/cloudstack/management/db.properties
# 节点1
# 附加ceph源
dnf install -y centos-release-openstack-caracal
# dnf install -y --downloadonly --downloaddir=/pkg/ceph cephadm ceph-common
cephadm bootstrap --mon-ip 11.1.1.8 --initial-dashboard-user admin --initial-dashboard-password admin123
podman images
quay.io/ceph/ceph v18 0f5473a1e726 10 months ago 1.27 GB
quay.io/ceph/ceph-grafana 9.4.7 954c08fa6188 2 years ago 647 MB
quay.io/prometheus/alertmanager v0.25.0 c8568f914cd2 3 years ago 66.5 MB
quay.io/prometheus/node-exporter v1.5.0 0da6a335fe13 3 years ago 23.9 MB
quay.io/prometheus/prometheus v2.43.0 a07b618ecd1d 2 years ago 235 MB
# 导出镜像
podman save -o ceph.tar ceph:v18
podman save -o ceph-grafana.tar ceph-grafana:9.4.7
podman save -o alertmanager.tar alertmanager:v0.25.0
podman save -o node-exporter.tar node-exporter:v1.5.0
podman save -o prometheus.tar prometheus:v2.43.0
# 导入镜像
podman load -i ceph.tar
podman load -i ceph-grafana.tar
podman load -i alertmanager.tar
podman load -i node-exporter.tar
podman load -i prometheus.tar
# pod tag xxx xxx:v18
bash复制代码
Ceph Dashboard is now available at:
URL: https://cs1:8443/
User: admin
Password: admin123
Enabling client.admin keyring and conf on hosts with "admin" label
Saving cluster configuration to /var/lib/ceph/f053eff2-64ae-11f1-83a4-00155d00017f/config directory
Enabling autotune for osd_memory_target
You can access the Ceph CLI as following in case of multi-cluster or non-default config:
sudo /usr/sbin/cephadm shell --fsid f053eff2-64ae-11f1-83a4-00155d00017f -c /etc/ceph/ceph.conf -k /etc/ceph/ceph.client.admin.keyring
Or, if you are only running a single cluster on this host:
sudo /usr/sbin/cephadm shell
Please consider enabling telemetry to help improve Ceph:
ceph telemetry on
For more information see:
https://docs.ceph.com/en/latest/mgr/telemetry/