汕尾海湾 发表于 2022-6-21 14:18:53

【五一专属】阿里云ECS大测评#五一专属|向所有热爱分享的“技术劳动者”致

本篇博客参与阿里云 ECS实例测评,这里采用阿里的C5.large计算型实例

本次对云服务器ECS产品能力的体验和建议,可帮助其他用户选用云服务,使用云服务器ECS创建应用场景测评

首先对实例的硬件(CPU,内存,磁盘)进行测试,采用对比对象为AWS的C5,C5a同等大小实例进行对比,在本篇的“目录二,目录三”可以看到。

其次"使用云服务器ECS创建应用场景测评,基于阿里云ECS c5.large搭建云上博客,论坛,家庭云,Gitlab协同办公",这里根据一般用户的常见使用场景,进行了基于阿里云 ECS c5.large采取LAMP、LNMP架构搭建Wordpress场景,LAMP搭建Discuz!论坛场景,安装CasaOS家庭云私人NAS场景,安装极狐GitLab 一体化 DevOps 平台场景。希望这篇文章对您有帮助,也让你在众多服务商中采买自己需要的服务器。

本篇阅读预计需要45分钟。

对应的视频

阿里云社区:https://developer.aliyun.com/live/249082

BiliBili平台:https://www.bilibili.com/video/BV1iL4y1F7nm

文章目录:


[*]一、实例控制台对比

[*]1.阿里云

[*]A.自定义购买
[*]B.快速购买

[*]2.AWS

[*]二、实例类型对比

[*]1.阿里云 C5实例族介绍
[*]2.AWS EC2 C5.large和C5a.large介绍
[*]3.型号对比总结

[*]三、同比类型性能测试

[*]1.CPU测试(GeekBench 5 对实例进行测试)

[*]A.本次测试采集到测试对象的CPU型号
[*]B.测试命令
[*]C.测试结果
[*]D.CPU汇总测试对比

[*]2.块存储性能测试

[*]1.hdparm测试硬盘性能
[*]2.使用dd命令对磁盘进行性能测试
[*]3.Fio工具测试硬盘

[*]3.内存性能测试

[*]查看内存信息
[*]内存写入、读取测试(左侧阿里云—右侧AWS)


[*]四、服务搭建对比测试

[*]1.基于LAMP架构搭建WordPress个人博客(CentOS 7)
[*]2.基于LNMP架构搭建WordPress个人博客(CentOS 7)
[*]3.基于Aliux 3系统搭建LAMP架构部署Wordpress个人博客
[*]4.基于Aliux 3系统搭建LNMP架构部署Wordpress个人博客
[*]5.基于LAMP架构部署Discuz论坛(CentOS 7)
[*]6.基于ubuntu搭建CasaOS 家庭云
[*]7.基于Ubuntu 20.04 64安装私有化部署版极狐GitLab

[*]总结
一、实例控制台对比

二、实例类型对比

三、同比类型性能测试

四、服务搭建对比测试

一、实例控制台对比

1.阿里云:

A.自定义购买:

首先打开阿里云的ECS实例控制台,可以在概览面板中很清晰的看到创建实例
https://img-blog.csdnimg.cn/img_convert/b9d22c2f1a1e27863bccee55502af349.png
点击创建实例后,会弹出一个新的浏览器页面,其中定义了快速购买和自定义购买两个面板模块,很清晰的显示出用户的购买实例的付费模式,购买地域,可用区,实例的规格,数量,存储等,按照流程走,到确认订单,一共是五个步骤
https://img-blog.csdnimg.cn/img_convert/ecd2e8277ba4a380af6bd4a01ff428c8.png
https://img-blog.csdnimg.cn/img_convert/e232397b1860706e3a16b9f9d15e8b83.png
B.快速购买:

相较于自定义购买,用户可以在快速购买界面实现直接下单,而不需要再跳转到其他页面进行额外设置
https://img-blog.csdnimg.cn/img_convert/3cb9c5ef76d47bb5d0a060aee428ffc0.png
https://img-blog.csdnimg.cn/img_convert/75934cef2bca42655065eab3af402315.png
2.AWS:

进入到EC2控制台
https://img-blog.csdnimg.cn/img_convert/2328bda65efb00a5ad7956215281983b.png
点击启动实例后,会进入创建实例页面,需对实例进行配置
包括:实例名称,镜像,实例规格,安全组,密钥,网络,存储大小等
https://img-blog.csdnimg.cn/img_convert/3428419b5bf0588284cf8da2705d2148.png
https://img-blog.csdnimg.cn/img_convert/d272d3b78069abb9397db67c25a553a9.png
https://img-blog.csdnimg.cn/img_convert/9830fb7ffb83aa169e95ad9e0fc37504.png
二、实例类型对比

#### 阿里云官方不同应用场景推荐 ![](https://img-blog.csdnimg.cn/img_convert/e405cc7045aef17c5840ae39c2bef0d1.png) 1.阿里云 C5实例族介绍,引用官方文档

计算型实例规格族c5
c5的特点如下:


[*] 计算:

[*] 处理器与内存配比为1:2
[*] 处理器:2.5 GHz主频的Intel ® Xeon ® Platinum 8163(Skylake)或者8269CY(Cascade Lake),计算性能稳定
         说明 该规格族的实例有可能部署在不同的服务器平台,如果您的业务需要将实例部署在同一服务器平台,建议您选用c6、c6e、c7。

[*] 存储:

[*]I/O优化实例
[*]支持ESSD云盘、SSD云盘和高效云盘         说明 不同实例规格族的云盘性能上限不同,本规格族的单台实例最高支持20万IOPS

[*] 网络:

[*]支持IPv6
[*]超高网络PPS收发包能力
[*]实例网络性能与计算规格对应(规格越高网络性能越强)

[*] 适用场景:

[*]高网络包收发场景,例如视频弹幕、电信业务转发等
[*]Web前端服务器
[*]大型多人在线游戏(MMO)前端
[*]数据分析、批量计算、视频编码
[*]高性能科学和工程应用
c5包括的实例规格及指标数据如下表所示

实例规格vCPU内存网络带宽(Gbit/s)网络收发包PPS多队列弹性网卡单网卡私有IPecs.c5.large24130万226https://img-blog.csdnimg.cn/img_convert/b5d4939a91e2ea55689c305c44172bf3.png
2.AWS EC2 C5.large和C5a.large实例,引用AWS官方文档解释

https://img-blog.csdnimg.cn/9751d907ebab41f3b0675f2fdc954569.png
Amazon EC2 C5 实例针对计算密集型工作负载进行了优化,并按计算比率以较低的价格提供经济高效的高性能。

特点:


[*]C5 实例根据实例的大小提供处理器选项。
[*]新的 C5 和 C5d 12xlarge、24xlarge 和 Metal 实例大小采用定制的第二代 Intel Xeon 可扩展处理器 (Cascade Lake),具有 3.6GHz 的持续全核 Turbo 频率和高达 3.9GHz 的单核 Turbo 频率。
[*]其他 C5 实例尺寸将在第二代 Intel Xeon 可扩展处理器 (Cascade Lake) 或第一代 Intel Xeon Platinum 8000 系列 (Skylake-SP) 处理器上启动,具有高达 3.4GHz 的持续全核 Turbo 频率,以及高达 3.5GHz 的单核 Turbo 频率。
[*]新的较大型 24xlarge 实例大小提供 96 个 vCPUs、192 GiB 内存和可选的 3.6TB 基于 NVMe 的本地 SSD
[*]需要包含 ENA 和 NVMe 驱动程序的 HVM AMI
[*]Elastic Network Adapter (ENA) 为 C5 实例提供高达 25Gbps 的网络带宽和高达 19Gbps 的 Amazon EBS 专用带宽。
[*]由 AWS Nitro 系统(专用硬件和轻量级管理程序的组合)提供支持
型号vCPU内存实例存储 (GB)网络带宽 (Gbps)EBS 带宽 (Mbps)ecs.c5.large24仅限 EBS最高 10最高 4750Amazon EC2 C5a 实例可为众多计算密集型工作负载提供一流的 x86 性价比。
特点:


[*]第二代 AMD EPYC 7002 系列处理器,运行频率高达 3.3GHz
[*]Elastic Network Adapter (ENA) 为 C5a 实例提供高达 20 Gbps 的网络带宽和高达 9.5 Gbps 的 Amazon EBS 专用带宽
[*]由 AWS Nitro 系统(专用硬件和轻量级管理程序的组合)提供支持
型号vCPU内存实例存储 (GB)网络带宽 (Gbps)EBS 带宽 (Mbps)c5a.large24仅限 EBS最高 10最高 3170https://img-blog.csdnimg.cn/img_convert/9a5ade692e1075c0e5b988248387c097.png
https://img-blog.csdnimg.cn/img_convert/a6325246fd6d70c97a1b411f1a48d738.png
3.型号对比总结:

Aliyun ecs.c5.large 高效云盘版AWS C5.large EBS SSD gp2AWS C5a.large EBS SSD gp2CPU型号2.5 GHz主频的Intel ® Xeon ® Platinum 8163(Skylake)或者8269CY(Cascade Lake)第二代 Intel Xeon 可扩展处理器 (Cascade Lake) 或第一代 Intel Xeon Platinum 8000 系列 (Skylake-SP) 处理器第二代 AMD EPYC 7002vCPU222内存4G4G4G网络带宽(Gbit/s)1Gbps最高 10Gbps最高 10Gbps块存储带宽高效云盘最高140Mbps最高 4750Mbps最高 3170Mbps三、同比类型性能测试

## 1.CPU测试 **GeekBench 5 对实例进行测试** 这里采用阿里云 Aliyun ecs.c5.large 高效云盘版 对比 AWS EC2 C5.large 和 C5a.large,为保证考虑到C5采用Intel芯片的差异性,这里采用2台C5.large、1台C5a.large进行测试
A.本次测试采集到测试对象的CPU型号如下

实例CPU型号Aliyun ecs.c5.largeIntel Xeon Platinum 8163 @ 2.50 GHz 1 Processor, 1 Core, 2 ThreadsAmazon EC2 c5.largeIntel Xeon Platinum 8275CL @ 3.64 GHz 1 Processor, 1 Core, 2 ThreadsAmazon EC2 c5.largeIntel Xeon Platinum 8124M @ 3.45 GHz 1 Processor, 1 Core, 2 ThreadsAmazon EC2 c5a.largeAMD EPYC 7R32 @ 3.31 GHz 1 Processor, 1 Core, 2 ThreadsB.测试命令如下:

sudo wget https://cdn.geekbench.com/Geekbench-5.4.1-Linux.tar.gz
tar xf Geekbench-5.4.1-Linux.tar.gz
cd Geekbench-5.4.1-Linux
./geekbench5 C.测试结果如下

①.Aliyun ecs.c5.large

Intel Xeon Platinum 8163 @ 2.50 GHz 1 Processor, 1 Core, 2 Threads


[*] Geekbench5 检测系统信息
https://img-blog.csdnimg.cn/img_convert/c5fefb985dce9a9068dd9ec7c63c0776.png
[*] 单核测试项目
https://img-blog.csdnimg.cn/img_convert/cc1c2091078703fa0f79a80ffbca6011.png
[*] 多核测试项目
https://img-blog.csdnimg.cn/img_convert/6cd2bf2be16f691a8466a1150abc6fa4.png
[*] 测试结果链接
https://img-blog.csdnimg.cn/img_convert/cbb6a50b4b94da389c4534a9ab103cff.png
[*] 测试结果图
https://img-blog.csdnimg.cn/img_convert/aed09ea5df85202181133ab8fdb1a1bb.png
②.Amazon EC2 c5.large

Intel Xeon Platinum 8275CL @ 3.64 GHz 1 Processor, 1 Core, 2 Threads


[*] Geekbench5 检测系统信息
https://img-blog.csdnimg.cn/img_convert/ede29ceba38e55dd95513d2757a51690.png
[*] 单核测试项目
https://img-blog.csdnimg.cn/img_convert/164a68b240a0a27581548e880552a925.png
[*] 多核测试项目
https://img-blog.csdnimg.cn/img_convert/6a67a154655b608bf070b0aa1c02e9b6.png
[*] 测试结果链接
https://img-blog.csdnimg.cn/img_convert/7bc290177aa49694271a4e6ead56009a.png
[*] 测试结果图
https://img-blog.csdnimg.cn/img_convert/880db1b3d565e742e5a8addd5428da9e.png
③.Amazon EC2 c5.large

Intel Xeon Platinum 8124M @ 3.45 GHz 1 Processor, 1 Core, 2 Threads


[*] Geekbench5 检测系统信息
https://img-blog.csdnimg.cn/img_convert/cf636cf261b7381aca8e3c10aa391697.png
[*] 单核测试项目
https://img-blog.csdnimg.cn/img_convert/f4d3fea329cb5b4d0b4153ca8a775271.png
[*] 多核测试项目
https://img-blog.csdnimg.cn/img_convert/26373baec45148d7159185a5881c4b9b.png
[*] 测试结果链接
https://img-blog.csdnimg.cn/img_convert/2a6c8aa4e62acabcd127203461f12a68.png
[*] 测试结果图
https://img-blog.csdnimg.cn/img_convert/ddbb347b82c135a1f88bb46b83cc46e9.png
④.Amazon EC2 c5a.large

AMD EPYC 7R32 @ 3.31 GHz 1 Processor, 1 Core, 2 Threads


[*] Geekbench5 检测系统信息
https://img-blog.csdnimg.cn/img_convert/ebe13fe5eb7f61cb73a1365662292bf7.png
[*] 单核测试项目
https://img-blog.csdnimg.cn/img_convert/8e3fbd3fdb7446964cbf46abec95d17c.png
[*] 多核测试项目
https://img-blog.csdnimg.cn/img_convert/86ed4a0358b2b201ff96d7043f71192f.png
[*] 测试结果链接
https://img-blog.csdnimg.cn/img_convert/3e5efe14274ac714b6304c2f4e5e3541.png
[*] 测试结果图
https://img-blog.csdnimg.cn/img_convert/63ad94a478b42e809553f15f65262d2f.png
D.CPU汇总测试对比

对比测试链接:
8163 VS 8275CL
https://browser.geekbench.com/v5/cpu/compare/14590617?baseline=14590554
8163 VS 8124M
https://browser.geekbench.com/v5/cpu/compare/14590617?baseline=14591215
Intel Xeon Platinum 8163 @ 2.50 GHz VS AMD EPYC 7R32 @ 3.31 GHz
https://browser.geekbench.com/v5/cpu/compare/14590617?baseline=14594576
Aliyun ecs.c5.large
Intel Xeon Platinum 8163 @ 2.50 GHz 1 Processor, 1 Core, 2 Threads 对比 AWS EC2 C5.Large Intel Xeon Platinum 8275CL @ 3.64 GHz 1 Processor, 1 Core, 2 Threads
https://img-blog.csdnimg.cn/img_convert/9e677c56b653d9bba0df39410bb6c252.png
Aliyun ecs.c5.large
Intel Xeon Platinum 8163 @ 2.50 GHz 1 Processor, 1 Core, 2 Threads 对比 Amazon EC2 c5.large Intel Xeon Platinum 8124M @ 3.45 GHz 1 Processor, 1 Core, 2 Threads
https://img-blog.csdnimg.cn/img_convert/42dab2dff8f37711bfa0c608a3413c94.png
Aliyun ecs.c5.large
Intel Xeon Platinum 8163 @ 2.50 GHz 1 Processor, 1 Core, 2 Threads 对比 Amazon EC2 c5a.large AMD EPYC 7R32 @ 3.31 GHz 1 Processor, 1 Core, 2 Threads
https://img-blog.csdnimg.cn/img_convert/336e728297d3fb7a6aab1d0bce8a63a5.png
2.块存储性能测试

1.hdparm测试硬盘性能

显示硬盘的相关信息
# hdparm /dev/vda
评估硬盘的读取效率
# hdparm -t /dev/vda
测试硬盘缓存的读取速度
# hdparm -T /dev/vda
直接测试硬盘的读性能
# hdparm -tT --direct /dev/vda
查看DMA情况
# hdparm -cdt /dev/vda 2.使用dd命令对磁盘进行性能测试

dd测试脚本

# cat disk.sh
echo "test 10G"
time sh -c "dd if=/dev/zero of=./ddfile bs=1M count=10240 oflag=direct && sync";
rm ./ddfile;

echo "test 1G/1M"
time sh -c "dd if=/dev/zero of=./ddfile bs=1M count=1024 oflag=direct && sync";
rm ./ddfile;

echo "test 1G/512K"
time sh -c "dd if=/dev/zero of=./ddfile bs=512k count=2048 oflag=direct && sync";
rm ./ddfile;

echo "test 1G/256K"
time sh -c "dd if=/dev/zero of=./ddfile bs=256k count=4096 oflag=direct && sync";
rm ./ddfile;

echo "test 1G/256K"
time sh -c "dd if=/dev/zero of=./ddfile bs=256k count=8192 oflag=direct && sync";
rm ./ddfile;

echo "test 1G/4K"
time sh -c "dd if=/dev/zero of=./ddfile bs=4k count=262144 oflag=direct && sync";
rm ./ddfile; dd测试结果如下

AWS EBS SSD gp2 20G

# bash disk.sh
test 10G
10240+0 records in
10240+0 records out
10737418240 bytes (11 GB) copied, 78.9134 s, 136 MB/s

real    1m18.923s
user    0m0.005s
sys   0m1.313s
test 1G/1M
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 7.98374 s, 134 MB/s

real    0m7.990s
user    0m0.007s
sys   0m0.131s
test 1G/512K
2048+0 records in
2048+0 records out
1073741824 bytes (1.1 GB) copied, 7.98495 s, 134 MB/s

real    0m7.991s
user    0m0.006s
sys   0m0.149s
test 1G/256K
4096+0 records in
4096+0 records out
1073741824 bytes (1.1 GB) copied, 7.98434 s, 134 MB/s

real    0m7.987s
user    0m0.002s
sys   0m0.159s
test 1G/256K
8192+0 records in
8192+0 records out
2147483648 bytes (2.1 GB) copied, 15.9784 s, 134 MB/s

real    0m15.981s
user    0m0.011s
sys   0m0.303s
test 1G/4K
262144+0 records in
262144+0 records out
1073741824 bytes (1.1 GB) copied, 127.651 s, 8.4 MB/s

real    2m7.655s
user    0m0.286s
sys   0m2.382s
# 阿里云 EBS 高效云盘 20G

# bash disk.sh
test 10G
10240+0 records in
10240+0 records out
10737418240 bytes (11 GB) copied, 99.4206 s, 108 MB/s

real    1m39.440s
user    0m0.028s
sys   0m1.916s
test 1G/1M
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB) copied, 9.9211 s, 108 MB/s

real    0m9.942s
user    0m0.003s
sys   0m0.206s
test 1G/512K
2048+0 records in
2048+0 records out
1073741824 bytes (1.1 GB) copied, 9.93499 s, 108 MB/s

real    0m9.955s
user    0m0.003s
sys   0m0.221s
test 1G/256K
4096+0 records in
4096+0 records out
1073741824 bytes (1.1 GB) copied, 9.90859 s, 108 MB/s

real    0m9.927s
user    0m0.006s
sys   0m0.256s
test 1G/256K
8192+0 records in
8192+0 records out
2147483648 bytes (2.1 GB) copied, 19.87 s, 108 MB/s

real    0m19.889s
user    0m0.014s
sys   0m0.496s
test 1G/4K
262144+0 records in
262144+0 records out
1073741824 bytes (1.1 GB) copied, 132.547 s, 8.1 MB/s

real    2m12.565s
user    0m0.284s
sys   0m6.281s
# 3.Fio工具测试硬盘

官方文档测试指定测试工具— FIO
这里查阅两家云服务商提供的文档,都明确使用fio工具进行云盘的基准测试
操作步骤

1.远程连接ECS实例
采用SecureCRT进行连接
https://img-blog.csdnimg.cn/img_convert/d91e262bbd71cba5020550605846b59a.png
2.查询块存储设备是否已经4KiB对齐
sudo fdisk -lu 返回的结果中,Start值能被8整除即是4KiB对齐。否则,请完成4KiB对齐后再继续性能测试。
3.依次运行以下命令安装libaio和FIO。
sudo yum install libaio -y
sudo yum install libaio-devel -y
sudo yum install fio -y 4.对硬盘进行分区和格式化。
磁盘分区示例,以亚马逊为例

[*] 使用fdisk查看挂载的磁盘
https://img-blog.csdnimg.cn/img_convert/0173dfe59416218ea057a78d65b78be5.png
[*] fdisk 对磁盘进行分区
https://img-blog.csdnimg.cn/img_convert/aa3ccf7f45f5ca2e3708ab36d81aee8b.png
[*] fdisl -l 查看分区结果
https://img-blog.csdnimg.cn/img_convert/fb760f3e61a7cf5cd25738c5d83e2086.png
[*] 使用 mkfs 对磁盘进行格式化
https://img-blog.csdnimg.cn/img_convert/3b5d4b5c08724a42909d4b83a189d22b.png
[*] 使用lsblk查看
https://img-blog.csdnimg.cn/img_convert/b8e0c4d249d3630a55a6de2712e3fc27.png
云盘性能测试命令

说明 本示例中,使用的设备名为 /dev/your_device,请您根据实际情况替换。例如需要测试的云盘为 /dev/vdb ,则将以下示例命令中的 /dev/your_device 替换为 /dev/vdb
随机写IOPS:
fio -direct=1 -iodepth=128 -rw=randwrite -ioengine=libaio -bs=4k -size=1G -numjobs=1 -runtime=1000 -group_reporting -filename=/dev/your_device -name=Rand_Write_Testing 阿里云 高效云盘
https://img-blog.csdnimg.cn/img_convert/2790468b676d3fe62ace78f535df331f.png
亚马逊 AWS SSD GP2
https://img-blog.csdnimg.cn/img_convert/b257579b0885f9fb944b65e9c3dc5317.png
随机读IOPS:
fio -direct=1 -iodepth=128 -rw=randread -ioengine=libaio -bs=4k -size=1G -numjobs=1 -runtime=1000 -group_reporting -filename=/dev/your_device -name=Rand_Read_Testing 阿里云 高效云盘
https://img-blog.csdnimg.cn/img_convert/de7a29531451c67940937575fb62e487.png
亚马逊 AWS SSD GP2
https://img-blog.csdnimg.cn/img_convert/716ea1b36a9c9b0b0b2ddc1498599ccc.png
顺序写吞吐量:
fio -direct=1 -iodepth=64 -rw=write -ioengine=libaio -bs=1024k -size=1G -numjobs=1 -runtime=1000 -group_reporting -filename=/dev/your_device -name=Write_PPS_Testing 阿里云 高效云盘
https://img-blog.csdnimg.cn/img_convert/d183cfa0f15c2d5ed3b22fb49dc04b92.png
亚马逊 AWS SSD GP2
https://img-blog.csdnimg.cn/img_convert/76176fd2d98c4227d08b61db4308c601.png
顺序读吞吐量:
fio -direct=1 -iodepth=64 -rw=read -ioengine=libaio -bs=1024k -size=1G -numjobs=1 -runtime=1000 -group_reporting -filename=/dev/your_device -name=Read_PPS_Testing 阿里云 高效云盘
https://img-blog.csdnimg.cn/img_convert/0a6996355edcec55ebfd0d7d9e2d698d.png
亚马逊 AWS SSD GP2
https://img-blog.csdnimg.cn/img_convert/17c8ff2174daf95c85b64bf62ea3ede6.png
随机写时延:
fio -direct=1 -iodepth=1 -rw=randwrite -ioengine=libaio -bs=4k -size=1G -numjobs=1 -group_reporting -filename=/dev/your_device -name=Rand_Write_Latency_Testing 阿里云 高效云盘
https://img-blog.csdnimg.cn/img_convert/1e392eaf70ea00383c394cc4f1decbd6.png
亚马逊 AWS SSD GP2
https://img-blog.csdnimg.cn/img_convert/ae4d8edd04e54363fab50d9dea543500.png
随机读时延:
fio -direct=1 -iodepth=1 -rw=randread -ioengine=libaio -bs=4k -size=1G -numjobs=1 -group_reporting -filename=/dev/your_device -name=Rand_Read_Latency_Testing 阿里云 高效云盘
https://img-blog.csdnimg.cn/img_convert/1369c3106ef37b96497603ad9ec2bd2b.png
亚马逊 AWS SSD GP2
https://img-blog.csdnimg.cn/img_convert/1907910be5bd42024d7cfc86145a6e58.png
以下命令可执行 16 KB 随机写入操作。
sudo fio --filename=/dev/your_device --ioengine=psync --name fio_test_file --direct=1 --rw=randwrite --bs=16k --size=1G --numjobs=16 --time_based --runtime=180 --group_reporting --norandommap 阿里云 高效云盘
https://img-blog.csdnimg.cn/img_convert/e4a75e010905b32929e680448197eec9.png
亚马逊 AWS SSD GP2
https://img-blog.csdnimg.cn/img_convert/2e91cdb2375059bc170f723a32e4d31f.png
以下命令可执行 16 KB 随机读取操作。
sudo fio --filename=/dev/your_device --name fio_test_file --direct=1 --rw=randread --bs=16k --size=1G --numjobs=16 --time_based --runtime=180 --group_reporting --norandommap 阿里云 高效云盘
https://img-blog.csdnimg.cn/img_convert/3df5f0a240a6f8024cfcfdd9e6b0645a.png
亚马逊 AWS SSD GP2
https://img-blog.csdnimg.cn/img_convert/d5b23385110e60ba13c4d3f3234fc063.png
以下命令执行 1 MiB 的顺序读取操作:
sudo fio --filename=/dev/<device> --direct=1 --rw=read --randrepeat=0 --ioengine=libaio --bs=1024k --iodepth=8 --time_based=1 --runtime=180 --name=fio_direct_read_test 阿里云 高效云盘
https://img-blog.csdnimg.cn/img_convert/0c277339634e2c452b801afe09308675.png
亚马逊 AWS SSD GP2
https://img-blog.csdnimg.cn/img_convert/a4bc9c5f0558e076bdfd126fb643619a.png
以下命令针对块储存设备执行 1 MiB 的顺序写入操作:
sudo fio --filename=/dev/<device> --direct=1 --rw=write --randrepeat=0 --ioengine=libaio --bs=1024k --iodepth=8 --time_based=1 --runtime=180 --name=fio_direct_write_test 阿里云 高效云盘
https://img-blog.csdnimg.cn/img_convert/189ef89966e01e8d7e93c8860ca55513.png
亚马逊 AWS SSD GP2
https://img-blog.csdnimg.cn/img_convert/dc7b285b3a1247fe6f882ef155d7048b.png
3.内存性能测试

查看内存信息

https://img-blog.csdnimg.cn/img_convert/f7791dddb382dbbf06ec043710d87057.png
内存写入、读取测试(左侧阿里云—右侧AWS)

# time sh -c "dd if=/dev/zero of=/dev/shm/fill bs=1M count=10240"#写入测试
# time sh -c "dd if=/dev/shm/fill of=/dev/null bs=1M count=10240"#读取测试 https://img-blog.csdnimg.cn/img_convert/a678626bd04d65ea9d31013cc8173d47.png
四、服务搭建对比测试

1. 基于LAMP架构搭建WordPress个人博客(CentOS 7)

1.安装mariadb,php,http等服务

yum -y install mariadb mariadb-server php php-server wget php-fpm php-mysql 2.启动httpd,mariadb,并初始化mairadb

systemctl start mariadb httpd 3.初始化数据库

mysql_secure_installation#设置数据库root用户密码 https://img-blog.csdnimg.cn/img_convert/9215942ad9228bad8f49615bd19586d3.png
https://img-blog.csdnimg.cn/img_convert/20ff0179948d77894458c365e233d952.png
4.测试php

echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php 打开浏览器访问本机ip,确保ECS实例安全组开启80端口
https://img-blog.csdnimg.cn/img_convert/939f305a9d4bc2767c496a7d4642d6ac.png
https://img-blog.csdnimg.cn/img_convert/5756b5528f4df4355c6aa83c80739bed.png
https://img-blog.csdnimg.cn/img_convert/0d1df296baf25300e70d9cb50a4d3a09.png
http://Host_IP/phpinfo.php
https://img-blog.csdnimg.cn/img_convert/7a7fd4d45332524efb9661e01faad6f3.png
删除phpinfo.php测试文件
rm -f /var/www/html/phpinfo.php 5.下载wordpress 4.9中文版并配置

wget https://cn.wordpress.org/wordpress-4.9-zh_CN.tar.gz 觉得在线下载慢的,可以先下载到电脑上面再传到服务器里面,使用winSCP
https://img-blog.csdnimg.cn/img_convert/5f596933c2e5c295ff3bf28a4bd18a89.png
6.解压tar包

tar -zxf wordpress-4.9-zh_CN.tar.gz 7.登录mysql,创建wordpress数据库和用户,演示采用密码很简单,仅作演示,请勿盲从

MariaDB [(none)]> create database `wordpress-db`;
MariaDB [(none)]> grant all privileges on `wordpress-db`.* to 'wordpress'@'localhost' identified by '000000';
MariaDB [(none)]> flush privileges; https://img-blog.csdnimg.cn/img_convert/1e02de2feca876d80b8632f0a4d2b306.png
8.将wp-config-sample.php复制为wp-config.php,并编辑配置

# cp wordpress/wp-config-sample.php wordpress/wp-config.php
# vi wordpress/wp-config.php https://img-blog.csdnimg.cn/img_convert/ad1926ad1580925ff9150d771e416312.png
修改配置中数据库名称 数据库用户及密码
如图,修改如下行
23、26、29
分别设置之前创建的数据库名称,登录的数据库账号、密码,这里也可以创建wordpress专属数据库用户,这次仅作演示,请勿盲从
https://img-blog.csdnimg.cn/img_convert/1d478fdf136eb538d5d5e047c924f1f8.png
https://img-blog.csdnimg.cn/img_convert/0d67985205119563f4eec4cc5a062f03.png
9.复制 wordpress 安装目录的内容到http目录下

# cp -r wordpress/* /var/www/html/ https://img-blog.csdnimg.cn/img_convert/70b79f0943d14676bfab593c0ca82fb6.png
10.允许 WordPress 使用 permalink

# vi /etc/httpd/conf/httpd.conf 修改 151行的 AllowOverride None 为 AllowOverride All
https://img-blog.csdnimg.cn/img_convert/d8fd6a29d67a6e8b8870a29a986d7ae2.png
11.重启httpd和mariadb服务

# systemctl restart httpd mariadb
https://img-blog.csdnimg.cn/img_convert/3a141289d1f42abfcb8d6ddb74e96286.png
12.访问网页后台,进行最终配置

浏览器输入ip地址会自动跳转到后台设置页面
https://img-blog.csdnimg.cn/img_convert/8d806d106b97d9e308a47f0411df778d.png
https://img-blog.csdnimg.cn/img_convert/db8cef3d3cec4b006cb55704a53dbaa6.png
https://img-blog.csdnimg.cn/img_convert/fafde94520bcdc964a8a73b3735e5887.png
https://img-blog.csdnimg.cn/img_convert/734f0e61230f29a640a9e3fe3d74b7e4.png
至此,Wordpress博客搭建完成,您可以根据自己的喜好DIY自己的Worpress博客
13.查看C5实例的负载

安装云监控插件
阿里云实例云监控地址:https://cloudmonitornext.console.aliyun.com/hostMonitoring/all
https://img-blog.csdnimg.cn/img_convert/5054653ad61b8738dd07d2a5f9476cf2.png
该图为ECS C5.large的控制台监控图,由此可以看出运行LAMP架构的WordPress对C5简直就是毛毛雨,CPU基本处于静默状态,内存平均在20%左右
https://img-blog.csdnimg.cn/img_convert/bb524beaf1978ab340a2017599fdfc4b.png
2. 基于LNMP架构搭建WordPress个人博客(CentOS 7)

1. 安装nginx、mariadb、php

yum -y install nginx mariadb mariadb-server php php-server wget php-fpm php-mysql 2.启动mariadb,并初始化mairadb

systemctl start mariadb
mysql_secure_installation#设置数据库root用户密码 https://img-blog.csdnimg.cn/img_convert/97c7bc8a58b96d2af2e5bb3dbce82d28.png
https://img-blog.csdnimg.cn/img_convert/002fb7062d7906d3f940db6cd53d038e.png
打开浏览器访问本机ip,确保ECS实例安全组开启80端口
https://img-blog.csdnimg.cn/img_convert/fcf6848896d6c2906caea526c8039857.png
https://img-blog.csdnimg.cn/img_convert/04a1c67d55d8708799f9e8b25a662d58.png
https://img-blog.csdnimg.cn/img_convert/2c9b662b614a0d153c947d12dec18037.png
3.修改php-fpm 和 nginx 配置文件

编辑配置文件
vi /etc/nginx/nginx.conf 修改44、45行内容,去除65-71的注释,并修改
location / {
      root   /usr/share/nginx/html/;            
      index   index.php index.html index.htm;         //在这里加上 index.php
   }
location ~ \.php$ {
      root         /usr/share/nginx/html/;    //修改为网站目录
      fastcgi_pass   127.0.0.1:9000;
      fastcgi_indexindex.php;
      fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;//修改 /scripts为 $document_root
      include      fastcgi_params;
    } https://img-blog.csdnimg.cn/img_convert/1d96c3c4f55759f33cfa24a8cb908390.png
4.编辑php-fpm配置文件

# vi /etc/php-fpm.d/www.conf 修改 39、14行内容 将原有的 apache修改为 nginx
https://img-blog.csdnimg.cn/img_convert/babea2ce7c904df94dc1c9adaaba301d.png
5.启动php

# systemctl start php-fpm 6.下载wordpress 4.9中文版并配置

wget https://cn.wordpress.org/wordpress-4.9-zh_CN.tar.gz https://img-blog.csdnimg.cn/img_convert/87d980f1ca9060fb57ba94c15fa631a8.png
觉得在线下载慢的,可以先下载到电脑上面再传到服务器里面,使用winSCP
解压tar包
tar -zxf wordpress-4.9-zh_CN.tar.gz 7.登录mysql,创建wordpress数据库和用户,演示采用密码很简单,仅作演示,请勿盲从

MariaDB [(none)]> create database `wordpress-db`;
MariaDB [(none)]> grant all privileges on `wordpress-db`.* to 'wordpress'@'localhost' identified by '000000';
MariaDB [(none)]> flush privileges; https://img-blog.csdnimg.cn/img_convert/16969f9f8214ee30de3bf070261daf5c.png
8.将wp-config-sample.php复制为wp-config.php,并编辑配置

# cp wordpress/wp-config-sample.php wordpress/wp-config.php
# vi wordpress/wp-config.php https://img-blog.csdnimg.cn/img_convert/93a1a66802079411ef2b5fa20142e0f2.png
修改配置中数据库名称 数据库用户及密码
如图,修改如下行
23、26、29
分别设置之前创建的数据库名称,登录的数据库账号、密码,这次仅作演示,请勿盲从
https://img-blog.csdnimg.cn/img_convert/fc021539e2d9eb83719b8bd80948a7aa.png
https://img-blog.csdnimg.cn/img_convert/daaafe29615609539c47425fc2be67a6.png
9.复制 wordpress 安装目录的内容到/usr/share/nginx/目录下

移除原有目录的页面文件
# mv /usr/share/nginx/html/* /opt/
# cp -r wordpress/* /usr/share/nginx/html/ https://img-blog.csdnimg.cn/img_convert/489ef8c084cecb46835fa83493dadafd.png
10.更改nginx目录权限

# chown -R nginx:nginx /usr/share/nginx/ https://img-blog.csdnimg.cn/img_convert/a64b2571a247c269ef26d90dbc49c93a.png
11.重启nginx和mariadb服务

# systemctl restart nginx mariadb
#或者nginx -s reload 12.访问网页后台,进行最终配置

浏览器输入ip地址会自动跳转到后台设置页面
https://img-blog.csdnimg.cn/img_convert/deda63896ffdc696ad171375d1cf3c02.png
https://img-blog.csdnimg.cn/img_convert/255d26ab068e75be5affb5613802f55d.png
https://img-blog.csdnimg.cn/img_convert/ee0794ec9074cbd5546225666890f00c.png
https://img-blog.csdnimg.cn/img_convert/66171a0ff3e0e25bc210661b52f1b685.png
13.查看实例负载情况

至此,Wordpress博客搭建完成,您可以根据自己的喜好DIY自己的Worpress博客
安装云监控插件
阿里云实例云监控地址:https://cloudmonitornext.console.aliyun.com/hostMonitoring/all
https://img-blog.csdnimg.cn/img_convert/5054653ad61b8738dd07d2a5f9476cf2.png
查看C5实例的负载
该图为ECS C5.large的控制台监控图,由此可以看出运行LNMP架构的WordPress CPU基本处于静默状态,同比采用LAMP,内存的使用率稍高一点
https://img-blog.csdnimg.cn/img_convert/c23c359034e0eea9b04d0d27191ecb11.png
3.基于Aliux 3系统搭建LAMP架构部署Wordpress个人博客

1.首先更换系统

https://img-blog.csdnimg.cn/img_convert/0570e4d91f93c19955ef4b0520a6507d.png
https://img-blog.csdnimg.cn/img_convert/529866742ad56145a6bf8ba4ea7b67d8.png
https://img-blog.csdnimg.cn/img_convert/0e90a818938f4d080a0125c767f4101a.png
https://img-blog.csdnimg.cn/img_convert/90f9c2483d712dc7e0e9cdd5fdec1177.png
2.连接实例进行基础设置

①.首先连接实例

https://img-blog.csdnimg.cn/img_convert/2c38a66d2faf762b5f37c91b26549f81.png
②.更新yum源

yum -y update ③.检查防火墙

systemctl status firewalld #查看防火墙状态
systemctl stop firewalld#临时关闭防火墙
systemctl disable firewalld #关闭开机自启防火墙 https://img-blog.csdnimg.cn/img_convert/b9790ce940bc7882ab765225bdb94e7c.png
3.安装LAMP环境

①.安装 Apache Web 服务器的最新版本,以及适用于 Amazon Linux 2022 的 PHP 程序包

sudo yum install -y httpd wget php-fpm php-mysqli php-json php php-devel https://img-blog.csdnimg.cn/img_convert/da8d5ca3fe46129864ada5ae6116f231.png
②.安装 MariaDB 软件包

yum -y install mariadb mariadb-server https://img-blog.csdnimg.cn/img_convert/1991a619af8b4b96dec1660d7638cb97.png
③.启动 Apache Web 服务器并设置开机自启

systemctl start httpd
systemctl enable httpd
systemctl is-enabled httpd #查看是否启动 https://img-blog.csdnimg.cn/img_convert/dafbefedbc024e6f8d3b47a2e2db2e19.png
④.mariadb,并初始化mairadb

systemctl start mariadb
systemctl enable mariadb ④.初始化数据库

mysql_secure_installation#设置数据库root用户密码 https://img-blog.csdnimg.cn/img_convert/4d8b449bd298cbb3178a7ed6eda299bc.png
https://img-blog.csdnimg.cn/img_convert/24942ad1cb64c7a202298f65aafd6233.png
⑤.登录mysql,创建wordpress数据库和用户,演示采用密码很简单,仅作演示,请勿盲从

MariaDB [(none)]> create database `wordpress-db`;
MariaDB [(none)]> grant all privileges on `wordpress-db`.* to 'wordpress'@'localhost' identified by '000000';
MariaDB [(none)]> flush privileges; https://img-blog.csdnimg.cn/img_convert/340d5a7e56107a6d35c20d5d963e3df1.png
⑥.测试php

echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php 打开浏览器访问本机ip,确保ECS实例安全组开启80端口
https://img-blog.csdnimg.cn/img_convert/be5d9f66976e72620ed2902a6208f191.png
https://img-blog.csdnimg.cn/img_convert/b00595641717b1670b93f251c1a55927.png
https://img-blog.csdnimg.cn/img_convert/ec463b4ea9393d2a33b0a5814e6d722c.png
http://Host_IP/phpinfo.php
https://img-blog.csdnimg.cn/img_convert/ddc531d148ff9e8b42ce6b0ad48f164b.png
⑦.删除phpinfo.php文件

rm -f /var/www/html/phpinfo.php 4.安装Wordpress并访问

①.下载wordpress 4.9 中文版

wget https://cn.wordpress.org/wordpress-4.9-zh_CN.tar.gz https://img-blog.csdnimg.cn/img_convert/0ce1500ad1e0c0fcc4d477bb98950dda.png
②.解压tar包

tar -zxf wordpress-4.9-zh_CN.tar.gz ③.将wp-config-sample.php复制为wp-config.php,并编辑配置

cp wordpress/wp-config-sample.php wordpress/wp-config.php
vi wordpress/wp-config.php https://img-blog.csdnimg.cn/img_convert/f363cc62a1f100e252ff024e201e6374.png
修改配置中数据库名称 数据库用户及密码
如图,修改如下行
23、26、29
分别设置之前创建的数据库名称,登录的数据库账号、密码,这里也可以创建wordpress专属数据库用户,这次仅作演示,请勿盲从
https://img-blog.csdnimg.cn/img_convert/2934dbf866485f4f990444356f827672.png
https://img-blog.csdnimg.cn/img_convert/95996cf22a242bb00940cc2cb0b25d04.png
④.复制 wordpress 安装目录的内容到http目录下

# cp -r wordpress/* /var/www/html/ https://img-blog.csdnimg.cn/img_convert/e1acf5913dd2c6bd2dc9fc10a9adf3db.png
⑤.允许 WordPress 使用 permalink

# vi /etc/httpd/conf/httpd.conf 修改 151行附近的 AllowOverride None 为 AllowOverride All
https://img-blog.csdnimg.cn/img_convert/cad219dbeb4b7c072f85cd230b15d622.png
⑥.重启httpd和mariadb服务

# systemctl restart httpd mariadb https://img-blog.csdnimg.cn/img_convert/52ffd689ec398c40452e60e4b0294444.png
⑦.访问网页后台,进行最终配置

浏览器输入ip地址会自动跳转到后台设置页面
https://img-blog.csdnimg.cn/img_convert/16496b9de8793488ba34bb21c2d1a858.png
https://img-blog.csdnimg.cn/img_convert/6588ce6ea0996438cbed7af1243a0cce.png
https://img-blog.csdnimg.cn/img_convert/51f76624d07209e5d193c17ea5c6a50b.png
https://img-blog.csdnimg.cn/img_convert/225a9b9e407ddac437c6acb38584823a.png
https://img-blog.csdnimg.cn/img_convert/d8ab8c08f3f03b2bd2b0f60ae854ff81.png
https://img-blog.csdnimg.cn/img_convert/706c2e9e3d0e76110493fd3c82dcbda0.png
至此,您的wordpress个人博客搭建完成,可以自己升级最新版本wordpress,也可以发布文章,承接广告

5.查看实例监控

安装云监控插件
阿里云实例云监控地址:https://cloudmonitornext.console.aliyun.com/hostMonitoring/all
https://img-blog.csdnimg.cn/img_convert/4556c296b8998e5d30d5fe9ad9ca3c0e.png
按照本次测评惯例依旧查看一下实例的监控,从下图可以看到,在基于Alinux 3运行的LAMP架构的wordpress依旧是占用很低的实例资源,甚至在内存方面消耗得比CentOS更低
https://img-blog.csdnimg.cn/img_convert/37b902ec919d3c98fd221dcf87f060fb.png
4.基于Aliux 3系统搭建LNMP架构部署Wordpress个人博客

由于官方文档中提供了Alinux2搭建LNMP架构方法,这里并不再演示,这里仅演示Alinux 3

1.首先更换系统

https://img-blog.csdnimg.cn/img_convert/f4d8f254c48915f716f3ae61efae2cc5.png
https://img-blog.csdnimg.cn/img_convert/2e1fd5f5947b87248e4229ca3c157af0.png
https://img-blog.csdnimg.cn/img_convert/0e90a818938f4d080a0125c767f4101a.png
https://img-blog.csdnimg.cn/img_convert/d4884ac5848d86259834a4fc9c5e1aa8.png
2.连接实例进行基础设置

①.首先连接实例

https://img-blog.csdnimg.cn/img_convert/76689467382400d4e772d25a2fcdd8df.png
②.更新yum源

yum -y update ③.检查防火墙

systemctl status firewalld #查看防火墙状态
systemctl stop firewalld#临时关闭防火墙
systemctl disable firewalld #关闭开机自启防火墙 https://img-blog.csdnimg.cn/img_convert/b9790ce940bc7882ab765225bdb94e7c.png
2.安装LNMP环境

①.安装nginx

说明 本教程只提供一个版本的Nginx作为示例,如果您需要安装其他版本的Nginx,请参见常见问题。
运行以下命令安装Nginx。
yum -y install nginx 运行以下命令查看Nginx版本。
nginx -v 返回结果如下所示,表示Nginx安装成功。
nginx version: nginx/1.20.1 https://img-blog.csdnimg.cn/img_convert/dc130054a03584cb67cf76028fbb8327.png
②.安装mariadb

yum -y install mariadb mariadb-server 启动mariadb并查看版本信息
systemctl start mariadb
systemctl enable mariadb
mysql -V https://img-blog.csdnimg.cn/img_convert/6b495e352cbefe234cfad1e9a2c6c5d7.png
③.初始化数据库

mysql_secure_installation#设置数据库root用户密码 https://img-blog.csdnimg.cn/img_convert/04f594b585042319c72368a46bc1d800.png
https://img-blog.csdnimg.cn/img_convert/2c3bd6f600090bcbfa67a189419421cb.png
④.登录mysql,创建wordpress数据库和用户,演示采用密码很简单,仅作演示,请勿盲从

MariaDB [(none)]> create database `wordpress-db`;
MariaDB [(none)]> grant all privileges on `wordpress-db`.* to 'wordpress'@'localhost' identified by '000000';
MariaDB [(none)]> flush privileges; https://img-blog.csdnimg.cn/img_convert/2af3ed78fb7bf922866f750885b0b96a.png
⑤.安装php

yum -y install php php-fpm php-mysqlnd ⑥.测试php

echo "<?php phpinfo(); ?>" > /usr/share/nginx/html/phpinfo.php 打开浏览器访问本机ip,确保ECS实例安全组开启80端口
https://img-blog.csdnimg.cn/img_convert/287f8dfaf2aed3d8402d00ec869b001c.png
https://img-blog.csdnimg.cn/img_convert/f52fb5a3b99c5b81ca0d31e82680b3a7.png
https://img-blog.csdnimg.cn/img_convert/4b26710e5b196b9a4bde67f74d791d0c.png
http://Host_IP/phpinfo.php
https://img-blog.csdnimg.cn/img_convert/71570dce5e3a3d4ea89b1310fe0bd1e5.png
⑦.删除phpinfo.php文件

rm -f /usr/share/nginx/html/phpinfo.php 4.安装Wordpress并访问

①.下载wordpress 4.9 中文版

wget https://cn.wordpress.org/wordpress-4.9-zh_CN.tar.gz https://img-blog.csdnimg.cn/img_convert/676ddc47e1b49351049528b8b0ef8a07.png
②.解压tar包

tar -zxf wordpress-4.9-zh_CN.tar.gz ③.将wp-config-sample.php复制为wp-config.php,并编辑配置

cp wordpress/wp-config-sample.php wordpress/wp-config.php
vi wordpress/wp-config.php https://img-blog.csdnimg.cn/img_convert/f363cc62a1f100e252ff024e201e6374.png
修改配置中数据库名称 数据库用户及密码
如图,修改如下行
23、26、29
分别设置之前创建的数据库名称,登录的数据库账号、密码,这里也可以创建wordpress专属数据库用户,这次仅作演示,请勿盲从
https://img-blog.csdnimg.cn/img_convert/d29e8965b9e8cfccd456e8dc90c49a0a.png
https://img-blog.csdnimg.cn/img_convert/fa81f886288e65552fd0d76de31965ba.png
④.复制 wordpress 安装目录的内容到nginx目录下

# cp -r wordpress/* /usr/share/nginx/html/ https://img-blog.csdnimg.cn/img_convert/3066cc1a0ddba9b175252b326fd8f0b4.png
⑤.更改nginx目录权限

chown -R nginx:nginx /usr/share/nginx/ https://img-blog.csdnimg.cn/img_convert/d9929de93611180d44ac8362354a0257.png
⑥.访问实例地址,进行配置

https://img-blog.csdnimg.cn/img_convert/6fb98f25f362e86f6368535a65ad2609.png
https://img-blog.csdnimg.cn/img_convert/37c998c439d5ced73a2dd2b2bb0f76b8.png
https://img-blog.csdnimg.cn/img_convert/eb76fa7e4d54cf21b8358b1fd1570c84.png
https://img-blog.csdnimg.cn/img_convert/e3283fd83a60201821a6815bfe3641c4.png
https://img-blog.csdnimg.cn/img_convert/9b908a1f3137127194de699be0a4f283.png
5.查看实例监控

安装云监控插件
阿里云实例云监控地址:https://cloudmonitornext.console.aliyun.com/hostMonitoring/all
https://img-blog.csdnimg.cn/img_convert/796b27f36251a65fed09fb9372d2ee4d.png
按照惯例,依旧查看一下实例的负载情况
https://img-blog.csdnimg.cn/img_convert/4c933864e529aeecd565a3d926c0ea9c.png
从监控数据看到,Alibaba Linux 3 来搭建LNMP环境托管wordpress似乎用的平均内存比LAMP架构更低一点,依旧,整体部署下来,对C5.large实例没有任何负担,以很低的资源负载运行wordpress系统,说明c5.large完全能胜任该任务,也体现出阿里云ECS C5计算实例的强大性能
5. 基于LAMP架构部署Discuz论坛

1、 安装必要服务以及组件(使用离线源/也可使用在线源)

安装Apache 、mariadb-server、php、php-mysql //php-mysql是php连接mysql的组件
安装apache和mariadb-server:
yum -y install httpd mariadb-server php php-mysql 2. 启用http,mariadb服务并设置开机自启

systemctl start httpd mariadb
systemctl enable httpd mariadb https://img-blog.csdnimg.cn/img_convert/0c4633c956d210a211d123f396d5a6bf.png
3.初始化数据库

mysql_secure_installation#设置数据库root用户密码 https://img-blog.csdnimg.cn/img_convert/5dfa104e81be487f97e0e35b19566daf.png
https://img-blog.csdnimg.cn/img_convert/704ade8c3ca29744b61e37bd7ae5d47f.png
4.登录数据库并创建对应数据库,设置discuz数据库登录用户

mysql-uroot-p //根据自己设定的mysqlroot密码进行登陆 5.创建discuz的数据库:

MariaDB [(none)]> create database discuz;
#给discuz创建一个用户,并且赋予权限:
MariaDB [(none)]> grantallondiscuz.*   to'ad-discuz'@'localhost' identifiedby '000000';       //这里设置ad-discuz用户登录管理 discus 数据库 ,此步骤也可省略,之间使用root用户数据库进行连接 https://img-blog.csdnimg.cn/img_convert/6e8c1f93ef92fd5115a3970483c4ec16.png
6、搭建Discuz!社区论坛

①.使用wget命令下载zip包并解压

安装wget和unzip命令
yum -y install wget unzip
wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_UTF8.zip#获取zip源码包
unzip Discuz_X3.2_SC_UTF8.zip #使用unzip命令解压zip包 https://img-blog.csdnimg.cn/img_convert/119510a9ea08053e749b76046946cacc.png
②.复制文件

复制upload中的文件到 /var/www/html 目录中,并使用chmod命令递归赋予777权限给html目录下的所有文件
cp -r upload/* /var/www/html/
chmod -R 777 /var/www/html/*    //请注意,不要打错命令,否则在安装时会提示不可写 https://img-blog.csdnimg.cn/img_convert/963d067a1449de0baf37d3dbf49e6a61.png
③.重启httpd服务,使用浏览器进行部署

# systemctl restart httpd 浏览器输入:部署服务器IP地址,
https://img-blog.csdnimg.cn/img_convert/9c59120050f9ec3d2ada9ba55efd9291.png
④.安装步骤1:

https://img-blog.csdnimg.cn/img_convert/7fcf3f146874b73cf83776e25c96d4ef.png
⑤.安装步骤二,选择全新安装

https://img-blog.csdnimg.cn/img_convert/eb60cdf1e058a3846f2aa3e56c4cabeb.png
⑥.安装步骤三,创建数据库,选择之前创建的数据库

https://img-blog.csdnimg.cn/img_convert/acc32273131f4fbd9a7eb44b37bacad7.png
⑦.等待安装完成

https://img-blog.csdnimg.cn/img_convert/c60051a0b9a8adda29be5fcaff5e38aa.png
⑧.登录测试

https://img-blog.csdnimg.cn/img_convert/7a3b267d1cbb83b7bbcf1dd38fe0e6e3.png
https://img-blog.csdnimg.cn/img_convert/b7c6d2672c78fd2ec2ee9a819a4b7830.png
https://img-blog.csdnimg.cn/img_convert/4be2444519245616b2a0f6b101d6a988.png
7.查看实例监控数据

至此,Discuz论坛安装完成
按照惯例,查看一下服务器的监控数据
https://img-blog.csdnimg.cn/img_convert/f554932986cdc07303c34c3cf25488bd.png
6. 基于ubuntu搭建CasaOS 家庭云

CasaOS官网: https://www.casaos.io/
CasaOS Github项目地址: https://github.com/IceWhaleTech/CasaOS
1.系统选择

参考Github推荐的安装系统,这里使用Ubuntu server 20.04 amd 64
https://img-blog.csdnimg.cn/img_convert/33da3e80adf53849e3cbdce62e622249.png
2.采用一键脚本进行安装

curl -fsSL https://get.icewhale.io/casaos.sh | bash 如果提示Downloading CasaOS 失败,请重新运行脚本即可,直至成功
https://img-blog.csdnimg.cn/img_convert/b8ea3bd84e011c85b7152ab62c3c4c37.png
3.然后访问你的公网IP地址

https://img-blog.csdnimg.cn/img_convert/b253882ed780c5f164e6022579e5a649.png
4.设置你的账号 密码 即可

https://img-blog.csdnimg.cn/img_convert/f21e094637aae0c4b0495ee84a93dbad.png
5.在界面可以看到你的CasaOS云

https://img-blog.csdnimg.cn/img_convert/ea0a707208fb9a7ce2ef6b75a9c9cd78.png
点击应用中心 可以 以容器方式安装服务,包括常见的 NextCloud,Jellyfin,Emby,Qbittorrent等
https://img-blog.csdnimg.cn/img_convert/209b11c84a0543554c5b794a4fb17a76.png
6.应用安装演示

①.这里我点击安装一个NextCloud进行演示,安装完成后如下

https://img-blog.csdnimg.cn/img_convert/db25783899a27a02c016dd11dd669a82.png
②.点击NextCloud的图标即可,注意弹出的网站窗口的连接端口

开放实例安全组端口
https://img-blog.csdnimg.cn/img_convert/e5c0e709e79ba7dc56157e80a4f369ab.png
注意端口开放
③.对nextcloud进行设置,包括管理员的账号密码,数据存储位置,以及数据库的设置,可以选配三种数据库,设置好后,滑动到下面,点击安装即可

https://img-blog.csdnimg.cn/img_convert/ac1dccaacec33332ca3f75e66bbfbda4.png
https://img-blog.csdnimg.cn/img_convert/67c646d02c534db15c88e270601703af.png
④.至此,您的nextCloud 容器安装设置完成

https://img-blog.csdnimg.cn/img_convert/857ed349cd628da4b5c113c0a9387ea1.png
https://img-blog.csdnimg.cn/img_convert/13d90c4f10c309d3ceb0889509988ff6.png
https://img-blog.csdnimg.cn/img_convert/fd93302a8f3629466abb1e5ad2beea89.png
6.查看安装了CasaOS并且运行一个NextCloud容器的服务器性能监控

https://img-blog.csdnimg.cn/img_convert/27780e3dd97aa50875d340f3910fc7f2.png
7. 基于Ubuntu 20.04 64安装私有化部署版极狐GitLab

1. 安装和配置必须的依赖项

sudo apt-get update
sudo apt-get install -y curl openssh-server ca-certificates tzdata perl
2. 下载极狐GitLab 安装包并安装极狐GitLab

①.下载极狐GitLab 安装包。

# Ubuntu 16.04
wget https://omnibus.gitlab.cn/ubuntu/xenial/gitlab-jh_14.10.0-jh.0_amd64.deb
# Ubuntu 18.04
wget https://omnibus.gitlab.cn/ubuntu/bionic/gitlab-jh_14.10.0-jh.0_amd64.deb
# Ubuntu 20.04
wget https://omnibus.gitlab.cn/ubuntu/focal/gitlab-jh_14.10.0-jh.0_amd64.deb ②.接下来,安装极狐GitLab。

确保您已正确设置您的 DNS,并更改 https://gitlab.example.com 为您要访问极狐GitLab 实例的 URL。安装包将在该 URL 上自动配置和启动极狐GitLab。
https://img-blog.csdnimg.cn/img_convert/09c4310f7095ae3dd63a9ea9b489d1ad.png
对于 https 站点,极狐GitLab 将使用 Let’s Encrypt 自动请求 SSL 证书,这需要有效的主机名和入站 HTTP 访问。您也可以使用自己的证书或仅使用 http://(不带s)。
如果您想为初始管理员用户(root)指定自定义密码,请查看文档。如果未指定密码,将自动生成随机密码。
文档地址:https://docs.gitlab.cn/omnibus/installation/index.html#%E8%AE%BE%E7%BD%AE%E5%88%9D%E5%A7%8B%E5%AF%86%E7%A0%81
执行如下命令开始安装:
#请将https://gitlab.example.com 替换为您自己的域名,如果没有证书就使用 http://gitlab.example.com 采用http://
sudo EXTERNAL_URL="https://gitlab.example.com" dpkg -i gitlab-jh_14.10.0-jh.0_amd64.deb https://img-blog.csdnimg.cn/img_convert/73caf5e3b0c1bbf7b186339bdf5e2181.png
③.等待安装完成

https://img-blog.csdnimg.cn/img_convert/3a911aa9e2613589e75c27b6f8f206c2.png
3. 访问极狐GitLab 实例并登录

查看系统生成密码
cat /etc/gitlab/initial_root_password 建议安装成功初始登录成功之后,立即修改初始密码)。使用此密码和用户名 root 登录。
https://img-blog.csdnimg.cn/img_convert/6d657908b2a4d22cd95a1d62cb87fc75.png
https://img-blog.csdnimg.cn/img_convert/e506f4ef93c7b3cfd69e77c3b450cb92.png
https://img-blog.csdnimg.cn/img_convert/125114b14777c8220f0a8d6cb96bbee6.png
4. 后续配置

请参阅GitLab官网
https://docs.gitlab.cn/jh/install/next_steps.html
总结

首先

很荣幸,本次能够参加本次的五一活动,因为本人长期使用AWS,所以特地在该篇文章中加入了AWS EC2来进行对比测试,也算是作为性能参照组,相比较而言,阿里云ECS C5.large是CPU性能确实逊色一点,但是从性价比方面考虑,阿里云ECS的确是第一选择对象,更好的一点是阿里云可以 ”重装系统“,这点的确是阿里云的优点,对于普通用户而言,更想直接更换系统而不是重新开一台实例,很明显更换系统更加简单,便捷。希望在本篇文章的目录一、目录二 给到用户一些直观的数据。新用户可以直接领取阿里云ECS共享型实例n4来进行本篇文章的服务环境搭建,来感受一下阿里云ECS云服务器的魅力

再来谈谈服务搭建环节:

①系统:这里分别采用CentOS 7,Alinux 3,Ubuntu 20.04进行搭建,在LAMP,LNMP环节,CentOS 7和Alinux 3是相当于对比参照的,从监控的数据可以看出,Alinux 3在内存用量方面似乎更节省一点

②网络:整个服务环境搭建测试很流畅,网络性能并未受限,查阅官方文档,下行最大提供1Gbps的速度,在实验中,下载文件的速度基本保持在100Mbps-200Mbps之间,在搭建完CasaOS后,有一个nextcloud容器环境的拉取,本以为会花费较多的时间甚至失败,令人惊喜的是很快速的就拉取下来,这里可以看出阿里云ECS云服务器的网络环境是优良的。

③CPU:本篇所演示的服务搭建环境,均采用阿里云ECS C5.large(2H4G)云服务器,在每个服务环境搭建完成后,都会有一个实例监控图,可以很明显的看出,不论是个人博客,论坛,还是家庭云,GitLab 一体化 DevOps 平台,整体CPU的负载都很低,作为一款计算型实例,性能表现还是很令人满意

④内存、磁盘:在整个服务环境搭建过程以及后续的访问,可以感受到整个系统非常流畅,这也证明了阿里云块存储中的高效云盘是完全可以满足普通用户的性能需求。

总体看来,阿里云 ECS C5.large实例性能十分强劲,按照阿里云的官方说法,C系实例推荐的应用场景是 "Web服务器"场景,这一点从用户常用的LAMP,LNMP搭建可以看出来,C5系列实例的确是完全可以胜任该任务的,且实例整体资源负载很小,完全适用于用户托管web服务。在LAMP,LNMP场景测试时,也可以从监控数据看到Alinux 3整体更优,这里也推荐用户使用Alinux。

本篇文章到此就结束了,希望能够帮助用户选择自己想要的服务器,希望这篇文章可以帮助到您,谢谢。


来源:https://blog.csdn.net/fly1574/article/details/124633235
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
页: [1]
查看完整版本: 【五一专属】阿里云ECS大测评#五一专属|向所有热爱分享的“技术劳动者”致