1. 首页 > Linux教程 > 正文

Linux教程FG350-大规模存储架构总结

内容简介:本文风哥教程参考Linux官方文档、Red Hat Enterprise Linux官方文档、Ansible Automation Platform官方文档、Docker官方文档、Kubernetes官方文档和Podman官方文档等内容,详细介绍了相关技术的配置和使用方法。

本文档总结大规模存储架构的关键技术和最佳实践。更多视频教程www.fgedu.net.cn

风哥提示:

Part01-存储技术对比

1.1 存储类型对比

# 存储技术对比
[root@storage-admin ~]# cat > /root/storage-comparison.txt << 'EOF' 存储技术对比 ============ 1. DAS(直连存储) 优点: - 成本低,部署简单 - 性能高,延迟低 - 管理简单 缺点: - 扩展性差 - 无法共享 - 单点故障 适用场景:小型环境、数据库服务器 2. NAS(网络附加存储) 优点: - 文件级共享 - 部署简单 - 成本适中 缺点: - 性能受限 - 协议开销 - 扩展性有限 适用场景:文件共享、备份存储 3. SAN(存储区域网络) 优点: - 块级访问 - 性能高 - 扩展性好 缺点: - 成本高 - 管理复杂 - 需要专用网络 适用场景:数据库、虚拟化 4. 分布式存储(Ceph) 优点: - 高扩展性 - 高可用性 - 统一存储接口 - 无单点故障 缺点: - 部署复杂 - 运维要求高 - 网络依赖强 适用场景:云平台、大数据 EOF # 存储协议对比 [root@storage-admin ~]# cat >> /root/storage-comparison.txt << 'EOF' 存储协议对比 ============ 1. NFS - 文件级访问 - TCP/IP网络 - 适合文件共享 2. iSCSI - 块级访问 - TCP/IP网络 - 适合数据库、虚拟化 3. FC(光纤通道) - 块级访问 - 专用网络 - 高性能场景 4. Ceph RADOS - 对象存储 - 统一接口 - 云原生场景 5. S3/Swift - 对象存储 - RESTful API - 云存储场景 EOF

1.2 性能基准测试

# 安装测试工具
[root@storage-admin ~]# dnf install -y fio

# 测试顺序读写
[root@storage-admin ~]# fio –name=seq-read –filename=/data/test –size=10G –bs=1M –rw=read –numjobs=1 –direct=1
seq-read: (g=0): rw=read, bs=(R) 1024KiB-1024KiB学习交流加群风哥QQ113257174, (W) 1024KiB-1024KiB, (T) 1024KiB-1024KiB, ioengine=psync, iodepth=1
fio-3.32
Starting 1 process
seq-read: Laying out IO file (1 file / 10240MiB)
Jobs: 1 (f=1): [R(1)][100.0%][r=1024MiB/s][r=1024 IOPS][eta 00m:00s]
seq-read: (groupid=0, jobs=1): err= 0: pid=12345: Fri Apr 4 20:25:00 2026
read: IOPS=1024, BW=1024MiB/s (1074MB/s)(10.0GiB/10001msec)
clat (usec): min=500, max=2000, avg=976.50, stdev=100.00
lat (usec): min=500, max=2000, avg=976.50, stdev=100.00
clat percentiles (usec):
| 1.00th=[ 600], 5.00th=[ 700], 10.00th=[ 800], 20.00th=[ 900],
| 30.00th=[ 950], 40.00th=[ 950], 50.00th=[ 950], 60.00th=[ 1000],
| 70.00th=[ 1000], 80.00th=[ 1000], 90.00th=[ 1000], 95.00th=[ 1000],
| 99.00th=[ 1500], 99.50th=[ 1500], 99.90th=[ 2000], 99.95th=[ 2000],
| 99.99th=[ 2000]

# 测试随机读写
[root@storage-admin ~]# fio –name=rand-read –filename=/data/test –size=10G –bs=4k –rw=randread –numjobs=4 –direct=1 –iodepth=32
rand-read: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=psync, iodepth=32
fio-3.32
Starting 4 processes
Jobs: 4 (f=4): [r(4)][100.0%][r=500MiB/s][r=128K IOPS][eta 00m:00s]
rand-read: (groupid=0, jobs=4): err= 0: pid=12345: Fri Apr 4 20:26:00 2026
read: IOPS=128k, BW=500MiB/s (524MB/s)(40.0GiB/81920msec)
clat (usec): min=100, max=5000, avg=250.00, stdev=50.00
lat (usec): min=100, max=5000, avg=250.00, stdev=50.00

# 测试混合读写
[root@storage-admin ~]# fio –name=mixed –filename=/data/test –size=10G –bs=4k –rw=randrw –rwmixread=70 –numjobs=4 –direct=1 –iodepth=32
mixed: (g=0): rw=randrw, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=psync, iodepth=32
fio-3.32
Starting 4 processes
mixed: Laying out IO file (1 file / 10240MiB)
Jobs: 4 (f=4): [m(4)][100.0%][r=350MiB/s,w=150MiB/s][r=89.6k,w=38.4k IOPS][eta 00m:00s]
mixed: (groupid=0, jobs=4): err= 0: pid=12345: Fri Apr 4 20:27:00 2026
read: IOPS=89.6k, BW=350MiB/s (367MB/s)(28.0GiB/81920msec)
write: IOPS=38.4k, BW=150MiB/s (157MB/s)(12.0GiB/81920msec)

Part02-架构设计原则

2.1 高可用设计

# 高可用架构设计
[root@storage-admin ~]# cat > /root/ha-design.txt 更多学习教程公众号风哥教程itpux_com<< 'EOF' 高可用存储架构设计 ================== 1. 冗余设计 - 多路径访问 - 控制器冗余 - 电源冗余 - 网络冗余 2. 故障域隔离 - 机架级隔离 - 机房级隔离 - 地域级隔离 3. 数据保护 - 多副本 - 纠删码 - 定期备份 - 灾难恢复 4. 监控告警 - 性能监控 - 容量监控 - 健康检查 - 自动告警 5. 容灾方案 - 同城双活 - 异地灾备 - 多活架构 EOF # 多路径配置 [root@storage-admin ~]# dnf install -y device-mapper-multipath [root@storage-admin ~]# mpathconf --enable [root@storage-admin ~]# cat > /etc/multipath.conf << 'EOF' defaults { user_friendly_names yes find_multipaths yes path_grouping_policy multibus path_selector "round-robin 0" failback immediate no_path_retry 30 } blacklist { devnode "^sda" } EOF [root@storage-admin ~]# systemctl enable --now multipathd Created symlink /etc/systemd/system/multi-user.target.wants/multipathd.service → /usr/lib/systemd/system/multipathd.service. [root@storage-admin ~]# multipath -ll mpatha (36001405b5c5c5c5c5c5c5c5c5c5c5c5c) dm-0 LIO-ORG,storage size=1.0T features='0' hwhandler='1 alua' wp=0 `-+- policy='round-robin 0' prio=50 status=active |- 33:0:0:1 sdb 8:16 active ready running `- 34:0:0:1 sdc 8:32 active ready running

2.2 性能优化

# 存储性能优化
[root@storage-admin ~]# cat > /root/performance-tuning.txt << 'EOF' 存储性能优化 ============ 1. 硬件层面 - 使用SSD缓存 - 配置RAID级别 - 优化网络带宽 - 增加内存缓存 2. 软件层面 - 调整I/O调度器 - 优化文件系统 - 配置缓存策略 - 调整内核参数 3. 网络层面 - 启用Jumbo Frame - 配置网络绑定 - 优化TCP参数 - 使用RDMA 4. 应用层面 - 批量I/O操作 - 异步I/O - 缓存热数据 - 分区管理 EOF # 调整I/O调度器 [root@storage-admin ~]# cat /sys/block/sda/queue/scheduler [mq-deadline] kyber bfq none [root@storage-admin ~]# echo "none" > /sys/block/sda/queue/scheduler
[root@storage-admin ~]# cat /sys/block/sda/queue/scheduler
[none] mq-deadline kyber bfq

# 优化内核参数
[root@storage-admin ~]# cat >> /etc/sysctl.conf << 'EOF' # 存储优化 vm.dirty_ratio = 10 vm.dirty_background_ratio = 5 vm.swappiness = 10 vm.vfs_cache_pressure = 50 # 网络优化 net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 net.ipv4.tcp_rmem = 4096 87380 16777216 net.ipv4.tcp_wmem = 4096 65536 16777216 EOF [root@storage-admin ~]# sysctl -p vm.dirty_ratio = 10 vm.dirty_background_ratio = 5 vm.swappiness = 10 vm.vfs_cache_p学习交流加群风哥微信: itpux-comressure = 50 net.core.rmem_max = 16777216 net.core.wmem_max = 16777216 net.ipv4.tcp_rmem = 4096 87380 16777216 net.ipv4.tcp_wmem = 4096 65536 16777216

Part03-运维最佳实践

3.1 监控与告警

# 存储监控指标
[root@storage-admin ~]# cat > /root/monitoring-metrics.txt << 'EOF' 存储监控指标 ============ 1. 性能指标 - IOPS(每秒I/O操作数) - 吞吐量(MB/s) - 延迟(ms) - 队列深度 2. 容量指标 - 总容量 - 已用容量 - 可用容量 - 增长趋势 3. 健康指标 - 磁盘状态 - 阵列状态 - 控制器状态 - 网络状态 4. 告警阈值 - 容量使用 > 80%
– 延迟 > 10ms
– IOPS > 80%上限
– 磁盘故障
EOF

# 监控脚本
[root@storage-admin ~]# cat > /usr/local/bin/storage-monitor.sh << 'EOF' #!/bin/bash # 存储监控脚本 LOG_FILE="/var/log/storage-monitor.log" ALERT_THRESHOLD=80 # 检查磁盘使用率 check_disk_usage() { df -h | grep -E '^/dev' | while read line; do usage=$(echo $line | awk '{print $5}' | sed 's/%//') mount=$(echo $line | awk '{print $6}') if [ $usage -gt $ALERT_THRESHOLD ]; then echo "$(date): WARNING - $mount usage is ${usage}%" >> $LOG_FILE
fi
done
}

# 检查磁盘健康
check_disk_health() {
for disk in $(ls /dev/sd? 2>/dev/null); do
smartctl -H $disk > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo “$(date): ERROR – $disk health check failed” >> $LOG_FILE
fi
done
}

# 检查RAID状态
check_raid_status() {
if [ -f /proc/mdstat ]; then
status=$(cat /proc/mdstat | grep -c ‘\[U\]’)
total=$(cat /proc/mdstat | grep -o ‘\[.\]’ | wc -l)
if [ $status -ne $total ]; then
echo “$(date): ERROR – RAID array degraded” >> $LOG_FILE
fi
fi
}

# 主函数
main() {
check_disk_usage
check_disk_health
check_raid_status
}

main
EOF

[root@storage-admin ~]# chmod +x /usr/local/bin/storage-monitor.sh

# 配置定时任务
[root@storage-admin ~]# echo “*/5 * * * * /usr/local/bin/storage-monitor.sh” | crontab –

3.2 备份与恢复

# 备份策略
[root@storage-admin ~]# cat > /root/backup-strategy.txt << 'EOF' 备份策略 ======== 1. 备份类型 - 全量备份 - 增量备份 - 差异备份 2. 备份频率 - 关键数据:每日全量 - 重要数据:每周全量+每日增量 - 一般数据:每月全量 3. 备份保留 - 日备份:保留7天 - 周备份:保留4周 - 月备份:保留12个月 - 年备份:保留3年 4. 备份验证 - 定期恢复测试 - 数据完整性校验 - 备份日志审计 EOF # 使用rsync备份 [root@storage-admin ~]# cat > /usr/local/bin/backup.sh << 'EOF' #!/bin/bash SOURCE="/data" DEST="/backup" LOG="/var/log/backup.log" DATE=$(date +%Y%m%d) # 创建备份目录 mkdir -p $DEST/$DATE # 执行备份 rsync -avz --delete $SOURCE/ $DEST/$DATE/ >> $LOG 2>&1

# 清理旧备份
find $DEST -type d -mtime +7 -exec rm -rf {} \;

echo “$(date): Backup completed” >> $LOG
EOF

[root@storage-admin ~]# chmod +x /usr/local/bin/backup.sh
[root@storage-admin ~]# echo “0 2 * * * /usr/local/bin/backup.sh” | crontab –

风哥针对大规模存储架构建议:

  • 根据业务需求选择合适的存储类型
  • 设计高可用架构避免单点故障
  • 建立完善的监控告警体系
  • 制定合理的备份恢复策略
  • 定期进行灾难恢复演练
  • 持续优化存储性能

本文由风哥教程整理发布,仅用于学习测试使用,转载注明出处:http://www.fgedu.net.cn/10327.html

联系我们

在线咨询:点击这里给我发消息

微信号:itpux-com

工作日:9:30-18:30,节假日休息