当前位置:网站首页>Cloud computing competition -- basic part of 2020 competition [task 3]
Cloud computing competition -- basic part of 2020 competition [task 3]
2022-04-23 09:21:00 【King_ nul】
Preface
It's been nearly two years , Just recently closed home , When I was free, I did the questions of the previous competition , Learning and doing , Don't do it again , I'll soon forget all the things I've learned before .
Welcome to my blog
Before doing the problem , Be sure to build all the platforms, and then start to do it after there is no problem , Otherwise, when there are problems later , It takes a lot of time to solve , The task ahead Is to build the basic environment .
2020 Cloud computing Events ( National Basic Edition ) Title address
Task three – Opensatck Operation and maintenance tasks
Topic 1 : Image management
stay openstack On the private cloud platform , Use / The attachment / Private cloud attachments / Under the cirros-0.3.4-x86_64-disk.img Mirror image , Use the command to create a file named cirros Mirror image . Submit the user name of the control node after completion 、 Passwords and IP Address to answer box .( The examination environment will provide the required images and other materials )
# Because I'm not ready here Mirror image Download an image directly online , The examination environment cannot be downloaded online , You can download it and use it first
[root@controller opt]# wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
# If you make a mistake -bash: wget: command not found Just use yum -y install wget Install it. wget
[root@controller opt]# ls
centos cirros-0.4.0-x86_64-disk.img OpenStack
# source once admin-openrc file
[root@controller opt]# source /etc/keystone/admin-openrc.sh
# Take a look at the existing image , Avoid image name conflicts
[root@controller opt]# glance image-list
+--------------------------------------+------------+
| ID | Name |
+--------------------------------------+------------+
| 7d833e56-9e49-4f57-87e6-dddbc17db404 | CentOS7.5 |
| f7f95f8f-05ae-45b6-a468-2b2e4084ae36 | docker-1-c |
| 558c538d-c4c0-4077-81a8-49e3ebac1a89 | docker-2-c |
+--------------------------------------+------------+
# Upload the image
[root@controller opt]# glance image-create --name cirros --disk-format=qcow2 --container-format=bare --visibility=public --file /opt/cirros-0.4.0-x86_64-disk.img
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | 443b7623e27ecf03dc9e01ee93f67afe |
| container_format | bare |
| created_at | 2022-04-10T08:58:39Z |
| disk_format | qcow2 |
| id | d5ea70a0-581f-4cc5-9a4e-02fa06e91fe6 |
| min_disk | 0 |
| min_ram | 0 |
| name | cirros |
| owner | d27d72c12d3b46b89572df53a71e5d04 |
| protected | False |
| size | 12716032 |
| status | active |
| tags | [] |
| updated_at | 2022-04-10T08:58:39Z |
| virtual_size | None |
| visibility | public |
+------------------+--------------------------------------+
## Explanation of options
–-name NAME : Specifies that the mirror is in openstack The name shown in ;
–-disk-format DISK_FORMAT : Image format ;openstack Please refer to the official introduction for details of supported formats ;
–-container-format CONTAINER_FORMAT : The container format of the picture , It can be ami,ari,aki,ovf,bare The default is bare
–-owner TENANT_ID : That tenant can use this image
–-size SIZE : The size of this image
–-min-disk DISK_GB : The minimum size required for the image to start ;
–-min-ram DISK_RAM : The minimum memory required to start this image ;
–-location IMAGE_URL : stay web You can use... In the interface url Address upload image , At present, we support http Agreed ;
–-file FILE : The local directory where the image is located ;
–-checksum CHECKSUM : Mirror data validation ;
–-is-public [True|False] : Whether to share this image ; After sharing, other users can also use this image to start instance;
[root@controller opt]# glance image-list
+--------------------------------------+------------+
| ID | Name |
+--------------------------------------+------------+
| 7d833e56-9e49-4f57-87e6-dddbc17db404 | CentOS7.5 |
| d5ea70a0-581f-4cc5-9a4e-02fa06e91fe6 | cirros |
| f7f95f8f-05ae-45b6-a468-2b2e4084ae36 | docker-1-c |
| 558c538d-c4c0-4077-81a8-49e3ebac1a89 | docker-2-c |
+--------------------------------------+------------+
View... In the cloud platform Whether the image has been uploaded .

Topic two :heat Template Management
stay openstack On the private cloud platform , stay /root Write templates under the directory server.yaml, Create a “m1.flavor”、 ID by 1234、 Memory is 1024MB、 Hard disk is 20GB、vcpu The number of 1 Type of virtual machine . Submit the user name of the control node after completion 、 Passwords and IP Address to answer box .( Please be prepared before submitting information yaml The environment in which the template is executed )
heat yes Openstack An automated orchestration component in , For batch creation of resources and networks , You can also build relationships between resources .
Basic concepts :
– Stack (stack): A collection of management resources . A collection of instantiated resources defined in a single template , yes Heat Manage the logical units of the application , Often corresponds to an application .
– Templates (template): How to use code to define and describe the stack . Describes all component resources and the relationship between component resources , yes Heat At the heart of .
– resources (resource): Objects that will be created or modified during orchestration . Resources can be networks 、 Router 、 subnet 、 example 、 volume 、 float IP、 Security team, etc .
– Parameters (parameters):heat Top level in the template key, Define when creating or updating stack What data can be passed to customize the template .
– Parameter group (parameter_groups): Used to specify how input parameters are grouped , And the order in which the parameters are provided .
– Output (outputs):heat Top level in the template key, After definition instantiation stack Data to be returned .
# stay controller Node installation heat service
[root@controller opt]# iaas-install-heat.sh
# View resource types
[root@controller opt]# heat resource-type-list
WARNING (shell) "heat resource-type-list" is deprecated, please use "openstack orchestration resource type list" instead # Here is a warning To use openstack orchestration resource type list This command , It doesn't affect the follow-up
+------------------------------------------+
| resource_type |
+------------------------------------------+
| AWS::AutoScaling::AutoScalingGroup |
|... |
| OS::Cinder::EncryptedVolumeType |
| OS::Cinder::QoSAssociation |
| OS::Cinder::QoSSpecs |
| OS::Cinder::Quota |
| OS::Cinder::Volume |
| OS::Cinder::VolumeAttachment |
| OS::Cinder::VolumeType |
| OS::Glance::Image |
| OS::Heat::AccessPolicy |
| OS::Heat::AutoScalingGroup |
| OS::Heat::CloudConfig |
| OS::Heat::DeployedServer |
| OS::Heat::InstanceGroup |
| OS::Heat::MultipartMime |
| OS::Heat::None |
| OS::Heat::RandomString |
| OS::Heat::ResourceChain |
| OS::Heat::ResourceGroup |
| OS::Heat::ScalingPolicy |
| OS::Heat::SoftwareComponent |
| OS::Heat::SoftwareConfig |
| OS::Heat::SoftwareDeployment |
| OS::Heat::SoftwareDeploymentGroup |
| OS::Heat::Stack |
| OS::Heat::StructuredConfig |
| OS::Heat::StructuredDeployment |
| OS::Heat::StructuredDeploymentGroup |
| OS::Heat::TestResource |
| OS::Heat::UpdateWaitConditionHandle |
| OS::Heat::Value |
| OS::Heat::WaitCondition |
| OS::Heat::WaitConditionHandle |
| OS::Keystone::Domain |
| OS::Keystone::Endpoint |
| OS::Keystone::Group |
| OS::Keystone::GroupRoleAssignment |
| OS::Keystone::Project |
| OS::Keystone::Region |
| OS::Keystone::Role |
| OS::Keystone::Service |
| OS::Keystone::User |
| OS::Keystone::UserRoleAssignment |
| OS::Neutron::AddressScope |
| OS::Neutron::ExtraRoute |
| OS::Neutron::FloatingIP |
| OS::Neutron::FloatingIPAssociation |
| OS::Neutron::FlowClassifier |
| OS::Neutron::MeteringLabel |
| OS::Neutron::MeteringRule |
| OS::Neutron::Net |
| OS::Neutron::NetworkGateway |
| OS::Neutron::Port |
| OS::Neutron::PortPair |
| OS::Neutron::ProviderNet |
| OS::Neutron::Quota |
| OS::Neutron::RBACPolicy |
| OS::Neutron::Router |
| OS::Neutron::RouterInterface |
| OS::Neutron::SecurityGroup |
| OS::Neutron::SecurityGroupRule |
| OS::Neutron::Subnet |
| OS::Neutron::SubnetPool |
| OS::Nova::Flavor |
| OS::Nova::FloatingIP |
| OS::Nova::FloatingIPAssociation |
| OS::Nova::HostAggregate |
| OS::Nova::KeyPair |
| OS::Nova::Quota |
| OS::Nova::Server |
| OS::Nova::ServerGroup |
| OS::Senlin::Cluster |
| OS::Senlin::Node |
| OS::Senlin::Policy |
| OS::Senlin::Profile |
| OS::Senlin::Receiver |
+------------------------------------------+
# View the template versions available for orchestration
[root@controller opt]# openstack orchestration template version list
+--------------------------------------+------+------------------------------+
| Version | Type | Aliases |
+--------------------------------------+------+------------------------------+
| AWSTemplateFormatVersion.2010-09-09 | cfn | |
| HeatTemplateFormatVersion.2012-12-12 | cfn | |
| heat_template_version.2013-05-23 | hot | |
| heat_template_version.2014-10-16 | hot | |
| heat_template_version.2015-04-30 | hot | |
| heat_template_version.2015-10-15 | hot | |
| heat_template_version.2016-04-08 | hot | |
| heat_template_version.2016-10-14 | hot | heat_template_version.newton |
| heat_template_version.2017-02-24 | hot | heat_template_version.ocata |
| heat_template_version.2017-09-01 | hot | heat_template_version.pike |
| heat_template_version.2018-03-02 | hot | heat_template_version.queens |
+--------------------------------------+------+------------------------------+
# stay /root/ Write below server.yaml file
[root@controller ~]# vim server.yaml
# server.yaml The contents of the document
[root@controller ~]# cat server.yaml
heat_template_version: 2015-04-30 # The use of heat Template version
description: Create Flavor # Description information
resources: # Define resources
flavor: # Must be the only resource in the resource section of the template ID
type: OS::Nova::Flavor # The resource type , This represents a Flavor type
properties: # A list of resource specific attributes .
name: "m1.flavor" # Flavor The name property of the type
flavorid: "1234" # id attribute , If not specified, it will automatically generate UUID
disk: 20 # The default disk size is GB
ram: 1024 # Memory size must be MB
vcpus: 1
outputs: # Define the output information
flavor_info: # The name of the output message
description: Get the information of virtual machine type # Output description
value: {
get_attr: [ flavor, show ] } # get_attr The instance created from the corresponding resource definition parses its attribute value for output at run time
# Create a resource stack
[root@controller ~]# heat stack-create m1_flavor_stack -f server.yaml
WARNING (shell) "heat stack-create" is deprecated, please use "openstack stack create" instead
WARNING (shell) "heat stack-list" is deprecated, please use "openstack stack list" instead
+--------------------------------------+-----------------+--------------------+----------------------+--------------+----------------------------------+
| id | stack_name | stack_status | creation_time | updated_time | project |
+--------------------------------------+-----------------+--------------------+----------------------+--------------+----------------------------------+
| cb5d6ca6-9106-46f3-aa7d-8f85f0a86461 | m1_flavor_stack | CREATE_IN_PROGRESS | 2022-04-10T09:50:46Z | None | d27d72c12d3b46b89572df53a71e5d04 |
+--------------------------------------+-----------------+--------------------+----------------------+--------------+----------------------------------+
# View the list of resource stacks
[root@controller ~]# openstack stack list
+--------------------------------------+-----------------+----------------------------------+-----------------+----------------------+--------------+
| ID | Stack Name | Project | Stack Status | Creation Time | Updated Time |
+--------------------------------------+-----------------+----------------------------------+-----------------+----------------------+--------------+
| 5a4b1816-aaf6-4739-83e5-4001c80d89d1 | m1_flavor_stack | d27d72c12d3b46b89572df53a71e5d04 | CREATE_COMPLETE | 2022-04-10T10:31:32Z | None |
+--------------------------------------+-----------------+----------------------------------+-----------------+----------------------+--------------+
## Stack Status Show CREATE_COMPLETE Indicates that the creation was successful
# View the details of the specified stack
[root@controller ~]# openstack stack show m1_flavor_stack
+-----------------------+--------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+-----------------------+--------------------------------------------------------------------------------------------------------------------------------+
| id | 5a4b1816-aaf6-4739-83e5-4001c80d89d1 |
| stack_name | m1_flavor_stack |
| description | Create Flavor |
| creation_time | 2022-04-10T10:31:32Z |
| updated_time | None |
| stack_status | CREATE_COMPLETE |
| stack_status_reason | Stack CREATE completed successfully |
| parameters | OS::project_id: d27d72c12d3b46b89572df53a71e5d04 |
| | OS::stack_id: 5a4b1816-aaf6-4739-83e5-4001c80d89d1 |
| | OS::stack_name: m1_flavor_stack |
| | |
| outputs | - description: Get the information of virtual machine type |
| | output_key: flavor_info |
| | output_value: |
| | OS-FLV-DISABLED:disabled: false |
| | OS-FLV-EXT-DATA:ephemeral: 0 |
| | disk: 20 |
| | id: '1234' |
| | links: |
| | - href: http://controller:8774/v2.1/flavors/1234 |
| | rel: self |
| | - href: http://controller:8774/flavors/1234 |
| | rel: bookmark |
| | name: m1.flavor |
| | os-flavor-access:is_public: true |
| | ram: 1024 |
| | rxtx_factor: 1.0 |
| | swap: '' |
| | vcpus: 1 |
| | |
| links | - href: http://controller:8004/v1/d27d72c12d3b46b89572df53a71e5d04/stacks/m1_flavor_stack/5a4b1816-aaf6-4739-83e5-4001c80d89d1 |
| | rel: self |
| | |
| parent | None |
| disable_rollback | True |
| deletion_time | None |
| stack_user_project_id | 374ce98267964767adacf91527ac0412 |
| capabilities | [] |
| notification_topics | [] |
| stack_owner | None |
| timeout_mins | None |
| tags | None |
+-----------------------+--------------------------------------------------------------------------------------------------------------------------------+
stay dashborad View the resource template version on the platform

Check the resource stack we created

stay Virtual machine type View the virtual machine created by the resource stack

Topic three :swift Fragmentation storage
Use openstack Private cloud platform , Its installation Swift service , New name is chinaskill The container of , take cirros-0.3.4-x86_64-disk.img Upload the image to chinaskill In the container , It shall be stored in sections , The size of each segment is 10M. Submit the user name of the control node after completion 、 Passwords and IP Address to answer box .
First check whether it is installed swift service , If not already installed , Just execute the command to install
# install swift service ( Two node execution )
[root@controller ~]# iaas-install-swift-controller.sh
[root@compute ~]# iaas-install-swift-compute.sh
# View version
[root@controller ~]# swift --version
python-swiftclient 3.5.0
[root@compute ~]# swift --version
python-swiftclient 3.5.0
# Create a file called chinaskill The container of
[root@controller ~]# swift post chinaskill # Create a container post Followed by the container name
[root@controller ~]# swift list # Look at the container list
chinaskill
# Check the contents of the container ( Because there are no files in the container, the view is also empty )
[root@controller ~]# swift list chinaskill
# View the container details
[root@controller ~]# swift list chinaskill
[root@controller ~]# swift stat
Account: AUTH_d27d72c12d3b46b89572df53a71e5d04
Containers: 1
Objects: 0
Bytes: 0
Containers in policy "policy-0": 1
Objects in policy "policy-0": 0
Bytes in policy "policy-0": 0
X-Account-Project-Domain-Id: a5bce2bbc5394decb87c5cb1a6de952d
X-Openstack-Request-Id: tx91e5c3f27cb64082b5de6-006252b7e2
X-Timestamp: 1649587584.78538
X-Trans-Id: tx91e5c3f27cb64082b5de6-006252b7e2
Content-Type: application/json; charset=utf-8
Accept-Ranges: bytes
# Will mirror ( What I use here is 0.4.0 Image of version ) Fragmentation , Each piece is 10M([ Byte online conversion ](https://calc.itzmx.com/))
[root@controller opt]# swift upload chinaskill -S 10485760 cirros-0.4.0-x86_64-disk.img
cirros-0.4.0-x86_64-disk.img segment 1
cirros-0.4.0-x86_64-disk.img segment 0
cirros-0.4.0-x86_64-disk.img
# View the information of the fragment file
[root@controller opt]# swift stat chinaskill cirros-0.4.0-x86_64-disk.img
Account: AUTH_d27d72c12d3b46b89572df53a71e5d04
Container: chinaskill
Object: cirros-0.4.0-x86_64-disk.img
Content Type: application/octet-stream
Content Length: 12716032
Last Modified: Sun, 10 Apr 2022 13:50:51 GMT
ETag: "7945d1b1d6ad1394eb6e2477f6a25fd3"
Manifest: chinaskill_segments/cirros-0.4.0-x86_64-disk.img/1649580724.978164/12716032/10485760/
Meta Mtime: 1649580724.978164
Accept-Ranges: bytes
X-Timestamp: 1649598650.12549
X-Trans-Id: txba9c525b8ea84110b59e2-006252e0d6
X-Openstack-Request-Id: txba9c525b8ea84110b59e2-006252e0d6
web Interface to view container and fragment files

Task three That's it .
版权声明
本文为[King_ nul]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230629527166.html
边栏推荐
- Program, process, thread; Memory structure diagram; Thread creation and startup; Common methods of thread
- Rembg split mask
- Kettle实验 (三)
- 資源打包關系依賴樹
- What is augmented reality technology? Where can it be used?
- GoLand debug go use - white record
- Installation of data cleaning ETL tool kettle
- Go language self-study series | initialization of golang structure
- 《信息系统项目管理师总结》第八章 项目干系人管理
- JS prototype chain
猜你喜欢
![[geek challenge 2019] havefun1](/img/8b/b15bf31771d54db25f24d630e64093.png)
[geek challenge 2019] havefun1

Applet error: should have URL attribute when using navigateto, redirectto or switchtab

AQS & reentrantlock implementation principle

Using JS to realize a thousandth bit

Pctp test experience sharing

Enter "net start MySQL" and "system error 5. Access denied" appears. Detailed explanation of the problem

Machine learning (VI) -- Bayesian classifier

What is augmented reality technology? Where can it be used?

Bk3633 specification

Redis Desktop Manager for Mac
随机推荐
Download and install bashdb
Applet error: cannot read property'currenttarget'of undefined
Applet in wechat and app get current ()
Initial experience of talent plan learning camp: communication + adhering to the only way to learn open source collaborative courses
node安装
Secrets in buffctf file 1
Strength comparison vulnerability of PHP based on hash algorithm
Technological innovation in government affairs in the construction of Digital Government
[C language] document operation
NLLLoss+log_ SoftMax=CE_ Loss
[Luke V0] verification environment 2 - Verification Environment components
Redis Desktop Manager for Mac
How to protect open source projects from supply chain attacks - Security Design (1)
[in-depth good article] detailed explanation of Flink SQL streaming batch integration technology (I)
ASUS laptop can't read USB and surf the Internet after reinstalling the system
Taxable income
MySQL小練習(僅適合初學者,非初學者勿進)
NPM installation yarn
Arbre de dépendance de l'emballage des ressources
Kettle experiment