2020云计算省赛总结

本文涉及的产品
云数据库 RDS MySQL,集群系列 2核4GB
推荐场景:
搭建个人博客
RDS MySQL Serverless 基础系列,0.5-2RCU 50GB
RDS MySQL Serverless 高可用系列,价值2615元额度,1个月
简介: 2020云计算省赛总结

  • 前言:本文写于2020/11/29 15:25分,写这篇文章的目的有三:
  • 1、对专科两年所学做个总结
  • 2、让未来能有机会参加竞赛的同学有个参考
  • 3、浮躁的社会,需要静下心来思考
  • author:Jack Sparrow
  • date:2020/11/29


云计算平台的拓扑图如图1所示,IP地址规划如下图所示。


image.png


一、私有云部署运维


1 划分compute磁盘


在compute节点上利用空白分区划分2个100G分区。


[root@compute ~]# parted /dev/md126
GNU Parted 3.1
Using /dev/md126
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                                
Model: Linux Software RAID Array (md)
Disk /dev/md126: 3801GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: pmbr_boot
Number  Start   End     Size    File system  Name    Flags
 1      1049kB  2097kB  1049kB                       bios_grub
 2      2097kB  1076MB  1074MB  xfs
 3      1076MB  1083GB  1082GB                       lvm
(parted) mkpart cinder 1084G 1184G
(parted) mkpart swift 1185G 1285G
(parted) p                                                                
Model: Linux Software RAID Array (md)
Disk /dev/md126: 3801GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: pmbr_boot
Number  Start   End     Size    File system  Name    Flags
 1      1049kB  2097kB  1049kB                       bios_grub
 2      2097kB  1076MB  1074MB  xfs
 3      1076MB  1083GB  1082GB                       lvm
 4      1084GB  1184GB  100GB              cinder
 5      1185GB  1285GB  100GB             swift
[root@compute ~]# mkfs.xfs /dev/md126p4
meta-data=/dev/md126p6           isize=512    agcount=8, agsize=30496 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=243968, imaxpct=25
         =                       sunit=32     swidth=64 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=1056, version=2
         =                       sectsz=512   sunit=32 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@compute ~]# mkfs.xfs /dev/md126p5
meta-data=/dev/md126p6           isize=512    agcount=8, agsize=30496 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=243968, imaxpct=25
         =                       sunit=32     swidth=64 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=1056, version=2
         =                       sectsz=512   sunit=32 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0


2 配置网络、主机名


修改和添加/etc/sysconfig/network-scripts/ifcfg-enp*(具体的网口)文件。

(1)controller节点
配置网络:
enp8s0: 192.168.100.10
DEVICE=enp8s0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=192.168.100.10
PREFIX=24
GATEWAY=192.168.100.1
enp9s0: 192.168.200.10
DEVICE=enp9s0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=192.168.200.10
PREFIX=24
配置主机名:
 # hostnamectl set-hostname controller
按ctrl+d 退出  重新登陆
(2)compute 节点
配置网络:
enp8s0: 192.168.100.20
DEVICE=enp8s0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=192.168.100.20
PREFIX=24
GATEWAY=192.168.100.1
enp9s0: 192.168.200.20
DEVICE=enp9s0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=192.168.200.20
PREFIX=24


配置主机名:

# hostnamectl set-hostname compute


按ctrl+d 退出  重新登陆


3 配置yum源


在controller节点上利用/opt/centos目录中的软件包安装httpd服务,设置开机自启动,并使用http提供yum仓库服务,在http服务默认工作目录下创建openstack和centos目录,将需要用到的源文件分别复制到这两个目录下。分别设置controller节点和compute节点的yum源文件http.repo 在/etc/yum.repos.d


#Controller和compute节点


(1)yum源备份 #rm -rf /etc/yum.repos.d/*


(2)创建repo文件 【controller】 在/etc/yum.repos.d创建centos.repo源文件


# vi /etc/yum.repos.d/local.repo
[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=file:///opt/iaas/iaas-repo
gpgcheck=0
enabled=1

【compute】


在controller节点上利用/opt/centos目录中的软件包安装httpd服务,设置开机自启动,并使用http提供yum仓库服务,在http服务默认工作目录下创建openstack和centos目录,将需要用到的源文件分别复制到这两个目录下。分别设置controller节点和compute节点的yum源文件http.repo 在/etc/yum.repos.d


创建centos.repo源文件


# vi /etc/yum.repos.d/local.repo
[root@compute ~]# vi /etc/yum.repos.d/local.repo
[centos]
name=centos
baseurl=ftp://controller/centos
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=ftp://controller/iaas/iaas-repo
gpgcheck=0
enabled=1
主机名映射
[root@controller ~]# vi /etc/hosts 
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.100.10 controller
192.168.100.20 compute
 [root@compute ~]# vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.100.10 controller
192.168.100.20 compute


(3)挂载iso文件


将提供的CentOS-7-x86_64-DVD-1804.iso和chinaskills_cloud_iaas.iso光盘镜像上传到controller节点/root目录下,然后在/opt目录下分别创建centos目录和openstack目录,并将镜像文件CentOS-7-x86_64-DVD-1804.iso挂载到centos目录下,将镜像文件chinaskills_cloud_iaas.iso挂载到openstack目录下。


【挂载CentOS-7-x86_64-DVD-1804.iso】

[root@controller ~]# mount -o loop CentOS-7-x86_64-DVD-1804.iso  /mnt/
[root@controller ~]# mkdir /opt/centos
[root@controller ~]# mkdir /opt/iaas
[root@controller ~]# cp -rvf /mnt/* /opt/centos/
[root@controller ~]# umount  /mnt/


【挂载XianDian-IaaS-v2.4.iso】

[root@controller ~]# mount -o loop chinaskills_cloud_iaas.iso  /mnt/
mount: /dev/loop0 is write-protected, mounting read-only
[root@controller ~]# cp -rvf /mnt/* /opt/iaas

(4)搭建ftp服务器,开启并设置自启

[root@controller ~]# yum install vsftpd -y
[root@controller ~]# vi /etc/vsftpd/vsftpd.conf
添加anon_root=/opt/
保存退出

[root@controller ~]# systemctl start vsftpd
[root@controller ~]# systemctl enable vsftpd


(5)配置防火墙和Selinux

【controller/compute】
编辑selinux文件
# vi /etc/selinux/config
SELINUX=permissive
[root@controller ~]# setenforce 0
关闭防火墙并设置开机不自启
# systemctl stop firewalld.service
# systemctl disable firewalld.service
(6)清除缓存,验证yum源
【controller/compute】
# yum clean all
# yum list


4 编辑环境变量


controller和compute节点


yum install iaas-xiandian -y


编辑文件/etc/xiandian/openrc.sh,此文件是安装过程中的各项参数,根据每项参数上一行的说明及服务器实际情况进行配置。


Vim模式删除所有内容:%d

##--------------------system Config--------------------##
##Controller Server Manager IP. example:x.x.x.x
HOST_IP=192.168.100.10
##Controller HOST Password. example:000000 
HOST_PASS=000000
##Controller Server hostname. example:controller
HOST_NAME=controller
##Compute Node Manager IP. example:x.x.x.x
HOST_IP_NODE=192.168.100.20
##Compute HOST Password. example:000000 
HOST_PASS_NODE=000000
##Compute Node hostname. example:compute
HOST_NAME_NODE=compute
##--------------------Chrony Config-------------------##
##Controller network segment IP.  example:x.x.0.0/16(x.x.x.0/24)
network_segment_IP=192.168.100.0/24
##--------------------Rabbit Config ------------------##
##user for rabbit. example:openstack
RABBIT_USER=openstack
##Password for rabbit user .example:000000
RABBIT_PASS=000000
##--------------------MySQL Config---------------------##
##Password for MySQL root user . exmaple:000000
DB_PASS=000000
##--------------------Keystone Config------------------##
##Password for Keystore admin user. exmaple:000000
DOMAIN_NAME=demo
ADMIN_PASS=000000
DEMO_PASS=000000
##Password for Mysql keystore user. exmaple:000000
KEYSTONE_DBPASS=000000
##--------------------Glance Config--------------------##
##Password for Mysql glance user. exmaple:000000
GLANCE_DBPASS=000000
##Password for Keystore glance user. exmaple:000000
GLANCE_PASS=000000
##--------------------Nova Config----------------------##
##Password for Mysql nova user. exmaple:000000
NOVA_DBPASS=000000
##Password for Keystore nova user. exmaple:000000
NOVA_PASS=000000
##--------------------Neturon Config-------------------##
##Password for Mysql neutron user. exmaple:000000
NEUTRON_DBPASS=000000
##Password for Keystore neutron user. exmaple:000000
NEUTRON_PASS=000000
##metadata secret for neutron. exmaple:000000
METADATA_SECRET=000000
##Tunnel Network Interface. example:x.x.x.x
INTERFACE_IP=192.168.100.10
##External Network Interface. example:eth1
INTERFACE_NAME=enp8s0
##External Network The Physical Adapter. example:provider
Physical_NAME=provider
##First Vlan ID in VLAN RANGE for VLAN Network. exmaple:101
minvlan=2
##Last Vlan ID in VLAN RANGE for VLAN Network. example:200
maxvlan=300
##--------------------Cinder Config--------------------##
##Password for Mysql cinder user. exmaple:000000
CINDER_DBPASS=000000
##Password for Keystore cinder user. exmaple:000000
CINDER_PASS=000000
##Cinder Block Disk. example:md126p3
BLOCK_DISK=md126p4
##--------------------Swift Config---------------------##
##Password for Keystore swift user. exmaple:000000
SWIFT_PASS=000000
##The NODE Object Disk for Swift. example:md126p4.
OBJECT_DISK=md126p5
##The NODE IP for Swift Storage Network. example:x.x.x.x.
STORAGE_LOCAL_NET_IP=192.168.100.20
##--------------------Heat Config----------------------##
##Password for Mysql heat user. exmaple:000000
HEAT_DBPASS=000000
##Password for Keystore heat user. exmaple:000000
HEAT_PASS=000000
##--------------------Zun Config-----------------------##
##Password for Mysql Zun user. exmaple:000000
ZUN_DBPASS=000000
##Password for Keystore Zun user. exmaple:000000
ZUN_PASS=000000
##Password for Mysql Kuryr user. exmaple:000000
KURYR_DBPASS=000000
##Password for Keystore Kuryr user. exmaple:000000
KURYR_PASS=000000
##--------------------Ceilometer Config----------------##
##Password for Gnocchi ceilometer user. exmaple:000000
CEILOMETER_DBPASS=000000
##Password for Keystore ceilometer user. exmaple:000000
CEILOMETER_PASS=000000
##--------------------AODH Config----------------##
##Password for Mysql AODH user. exmaple:000000
AODH_DBPASS=000000
##Password for Keystore AODH user. exmaple:000000
AODH_PASS=000000
##--------------------Barbican Config----------------##
##Password for Mysql Barbican user. exmaple:000000
BARBICAN_DBPASS=000000
##Password for Keystore Barbican user. exmaple:000000
BARBICAN_PASS=000000

5 通过脚本安装私有云平台


以下脚本按顺序执行!
Controller:
iaas-pre-host.sh
reboot
iaas-install-mysql.sh
iaas-install-keystone.sh
iaas-install-glance.sh
iaas-install-nova-controller.sh
iaas-install-neutron-controller.sh
iaas-install-dashboard.sh
iaas-install-cinder-controller.sh
iaas-install-swift-controller.sh
iaas-install-nova-compute.sh(修改配置之后运行)
Compute:
iaas-pre-host.sh
reboot
iaas-install-nova-compute.sh
iaas-install-neutron-compute.sh
iaas-install-cinder-compute.sh
iaas-install-swift-compute.sh

6 创建云主机


流程:


(1)管理员->资源管理->云主机类型->创建云主机类型


(2)管理员->网络->网络->创建网络


(2)项目->网络->安全组->管理规则->添加规则(ICMP、TCP、UDP)


(3)项目->资源管理->云主机->创建云主机


7 云平台创建云主机


1 创建云主机类型


image.png


2 创建云主机网络


选择vlan模式,网络要和外网网卡一个网段,段ID要选择外网网卡所在网段

image.png

image.png

image.png


2.1绑定固定网络


image.png


3 修改安全组

image.png


4 上传镜像

[root@controller ~]# source /etc/keystone/admin-openrc.sh 
[root@controller ~]# glance image-create --name "CentOS7.5" --disk-format qcow2  --container-format bare --progress < /opt/iaas/images/CentOS_7.5_x86_64_XD.qcow2 
[=============================>] 100%
+------------------+--------------------------------------+


........

5 创建云主机

image.png

6 测试连接

image.png

image.png


8 Openstack命令创建云主机


1 创建云主机类型


使用命令创建一个名为 test ,ID为 6 ,内存为 2048MB ,磁盘为 10GB ,vcpu数量为 2 的云主机类型。

nova flavor-create test   6   2048   10   2
+----+------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | Description |
+----+------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
| 6  | test | 2048      | 10   | 0         |      | 2     | 1.0         | True      | -           |
+----+------+-----------+------+-----------+------+-------+-------------+-----------+-------------

2 创建云主机网络


思路:查看云平台创建好的网络,查看它的详细信息,用命令创建的时候,指定参数即可!


[root@controller ~]# neutron net-create --router:external --provider:network_type vlan --provider:physical_network provider --provider:segmentation_id 200 ext
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Created a new network:
+---------------------------+--------------------------------------+
| Field                     | Value                                |
+---------------------------+--------------------------------------+
| admin_state_up            | True                                 |
| availability_zone_hints   |                                      |
| availability_zones        |                                      |
| created_at                | 2020-12-01T00:22:18Z                 |
| description               |                                      |
| id                        | 37edbae1-9478-472e-a681-8587fbb464fb |
| ipv4_address_scope        |                                      |
| ipv6_address_scope        |                                      |
| is_default                | False                                |
| mtu                       | 1500                                 |
| name                      | ext                                  |
| port_security_enabled     | True                                 |
| project_id                | 213eb58e471448cf969fd925382bc08d     |
| provider:network_type     | vlan                                 |
| provider:physical_network | provider                             |
| provider:segmentation_id  | 200                                  |
| revision_number           | 5                                    |
| router:external           | True                                 |
| shared                    | False                                |
| status                    | ACTIVE                               |
| subnets                   |                                      |
| tags                      |                                      |
| tenant_id                 | 213eb58e471448cf969fd925382bc08d     |
| updated_at                | 2020-12-01T00:22:19Z                 |
+---------------------------+--------------------------------------+


3.创建子网


[root@controller ~]# neutron subnet-create ext 192.168.200.0/24 --name sub_ext --gateway 192.168.200.1
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
Created a new subnet:
+-------------------+------------------------------------------------------+
| Field             | Value                                                |
+-------------------+------------------------------------------------------+
| allocation_pools  | {"start": "192.168.200.2", "end": "192.168.200.254"} |
| cidr              | 192.168.200.0/24                                     |
| created_at        | 2020-12-01T00:28:39Z                                 |
| description       |                                                      |
| dns_nameservers   |                                                      |
| enable_dhcp       | True                                                 |
| gateway_ip        | 192.168.100.1                                        |
| host_routes       |                                                      |
| id                | 0be6f045-08b2-459f-a989-b58863b1a29d                 |
| ip_version        | 4                                                    |
| ipv6_address_mode |                                                      |
| ipv6_ra_mode      |                                                      |
| name              | sub_ext                                              |
| network_id        | 37edbae1-9478-472e-a681-8587fbb464fb                 |
| project_id        | 213eb58e471448cf969fd925382bc08d                     |
| revision_number   | 0                                                    |
| service_types     |                                                      |
| subnetpool_id     |                                                      |
| tags              |                                                      |
| tenant_id         | 213eb58e471448cf969fd925382bc08d                     |
| updated_at        | 2020-12-01T00:28:39Z                                 |
+-------------------+------------------------------------------------------+

[root@controller ~]# glance image-list
+--------------------------------------+-----------+
| ID                                   | Name      |
+--------------------------------------+-----------+
| db8a716d-0a2e-49eb-8892-681e7b6be41d | CentOS7.5 |
+--------------------------------------+-----------+
[root@controller ~]# neutron net-list
neutron CLI is deprecated and will be removed in the future. Use openstack CLI instead.
+--------------------------------------+------+----------------------------------+-------------------------------------------------------+
| id                                   | name | tenant_id                        | subnets                                               |
+--------------------------------------+------+----------------------------------+-------------------------------------------------------+
| 37edbae1-9478-472e-a681-8587fbb464fb | ext  | 213eb58e471448cf969fd925382bc08d | 0be6f045-08b2-459f-a989-b58863b1a29d 192.168.200.0/24 |
+--------------------------------------+------+----------------------------------+-------------------------------------------------------+
[root@controller ~]# nova flavor-list
+--------------------------------------+------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
| ID                                   | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public | Description |
+--------------------------------------+------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
| 6                                    | test | 2048      | 10   | 0         |      | 2     | 1.0         | True      | -           
+--------------------------------------+------+-----------+------+-----------+------+-------+-------------+-----------+-------------+
[root@controller ~]# nova boot --flavor c5af1899-5ca2-4b5f-bf5e-b03d6e049f28 --image db8a716d-0a2e-49eb-8892-681e7b6be41d --nic net-id=37edbae1-9478-472e-a681-8587fbb464fb pc-cai
+--------------------------------------+--------------------------------------------------+
| Property                             | Value                                            |
+--------------------------------------+--------------------------------------------------+
| OS-DCF:diskConfig                    | MANUAL                                           |
| OS-EXT-AZ:availability_zone          |                                                  |
| OS-EXT-SRV-ATTR:host                 | -                                                |
| OS-EXT-SRV-ATTR:hostname             | pc-cai                                           |
| OS-EXT-SRV-ATTR:hypervisor_hostname  | -                                                |
| OS-EXT-SRV-ATTR:instance_name        |                                                  |
| OS-EXT-SRV-ATTR:kernel_id            |                                                  |
| OS-EXT-SRV-ATTR:launch_index         | 0                                                |
| OS-EXT-SRV-ATTR:ramdisk_id           |                                                  |
| OS-EXT-SRV-ATTR:reservation_id       | r-q8pfr6gu                                       |
| OS-EXT-SRV-ATTR:root_device_name     | -                                                |
| OS-EXT-SRV-ATTR:user_data            | -                                                |
| OS-EXT-STS:power_state               | 0                                                |
| OS-EXT-STS:task_state                | scheduling                                       |
| OS-EXT-STS:vm_state                  | building                                         |
| OS-SRV-USG:launched_at               | -                                                |
| OS-SRV-USG:terminated_at             | -                                                |
| accessIPv4                           |                                                  |
| accessIPv6                           |                                                  |
| adminPass                            | kmuX4hyXnv6N                                     |
| config_drive                         |                                                  |
| created                              | 2020-12-01T00:38:47Z                             |
| description                          | -                                                |
| flavor:disk                          | 50                                               |
| flavor:ephemeral                     | 0                                                |
| flavor:extra_specs                   | {}                                               |
| flavor:original_name                 | BBB                                              |
| flavor:ram                           | 4200                                             |
| flavor:swap                          | 0                                                |
| flavor:vcpus                         | 4                                                |
| hostId                               |                                                  |
| host_status                          |                                                  |
| id                                   | 24192942-af87-444a-8145-f0cca1fc6880             |
| image                                | CentOS7.5 (db8a716d-0a2e-49eb-8892-681e7b6be41d) |
| key_name                             | -                                                |
| locked                               | False                                            |
| metadata                             | {}                                               |
| name                                 | pc-cai                                           |
| os-extended-volumes:volumes_attached | []                                               |
| progress                             | 0                                                |
| security_groups                      | default                                          |
| status                               | BUILD                                            |
| tags                                 | []                                               |
| tenant_id                            | 213eb58e471448cf969fd925382bc08d                 |
| updated                              | 2020-12-01T00:38:47Z                             |
| user_id                              | ea1193f0ce094069bbbbe22399c30929                 |
+--------------------------------------+--------------------------------------------------+


4 创建云硬盘


建一个2G的硬盘名字为haha
[root@controller ~]# cinder create --name haha 2
+--------------------------------+--------------------------------------+
| Property                       | Value                                |
+--------------------------------+--------------------------------------+
| attachments                    | []                                   |
| availability_zone              | nova                                 |
| bootable                       | false                                |
| consistencygroup_id            | None                                 |
| created_at                     | 2020-12-01T00:48:15.000000           |
| description                    | None                                 |
| encrypted                      | False                                |
| id                             | 0439bafc-2d9a-473c-8f38-e1ace00808a3 |
| metadata                       | {}                                   |
| migration_status               | None                                 |
| multiattach                    | False                                |
| name                           | haha                                 |
| os-vol-host-attr:host          | None                                 |
| os-vol-mig-status-attr:migstat | None                                 |
| os-vol-mig-status-attr:name_id | None                                 |
| os-vol-tenant-attr:tenant_id   | 213eb58e471448cf969fd925382bc08d     |
| replication_status             | None                                 |
| size                           | 2                                    |
| snapshot_id                    | None                                 |
| source_volid                   | None                                 |
| status                         | creating                             |
| updated_at                     | None                                 |
| user_id                        | ea1193f0ce094069bbbbe22399c30929     |
| volume_type                    | None                                 |
+--------------------------------+--------------------------------------+
挂载
[root@controller ~]# nova volume-attach 24192942-af87-444a-8145-f0cca1fc6880 0439bafc-2d9a-473c-8f38-e1ace00808a3 
+----------+--------------------------------------+
| Property | Value                                |
+----------+--------------------------------------+
| device   | /dev/vdb                             |
| id       | 0439bafc-2d9a-473c-8f38-e1ace00808a3 |
| serverId | 24192942-af87-444a-8145-f0cca1fc6880 |
| volumeId | 0439bafc-2d9a-473c-8f38-e1ace00808a3 |
+----------+--------------------------------------+
登录查看挂载成功

4.1 RAID0

[root@pc-cai yum.repos.d]# cat ftp.repo
[centos]
name=centos
baseurl=ftp://192.168.100.10/centos
gpgcheck=0
enabled=1
安装mdadm命令
制作raid0
Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): 
Using default response p
Partition number (1-4, default 1): 
First sector (2048-4194303, default 2048):   
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-4194303, default 4194303): +100M
Partition 1 of type Linux and of size 100 MiB is set
Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): 
Using default response p
Partition number (2-4, default 2): 
First sector (206848-4194303, default 206848): 
Using default value 206848
Last sector, +sectors or +size{K,M,G} (206848-4194303, default 4194303): +100M
Partition 2 of type Linux and of size 100 MiB is set
Command (m for help): w
The partition table has been altered!
[root@pc-cai yum.repos.d]# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
vda    253:0    0   50G  0 disk 
└─vda1 253:1    0   50G  0 part /
vdb    253:16   0    2G  0 disk 
├─vdb1 253:17   0  100M  0 part 
└─vdb2 253:18   0  100M  0 part 
[root@pc-cai yum.repos.d]# mdadm -Cv /dev/md0 -l 0 -n 2 /dev/vdb1 /dev/vdb2
mdadm: chunk size defaults to 512K
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md0 started.
[root@pc-cai yum.repos.d]# lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
vda     253:0    0   50G  0 disk  
└─vda1  253:1    0   50G  0 part  /
vdb     253:16   0    2G  0 disk  
├─vdb1  253:17   0  100M  0 part  
│ └─md0   9:0    0  196M  0 raid0 
└─vdb2  253:18   0  100M  0 part  
  └─md0   9:0    0  196M  0 raid0 
[root@pc-cai yum.repos.d]# mkfs.ext4 /dev/md0
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=512 blocks, Stripe width=1024 blocks
50200 inodes, 200704 blocks
10035 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=33816576
25 block groups
8192 blocks per group, 8192 fragments per group
2008 inodes per group
Superblock backups stored on blocks: 
  8193, 24577, 40961, 57345, 73729
Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done 

4.2 RAID1

[root@pc-cai yum.repos.d]# mdadm -Cv /dev/md1 -l 1 -n 2 /dev/vdb1 /dev/vdb2
mdadm: Note: this array has metadata at the start and
    may not be suitable as a boot device.  If you plan to
    store '/boot' on this device please ensure that
    your boot-loader understands md/v1.x metadata, or use
    --metadata=0.90
mdadm: size set to 101376K

4.3 RAID5

[root@pc-cai yum.repos.d]# mdadm -Cv /dev/md5 -l 5 -n 3 /dev/vdb1 /dev/vdb2 /dev/vdb3
mdadm: layout defaults to left-symmetric
mdadm: layout defaults to left-symmetric
mdadm: chunk size defaults to 512K
mdadm: size set to 202752K
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md5 started.

二、容器部署运维


保密


K8s运维


保密


相关实践学习
如何在云端创建MySQL数据库
开始实验后,系统会自动创建一台自建MySQL的 源数据库 ECS 实例和一台 目标数据库 RDS。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
运维 Kubernetes 网络安全
2020云计算省赛总结
本篇内容主要对私有云部署运维、容器部署运维进行记录。
457 1
2020云计算省赛总结
|
人工智能 监控 安全
2022 年,十问云计算
  是时候揭开云计算的神秘面纱了。   刚刚过去的 2021 年是不平凡的一年,据 MariaDB 的一项调查显示,将近 40%的公司加快了业务向云的迁移。来自各行各业的企业都意识到,在历史上从未见过的大规模动荡之后,云计算的优势可以让企业在动荡中保持竞争力。2021 年将成为控制新冠疫情并使各行各业恢复常态的一年,因此,预计今年前半年,疫情的一些影响还将延续,一个主要特征将是大规模兴起的数字化经济。   从餐饮业到购物再到娱乐业,几乎所有国家都经历了由传统经营模式向数字化转型的过程。对于企业来说,这是一个巨大的机会,可以将更多的服务迁移到云平台中,并让大众使用。根据 IDC 的数据显示,
149 0
|
存储 监控 关系型数据库
众安保险五年的云计算故事
作为首家获得互联网牌照的保险公司,众安保险与云计算携手走过了5年的时间,这五年的时间内,众安保险见证了阿里云的成长和成熟,也走出了属于自己的一条上云之路,那么众安保险云上的数据库设计有哪些故事呢?本文中,众安保险数据库负责人钟海平将为大家揭晓。
3382 0
|
存储 关系型数据库 分布式数据库
假如古代有了云计算,延禧攻略里的各位嫔妃要如何宫斗
延禧攻略最近大火,男女老少都在疯狂追剧,就连我们一项业余爱好单一的程序员小哥也用周末时间狂刷了70多集,妥妥的延禧粉。延禧攻略主要有两大看点,一个是各种CP让人眼花缭乱,帝后cp,后璎cp,卫龙cp等等,随着剧情的发展,各种CP层出不穷。
1544 0
|
云计算
关于云计算的期盼
本文讲的是关于云计算的期盼每次谈云计算,都觉得不是自己的事,这个有点像过去一个古时候的笑话,不过很冷,说是一个哥们碰到一条会讲话的鱼,快干死了,鱼忽悠这个哥们说自己是龙王的太子,如果救活他,那么就有很大的好处,这个哥们很开心,说,没问题,我马上去说服楚王和齐王,给你从东海开一条运河来,鱼被反忽悠了,给气的半死,说,你现在一瓢水,就可以把我救活,说什么开运河,等你运河开好了,去咸鱼店找我好了。
1486 0
|
安全 数据中心 云计算
下一篇
无影云桌面