首页 > 其他分享 >【2023年】云计算金砖牛刀小试2

【2023年】云计算金砖牛刀小试2

时间:2024-08-04 20:28:23浏览次数:8  
标签:牛刀小试 金砖 -- 命令 controller 2023 openstack iaas 节点

A场次题目:Openstack 平台部署与运维

control 172.17.31.10
compute 172.17.31.20 compute

任务1 私有云平台环境初始化

1.初始化操作系统 使用提供的用户名密码,登录竞赛云平台。根据表 1 中的 IP 地址规划,设置各服务器节点的 IP 地址,确保网络正常通信,设置控制节点主机名为 Controller,计算节点主机名为 Compute,并修改 hosts 文件将 IP 地址映射为主机名, 关闭防火墙并设置为开机不启动,设置 SELinux 为 Permissive 模式并设置永久 关闭。请查看控制节点和计算节点主机名,使用命令查看 SELinux 状态,使用 head 命令、tail 命令和 cut 命令提取出永久关闭 SELinux 的关键信息。 将以上命令及返回结果提交到答题框

配置host

vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

172.17.31.10	controller
172.17.31.20	compute

关闭防火墙并设置为开机不启动

systemctl stop firewalld
systemctl disable firewalld

关闭selinux并永久关闭

setenforce 0
vi /etc/selinux/config
 SELINUX=Permissive

使用命令查看selinux状态

getenforce
 Disabled

2.挂载安装光盘镜像 将提供的 CentOS-7-x86_64-DVD-1804.iso 和 chinaskills_cloud_iaas.iso 光盘镜像上传到 Controller 节点 /root 目录下,然后在 /opt 目录下使用一条 命令创建/centos 目录和/iaas 目录,并将镜像文件 CentOS-7-x86_64-DVD-1804. iso 挂载到 /centos 目录下,将镜像文件 chinaskills_cloud_iaas.iso 挂载到 /iaas 目录下。 请将以上命令及返回结果返回到答题框。【1 分】

 mkdir /opt/centos
 mkdir /opt/iaas
 mount chinaskills_cloud_iaas.iso /opt/iaas
 mount CentOS-7-x86_64-DVD-1804.iso /opt/centos

3.搭建文件共享服务器在Controller节点上安装 vsftp 服务器设置开机自启动,请将以上命令 及返回结果提交到答题框。【0.5 分】

#在controller节点
yum install -y vsftpd
vi /etc/vsftpd/vsftpd.conf
  anon_root=/opt/
systemctl start vsftpd
systemctl enable vsftpd

4.设置 yum 源

将 ftp 仓库设置为 /opt/,为 controller 节点设置本地 yum 源,yum 源文件名为 local.repo;为 compute 配置 ftp 源,yum 源文件名称为 ftp.repo,其中ftp服务器地址为 controller 节点 IP.请将两个节点的 yum 源文件内容提交到答题框。【0.5 分】

#在controller节点

mv /etc/yum.repos.d/* /etc/yum
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

#在compute节点
mv /etc/yum.repos.d/* /etc/yum
vi /etc/yum.repos.d/ftp.repo
[centos]
name=centos
baseurl=ftp://172.17.31.10/centos
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=ftp://172.17.31.20/iaas/iaas-repo

5.部署时间同步服务器

在 Controller 节点上部署 chrony 服务器,允许其他节点同步时间,启动服务并设置为开机启动;在 compute 节点上指定 controller 节点为上游 NTP 服务器,重启服务并设为开机启动。

请在控制节点上使用 chronyc 命令同步控制节点的系统时间。【1 分】

#在centroller节点

 vi /etc/chrony.conf
  # Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server controller iburst
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift

# Allow the system clock to be stepped in the first three updates
# if its offset is larger than 1 second.
makestep 1.0 3

# Enable kernel synchronization of the real-time clock (RTC).
rtcsync

# Enable hardware timestamping on all interfaces that support it.
#hwtimestamp *

# Increase the minimum number of selectable sources required to adjust
# the system clock.
#minsources 2

# Allow NTP client access from local network.
#allow 192.168.0.0/16

# Serve time even if not synchronized to a time source.
#local stratum 10

# Specify file containing keys for NTP authentication.
#keyfile /etc/chrony.keys

# Specify directory for log files.
logdir /var/log/chrony

# Select which information is logged.
#log measurements statistics tracking
allow 172.17.31.0/24
local stratum 10


systemctl restart chronyd
systemctl enable chronyd

在compute节点

vi /etc/chrony.conf

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server controller iburst
# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift

# Allow the system clock to be stepped in the first three updates
# if its offset is larger than 1 second.
makestep 1.0 3

# Enable kernel synchronization of the real-time clock (RTC).
rtcsync

# Enable hardware timestamping on all interfaces that support it.
#hwtimestamp *

# Increase the minimum number of selectable sources required to adjust
# the system clock.
#minsources 2

# Allow NTP client access from local network.
#allow 192.168.0.0/16

# Serve time even if not synchronized to a time source.
#local stratum 10

# Specify file containing keys for NTP authentication.
#keyfile /etc/chrony.keys

# Specify directory for log files.
logdir /var/log/chrony

# Select which information is logged.
#log measurements statistics tracking

systemctl restart chronyd
systemctl enable chronyd

任务二 Openstack 搭建任务

1.修改变量文件

在控制节点和计算节点上分别安装 iaas-xiandian 软件包,修改配置脚本文件中基本变量(配置脚本文件为/etc/xiandian/openrc.sh)。修改完成后使用命令生效该变量文件,然后执行 echo $INTERFACE_IP 命令。

请将命令和返回结果提交到答题框。【0.5 分】

在controller节点

yum install -y iaas-xiandian

vi /etc/xiandian/openrc.sh
 
 #tips: :%s/#// 去除#
        :%s/PASS=/PASS=000000
        
source /etc/xiandian/openrc.sh
echo $INTERFACE_IP

在comopute节点

yum install -y iaas-xiandian

#登录到controller
scp /etc/xiandian/openrc.sh [email protected]:/etc/xiandian/openrc.sh

修改INTERFACE_IP即可
source /etc/xiandian/openrc.sh
echo $INTERFACE_IP

2.搭建数据库组件

使用提供的脚本框架 iaas-install-mysql.sh 填充脚本,在 controller 节点上安装 mariadb、mencached、rabbitmq 等服务并完成相关配置。完成后修改配置文件将 mencached 最大连接数修改为 2048。

请将修改后的配置文件提交到答题框。【1 分】

在controller节点

iaas-install-mysql.sh

#若配置文件忘记位置,可以通过查看iaas-install-mysql.sh查看位置
vi /etc/sysconfig/memcached
MAXCONN="2048"

3.搭建认证服务组件

使用提供的脚本框架 iaas-install-keystone.sh 填充脚本,在 controlle r 节点上安装 keystone 服务并完成相关配置。完成后使用 openstack 命令请求 一个 token。

请将以上命令和返回结果提交到答题框。【1 分】

在controller节点

iaas-install-keystone.sh
openstack token issue

4.搭建镜像服务组件

使用提供的脚本框架 iaas-install-glance.sh 填充脚本,在 controller 节点上安装 glance 服务并完成相关配置。完成后请将 cirros-0.3.4-x86_64-disk.img 上传到控制节点的 /root 目录下,然后使用 openstack 命令将该镜像上传到 openstack 平台镜像命名为 cirros。

请将镜像上传的操作命令和返回结果提交到答题框。【1 分】

在controller节点

iaas-install-glance.sh
openstack image create --disk-format qcow2 --container-format bare  --shared cirros </root/cirros-0.3.4-x86_64-disk.img 

5.搭建计算服务组件

使用提供的脚本框架 iaas-install-nova-controller.sh 和 iaas-install-nova-compute.sh 填充脚本,在 controller 和 compute 节点上安装 nova 服务并完成配置。完成后请将控制节点的计算资源也加入集群。然后使用 openstack 命令列出能提供计算资源的节点。

将列出计算资源的命令和返回结果提交到答题框。【1.5 分】

在controller节点

iaas-install-nova-controller.sh

在compute节点

iaas-install-nova-compute.sh

controller:

#将控制节点的计算资源也加入集群
把compute节点的名称和IP都改成controller节点的名称和IP
vi /etc/iaas-openstack/openrc.sh
HOST_IP_NODE=172.17.31.10
HOST_NAME_NODE=controller

iaas-install-nova-compute.sh
#建议执行完毕后改回

修改nova配置

cat /etc/nova/nova.conf
[libvirt]
virt_type=qemu		##在[libvirt]下添加此行即可

6.搭建网络组件并初始化网络

使用提供 的脚本框架 iaas-install-neutron-controller.sh 和 iaas-install-neutron-compute.sh,填充脚本,在 controller 和 compute 节点上安装 neutron 服务并完成配置。创建云主机外部网络 ext-net,子网为 ext-subnet,云主机浮动 IP 可用网段为 172.18.x.100~172.18.x.200,网关为 172.18.x.1。创建云主机内部网络 int-net1,子网为 int-subnet1,云主机子网 IP 可用网段为 10.0.0.100~10.0.0.200,网关为 10.0.0.1;创建云主机内部网络 int-net2,子网为 int-subnet2,云主机子网 IP 可用网段为 10.0.1.100 ~ 10.0.1.200,网关为 10.0.1.1。添加名为 ext-router 的路由器,添加网关在 ext-net 网络,添加内部端口到 int-net1 网络,完成内部网络 int-net1 和外部网络的连通。

请使用 openstack 命令完成以下任务,完成后将命令和返回结果提交到答题框。【4 分】

controller

iaas-install-neutron-controller.sh

compute

iaas-insta ll-neutron-compute.sh

创建网络(controller)

#创建外部网络
openstack network create --external  --provider-physical-network provider --provider-network-type flat   ext-net
#给外部网络绑定ip
openstack subnet create  --network ext-net --subnet-range 172.18.31.0/24 --gateway 172.18.31.1 --allocation-pool start=172.18.31.100,end=172.18.31.200 --dhcp  ext-subnet
#创建int-net1(云主机子网 IP 可用网段为 10.0.0.100~10.0.0.200,网关为 10.0.0.1)
openstack network create --internal int-net1
#创建int-net1网段int-subnet1
openstack subnet create --subnet-range 10.0.0.0/24  --gateway 10.0.0.1 --dhcp --allocation-pool start=10.0.0.100,end=10.0.0.200  --network int-net1 int-subnet1
#创建int-net2(云主机子网 IP 可用网段为 10.0.1.100 ~ 10.0.1.200,网关为 10.0.1.1)
openstack network create --internal int-net2
#创建int-net2网段
openstack subnet create --subnet-range 10.0.1.0/24  --gateway 10.0.1.1 --dhcp --allocation-pool start=10.0.1.100,end=10.0.1.200  --network int-net2 int-subnet2

#添加路由ext-router
openstack router create ext-router
openstack router set --enable --enable-snat --external-gateway ext-net ext-router
openstack router add subnet ext-router int-subnet1

7.搭建图形化界面

使用提供的脚本框架 iaas-install-dashboard.sh,填充脚本,在 controller 节点上安装 dashboard 服务并完成相关配置。

请使用 curl 指令获取 dashboard 首页信息,将获取到的首页信息提交到答 题框。【1 分】

controller

iaas-install-dashboard.sh
 curl -L http://192.168.100.10/dashboard

任务 3 OpenStack 运维任务

1.用户管理

在 keystone 中创建用户 testuser,密码为 password。创建好之后,使用命令修改 testuser 密码为 000000,并查看 testuser 的详细信息。添加将该 用户添加到 admin 项目并赋予普通用户权限,完成后测试登录。

使用 testuser 用登录系统完成后截图并提交到答题框。【1 分】

openstack user create  testuser  --password password --domain demo
openstack user set testuser --password 000000
openstack user show testuser
+---------------------+----------------------------------+
| Field               | Value                            |
+---------------------+----------------------------------+
| domain_id           | ff1e0a9d790046209bd22307ca565a8e |
| enabled             | True                             |
| id                  | 79ab69675e6a454a83fc1f13bd884315 |
| name                | testuser                         |
| options             | {}                               |
| password_expires_at | None                             |
+---------------------+----------------------------------+
openstack role add user --user testuser --project admin 

2.服务查询

使用命令列出服务目录和端点,查看 glance 服务的端点。将以上命令和返

回结果提交到答题框。【0.5 分】

openstack service list #查看服务目录
openstack endpoint list #查看服务端点
openstack endpoint list | grep glance

3.镜像管理

登录 controller 节点,使用 glance 相关命令,上传镜像,源使用 CentOS_6.5_x86_64_XD.qcow2,名字为 testone,然后使用 openstack 命令修改这个镜像名改为 examimage,然后给这个镜像打一个标签,标签名字为 lastone 改完后使用 openstack 命令查看镜像列表。

将以上命令和返回结果提交到答题框。【2 分】

glance image-create --name testone --disk-format qcow2 --container bare --file /opt/images/CentOS_6.5_x86_64_XD.qcow2 

openstack image set --name examiage --tag lastone testone

4.后端配置文件管理

进入到glance 后端存储目录中,使用 qemu 命令查看任意的一个镜像信息。使用 du 命令查看 nova 主配置文件大小。

将以上命令和返回结果提交到答题框。【0.5 分】

cd /var/lib/glance/images/
#qemu-img info <文件名称>
qemu-img info 6ca6669e-cc71-4f51-becf-b5db53c212f1

5.存储服务管理

创建一个卷类型,然后创建一块带这个卷类型标识的云硬盘,查询该云硬盘的详细信息。将该云硬盘挂载到虚拟机中,将该云硬盘格式化为 xfs。创建一个文件文件名为工位号内容为工位号,然后将该云硬盘卸载,使用 openstack 命令将该云硬盘修改为只读状态,再次挂载后查看是否存在原始文件,然后再次向该云硬盘中创建一个文件,文件名为工位号_02。

将返回结果及解题过程提交到答题框。【2 分】

#创建卷类型
 openstack volume type create lvm1
#创建卷
 openstack volume create --size 10 --type lvm1 juan1
#查看卷详细信息
  openstack volume show juan1 
#将云硬盘挂载到虚拟机中
openstack server add volume centos juan1
#将云硬盘格式化为xfs
mkfs.xfs /dev/vdb
#挂在创建文件
mount /dev/vdb /mnt
touch /mnt/31
umount /mnt
#云硬盘卸载
openstack server remove volume centos juan1
#设置为只读
openstack volume set juan1 --read-only
#将云硬盘挂载到虚拟机中
openstack server add volume centos juan1
#挂在创建文件
mount /dev/vdb /mnt
touch /mnt/31_02
显示不成功

6.存储服务管理

使用命令创建一个 5GB 的云硬盘,名称为 disk-2,将云硬盘挂载到云虚拟机内,然后格式化为 ext4,挂载到虚拟机的 /mnt/ 目录下,使用 df -h 将命令和返回信息提交到答题框。将该云硬盘使用命令卸载,使用命令将该云硬盘扩容到 10GB,使用命令将云硬盘挂载到云主机上,将命令及返回信息提交到答题框。进入云主机使用命令扩容文件系统,扩容后再次挂载到 /mnt/使用 df -hT 命令并将命令和返回信息提交到答题框。【2 分】。

#创建云硬盘
openstack volume create --size 5 'disk-2'
#挂载
openstack server add volume centos disk-2
#格式化
mkfs.ext4 /dev/vdb
mount /dev/vdb /mnt
df-h
#卸载
umount /mnt
openstack server remove volume centos disk-2
#扩容
openstack volume set --size 10 'disk-2'
#挂载
openstack server add volume centos disk-2
#格式化
mkfs.ext4 /dev/vdb
mount /dev/vdb /mnt
df -hT

7.对象存储管理

使用 swift 相关命令,创建一个容器,然后往这个容器中上传一个文件(文件可以自行创建),上传完毕后,使用命令查看容器。

将以上命令和返回结果提交到答题框。【0.5 分】

swift post container
swift upload  container /root/cirros-0.3.4-x86_64-disk.img
swift list container

8.安全组管理

使用命令创建名称为 group_web 的安全组该安全组的描述为工位号,为该安全组添加一条规则允许任意 ip 地址访问 web 流量,完成后查看该安全组的详细信息。

将以上命令和返回结果提交到答题框。【2 分】

openstack security group create group_web --description 31
openstack security group rule create group_web --protocol tcp --dst-port 80:80 --remote-ip 0.0.0.0/0
openstack security group rule create group_web --protocol tcp --dst-port 443:443 --remote-ip 0.0.0.0/0
openstack security group show group_web

9.网络管理

使用命令将int-net1网络设置为共享,然后查看int-net1网络的详细信息。

将命令和返回信息提交到答题框。

openstack network set --share  int-net1

10.网络管理

使用 dashboard 界面使用 centos7.5 镜像创建一台云主机,云主机命名为 test-01,使用命令查看浮动 IP 地址池,使用命令创建一个浮动 IP,然后将浮动IP 绑定到云主机上。

将命令和返回信息提交到答题框。【1 分】

openstack floating ip create ext-net
openstack server add floating ip test-01 172.18.31.118

11.虚拟机管理

使用 opentack 命令利用 centos7.5 镜像创建一台云主机,连接 int-net1 网 络,云主机名称为 test-02。创建成功后使用命令查看云主机详细信息,确定该云主机是处于计算节点还是控制节点。如果云主机处于控制节点上请将其冷迁移到计算节点,如果如果云主机处于计算节点上请将其冷迁移到控制节点。

本题全部流程请使用命令完成,请将全部命令和结果粘贴到答题框。【3 分】

一、冷迁移
1、在控制节点关闭虚拟机
2、在计算节点找到实例位置(/var/lib/nova/instances)
3、将计算节点的需要转移的实例文件copy到目标主机的相同位置下。
4、到目标主机,赋予实例权限
5、登录数据库更改mysql的host,node字段为新的物理主机名。
6、重启目标主机的nova-compute服务

#查看虚拟机在哪个节点
openstack service show test-02

标签:牛刀小试,金砖,--,命令,controller,2023,openstack,iaas,节点
From: https://blog.csdn.net/m0_64903413/article/details/140911214

相关文章

  • 塔子哥喜欢字符-小米2023笔试(codefun2000)
    题目链接塔子哥喜欢字符-小米2023笔试(codefun2000)题目内容塔子哥天生偏爱一些字符,对于一个字符串,他总是想把字符串中的字符变成他偏爱的那些字符。如果字符串中某个字符不是他所偏爱的字符,称为非偏爱字符,那么他会将该非偏爱字符替换为字符串中距离该字符最近的一个偏......
  • 谈一谈编程到底应该怎么学?-暨2023年 CSP-J2轮爆零总结
    谈一谈编程到底应该怎么学?-暨2023年CSP-J2轮爆零总结转自https://mp.weixin.qq.com/s/_Fi64pYrZ6tHfKaNDb3xAA今年的信息学奥赛复赛结果已经基本出来了,整个行业讨论最多的就是今年的爆0问题。据说一个省,总共1900多人参加J组复赛,有800个0分。其它各省也都是爆0很多。但是同......
  • CVE-2023-26469 复现
    题目描述:Jorani是一款开源的员工考勤和休假管理系统,适用于中小型企业和全球化组织,它简化了员工工时记录、休假请求和审批流程,并提供了多语言支持以满足不同地区的需求。在Jorani1.0.0中,攻击者可以利用路径遍历来访问文件并在服务器上执行代码。这是一个csrf的洞,找了一下,......
  • 2023.8.3 test
    A有序列\(A\),你可进行若干次操作:选定\(A_i,A_j\),使\(A_i=\gcd(A_i,A_j)\),\(A_j=lcm(A_i,A_j)\)。\(n,A_i\le10^6\)。把每个质因数独立开,发现无论怎么操作,每个数某质因数的次数的集合不变。所以贪心地,从大往小放置\(A_1\simA_n\)。B无向图上,\(n\le20\),你要随机起点走......
  • 塔子哥的最短区间-小米2023笔试(codefun2000)
    题目链接塔子哥的最短区间-小米2023笔试(codefun2000)题目内容塔子哥有一个长度为n的数组a和长度为m的数组b,下标均从1开始。现在,塔子哥想让你找出一个最短的区间l,r,这个区间中数x的数量至少出现了b[x]次。输入描述第一行,两个整数n,m(......
  • [paper阅读笔记][2023]CorpusLM: Towards a Unified Language Model on Corpusfor Kno
    文章链接:https://arxiv.org/pdf/2402.01176v2Paper的任务处理各种知识密集型任务任务的科学问题本文任务虽然是:提出一个统一的语言模型来处理各种知识密集型任务,但其实其本质科学问题是:如何提高LLMs在知识密集型任务中的检索效率。原因是:LLMs在生成文本时容易出现错误信......
  • GEE案例:Landsat 5、7、8影像构建1985-2023年rsei生态遥感指数详细代码
    之前关于RSEI的博客 GoogleEarthEngine(GEEÿ......
  • python中  datetime.now() 获取当前时间 例如:2023-04-01 12:34:56.789012
    问:python中 datetime.now()获取当前时间例如:2023-04-0112:34:56.789012答:在Python中,datetime.now()函数是用来获取当前日期和时间的。但是,需要注意的是,这个函数是datetime模块中datetime类的一个方法,因此你需要从datetime模块中导入datetime类(尽管这看起来有点......
  • 【IEEE出版 | ICBASE 2020-2023 均已被 EI , Scopus检索 | 温州理工学院、加拿大圭尔
    第五届大数据、人工智能与软件工程国际研讨会(ICBASE2024)将于2024年09月20-22日在中国温州隆重举行。会议主要围绕大数据、人工智能与软件工程等研究领域展开讨论。会议旨在为从事大数据、人工智能与软件工程研究的专家学者、工程技术人员、技术研发人员提供一个共享科研成果和......
  • CVE-2023-1313
    开启靶场url访问/install来运行安装http://eci-2ze0wqx38em0qticuhug.cloudeci1.ichunqiu.com/install/得知其用户和密码为admin登录查找文件上传位置上传一句话木马文件<?phpechophpinfo();@eval($_POST['flw']);?>下载查看上传木马路径复制路径/storag......