1+x雲端計算平臺運維開發初級實操題集合

一路飆森發表於2020-11-09

網路管理

配置交換機

在eNSP中使用S5700交換機進行配置,通過一條命令劃分vlan 2、vlan 3、vlan 1004,通過埠組的方式配置埠1-5為access模式,並新增至vlan2中。配置埠10為trunk模式,並放行vlan3。建立三層vlan 2,配置IP地址為:172.16.2.1/24,建立三層vlan1004,配置IP地址為:192.168.4.2/30。通過命令新增預設路由,下一跳為192.168.4.1。(使用完整命令)

參考答案

[Huawei]vlan batch 2 3 1004
[Huawei]port-group 1
[Huawei-port-group-1]group-member GigabitEthernet 0/0/1 to GigabitEthernet 0/0/5
[Huawei-port-group-1]port link-type access
[Huawei-port-group-1]port default vlan 2
[Huawei]interface GigabitEthernet 0/0/10
[Huawei-GigabitEthernet0/0/10]port link-type trunk
[Huawei-GigabitEthernet0/0/10]port trunk allow-pass vlan 3
[Huawei]interface Vlanif 2
[Huawei-Vlanif2]ip address 172.16.2.1 24
[Huawei]interface Vlanif 1004
[Huawei-Vlanif1004]ip address 192.168.4.2 30
[Huawei]ip route-static 0.0.0.0 0 192.168.4.1

通過一條命令在S1交換機(交換機使用S5700)上建立vlan100、vlan101,配置vlan100閘道器為:172.16.100.254/24。配置vlan101閘道器為:172.16.101.254/24。配置g0/0/1埠為trunk模式,放行vlan100。配置g0/0/2埠為access模式,所屬vlan101。將以上所有操作命令和返回結果以文字形式提交大答題框。

參考答案

[SW1]vlan batch 100 101
[SW1]interface Vlanif 100
[SW1-Vlanif100]ip address 172.16.100.254 24
[SW1]interface Vlanif 101
[SW1-Vlanif101]ip address 172.16.101.254 24
[SW1]interface GigabitEthernet 0/0/1
[SW1-GigabitEthernet0/0/1]port link-type trunk
[SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan 100
[SW1-GigabitEthernet0/0/1]quit
[SW1]interface GigabitEthernet 0/0/2
[SW1-GigabitEthernet0/0/2]port link-type access
[SW1-GigabitEthernet0/0/2]port default vlan 101
[SW1-GigabitEthernet0/0/2]quit

配置路由器

配置路由器R1(路由器使用AR2220)埠g0/0/1地址為192.168.101.1/30,配置g0/0/2埠地址為12.12.12.2/30。新增靜態路由去往192.168.1.0/24網段,下一跳地址為192.168.101.2,新增靜態路由去往192.168.2.0/24,下一跳地址為12.12.12.1。將以上所有操作命令和返回結果以文字形式提交到答題框。

參考答案

[R1]interface GigabitEthernet 0/0/1
[R1-GigabitEthernet0/0/1]ip address 192.168.101.1 30
[R1-GigabitEthernet0/0/1]quit
[R1]interface GigabitEthernet 0/0/2
[R1-GigabitEthernet0/0/2]ip address 12.12.12.2
[R1-GigabitEthernet0/0/2]quit
[R1]ip route-static 192.168.1.0 24 192.168.101.2
[R1]ip route-static 192.168.2.0 24 12.12.12.1

Linux作業系統

Linux儲存LVM管理

使用VMware軟體和提供的CentOS-7-x86_64-DVD-1511.iso建立虛擬機器,自行配置好網路並多新增一塊大小為20G的硬碟,使用fdisk命令對該硬碟進形分割槽,要求分出三個大小為5G的分割槽。使用這三個分割槽,建立名xcloudvg的卷組。然後建立名xcloudlv的邏輯卷,大小為12G,最後用xfs檔案系統對邏輯捲進行格式化並掛載到/mnt目錄下。將上述所有操作命令和返回結果以文字形式提交到答題框。

參考答案

[root@localhost ~]# pvcreate /dev/vdb1 /dev/vdb2 /dev/vdb3
Physical volume "/dev/vdb1" successfully created
Physical volume "/dev/vdb2" successfully created
Physical volume "/dev/vdb2" successfully created
[root@localhost ~]# vgcreate xcloudvg /dev/vdb[1-3]
Volume group "xcloudvg" successfully created
[root@localhost ~]# lvcreate -L +12G –n xcloudvg xcloudlv
Logical volume "xcloudlv" created.
[root@localhost ~]# mkfs.xfs /dev/mapper/xcloudvg-xcloudlv
[root@localhost ~]# mount /dev/mapper/ xcloudvg-xcloudlv /mnt/

使用xserver1虛擬機器,使用VMWare軟體自行新增一塊大小為20G的硬碟,使用fdisk命令對該硬碟進形分割槽,要求分出兩個大小為5G的分割槽。使用兩個分割槽,建立名xcloudvg的卷組並指定PE大小為16 MB。將執行vgdisplay命令的返回結果以文字形式提交到答題框。

參考答案

[root@localhost ~]# vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size 19.51 GiB
PE Size 4.00 MiB
Total PE 4994
Alloc PE / Size 4984 / 19.47 GiB
Free PE / Size 10 / 40.00 MiB
VG UUID 2H21hv-L20X-mqhJ-SvzR-crT2-ln9v-jj2gTY
--- Volume group ---
VG Name xcloudvg
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 1
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 0
Open LV 0
Max PV 0
Cur PV 2
Act PV 2
VG Size 9.97 GiB
PE Size 16.00 MiB
Total PE 638
Alloc PE / Size 0 / 0
Free PE / Size 638 / 9.97 GiB
VG UUID dU0pP2-EW9d-6c0h-8tgQ-t1bN-tBIo-FDqfdR

yum源管理

當前有一個centos7.2-1511.iso的映象檔案,使用這個檔案配置yum源,要求將這個映象檔案掛載在/opt/centos目錄。還存在一個ftp源,IP地址為192.168.100.200,ftp共享的目錄為/opt,/opt目錄中存在一個 iaas 目錄(該目錄下存在一個 repodata 目錄)請問如何配置自己的 local.repo 檔案,使得可以使用這兩個地方的軟體包,安裝軟體。請將 local.repo 檔案的內容以文字形式提交到答題框。

參考答案

[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=ftp://192.168.100.200/iaas
gpgcheck=0
enabled=1

使用VMWare軟體啟動提供的xserver1虛擬機器(配置虛擬機器xserver1的IP為192.168.100.11,主機名為xserver1),在虛擬機器的/root目錄下,存在一個CentOS-7-x86_64-DVD-1511.iso的映象檔案,使用這個映象檔案配置本地yum源,要求將這個映象檔案掛載在/opt/centos目錄,請問如何配置自己的local.repo檔案,使得可以使用該映象中的軟體包,安裝軟體。請將local.repo檔案的內容以文字形式提交到答題框。

參考答案

[centos]
name=centos
baseurl=file:///opt/centos
gpgcheck=0
enabled=1

當前存在一個ftp源,IP地址為192.168.100.200,ftp共享的目錄為/opt,/opt目錄中存在一個iaas目錄(該目錄下存在一個repodata目錄)請問如何配置自己的ftp.repo檔案,使得可以使用這兩個地方的軟體包,安裝軟體。請將ftp.repo檔案的內容以文字形式提交到答題框。

參考答案

[iaas]
name=iaas
baseurl=ftp://192.168.100.200/iaas
gpgcheck=0
enabled=1

當前有一個/opt目錄,該目錄中的檔案如下所示:

├── ambari-2.6.0.0

│ ├── ambari

│ ├── repodata

│ └── smartsense

├── base

│ ├── packages

│ └── repodata

請問如何配置自己的local.repo檔案,使得可以使用這兩個地方的軟體包,安裝軟體。請將local.repo檔案的內容以文字形式提交到答題框。

參考答案

[centos]
name=centos
baseurl=file:///opt/ambari-2.6.0.0
gpgcheck=0
enabled=1
[iaas]
name=iaas
baseurl=file:///opt/base
gpgcheck=0
enabled=1

FTP安裝使用

使用xserver1虛擬機器,安裝ftp服務,並配置ftp的共享目錄為/opt。使用VMWare軟體繼續啟動提供的xserver2虛擬機器(配置虛擬機器xserver2的IP為192.168.100.12,主機名為xserver2),並建立該虛擬機器的yum原始檔ftp.repo使用xserver1的ftp源(配置檔案中的FTP地址使用主機名)。配置完成後,將xserver2節點的ftp.repo檔案以文字形式提交到答題框。

參考答案

[centos]
name=centos
baseurl=ftp://xserver1/centos
gpgcheck=0
enabled=1

Samba管理

使用xserver1虛擬機器,安裝Samba服務所需要的軟體包,將xserver1節點中的/opt/share目錄使用Samba服務共享出來(目錄不存在請自行建立)。操作完畢後,將xserver1節點Samba配置檔案中的[share]段落和執行netstat -ntpl命令的返回結果以文字形式提交到答題框。

參考答案

[share]
path = /opt/share
browseable = yes
public = yes
writable = yes
[root@samba ~]# netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 2718/smbd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1469/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2168/master
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 2718/smbd
tcp6 0 0 :::139 :::* LISTEN 2718/smbd
tcp6 0 0 :::22 :::* LISTEN 1469/sshd
tcp6 0 0 ::1:25 :::* LISTEN 2168/master
tcp6 0 0 :::445 :::* LISTEN 2718/smbd

LNMP環境部署

使用xserver1節點,安裝單節點lnmp環境。安裝lnmp環境需要用到的YUM源為CentOS-7-x86_64-DVD-1511.iso和lnmp目錄(均在/root目錄下)。安裝並配置完lnmp環境後。依次查詢資料庫、nginx、php服務的狀態,並使用netstat -ntpl命令檢視埠開放情況。最後依次將查詢服務狀態的返回結果,和檢視埠開放情況的返回結果以文字形式提交到答題框。

參考答案

[root@localhost ~]# systemctl status mariadb
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled)
Active: active (running) since Fri 2019-12-06 12:29:37 EST; 56s ago
Process: 2741 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS)
Process: 2713 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Main PID: 2740 (mysqld_safe)
CGroup: /system.slice/mariadb.service
├─2740 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
└─2897 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/ma...
Dec 06 12:29:34 localhost.localdomain systemd[1]: Starting MariaDB database server...
Dec 06 12:29:34 localhost.localdomain mysqld_safe[2740]: 191206 12:29:34 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
Dec 06 12:29:34 localhost.localdomain mysqld_safe[2740]: 191206 12:29:34 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Dec 06 12:29:37 localhost.localdomain systemd[1]: Started MariaDB database server.
[root@localhost ~]# systemctl status nginx
● nginx.service - nginx - high performance web server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: active (running) since Fri 2019-12-06 12:29:54 EST; 46s ago
Docs: http://nginx.org/en/docs/
Process: 2945 ExecStart=/usr/sbin/nginx -c /etc/nginx/nginx.conf (code=exited, status=0/SUCCESS)
Main PID: 2946 (nginx)
CGroup: /system.slice/nginx.service
├─2946 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
└─2947 nginx: worker process
Dec 06 12:29:54 localhost.localdomain systemd[1]: Starting nginx - high performance web server...
Dec 06 12:29:54 localhost.localdomain systemd[1]: PID file /var/run/nginx.pid not readable (yet?) after start.
Dec 06 12:29:54 localhost.localdomain systemd[1]: Started nginx - high performance web server.
[root@localhost ~]# systemctl status php-fpm
● php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled)
Active: active (running) since Fri 2019-12-06 12:30:00 EST; 59s ago
Main PID: 2953 (php-fpm)
Status: "Processes active: 0, idle: 5, Requests: 0, slow: 0, Traffic: 0req/sec"
CGroup: /system.slice/php-fpm.service
├─2953 php-fpm: master process (/etc/php-fpm.conf)
├─2955 php-fpm: pool www
├─2956 php-fpm: pool www
├─2957 php-fpm: pool www
├─2958 php-fpm: pool www
└─2959 php-fpm: pool www
Dec 06 12:29:59 localhost.localdomain systemd[1]: Starting The PHP FastCGI Process Manager...
Dec 06 12:30:00 localhost.localdomain systemd[1]: Started The PHP FastCGI Process Manager.
[root@localhost ~]# netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 2953/php-fpm: maste
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2897/mysqld
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2946/nginx: master
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1494/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2651/master
tcp6 0 0 :::22 :::* LISTEN 1494/sshd
tcp6 0 0 ::1:25 :::* LISTEN 2651/master

WordPress應用系統

使用xserver1節點,基於lnmp環境,部署WordPress應用(WordPress原始碼包在/root目錄下)。應用部署完畢後,設定WordPress的站點標題為自己的姓名(例:名字叫張三,則設定站點標題為張三的BLOG),設定完畢後登入WordPresss首頁。最後將命令curl ip(ip為wordpress的首頁ip)的返回結果以文字形式提交到答題框。

參考答案

[root@localhost ~]# curl 192.168.100.10
<!DOCTYPE html>
<title>張三 &#8211; 又一個WordPress站點</title>
<p>歡迎使用WordPress。這是您的第一篇文章。編輯或刪除它,然後開始寫作吧!</p>

使用提供的軟體包和vmware提供的centos7.2作業系統,完成LNMP+WordPress部署。部署完成後,進行登入,最後提交WordPress首頁和後臺管理介面。(設定WordPress名稱為自己的姓名+BLOG,例如張三,則WordPress首頁顯示張三BLOG,答案的截圖需體現這點)

參考答案
在這裡插入圖片描述
在這裡插入圖片描述

資料庫管理

MariaDB管理

使用VMware軟體和提供的CentOS-7-x86_64-DVD-1511.iso建立虛擬機器,自行配置好網路和YUM源,安裝mariadb資料庫,安裝完畢後登入資料庫,查詢當前系統的時間和使用者。依次將操作命令和返回結果以文字形式提交到答題框。(資料庫使用者名稱root,密碼000000;關於資料庫的命令均使用小寫)

參考答案

[MariaDB [(none)]> select sysdate();
+---------------------+
| sysdate() |
+---------------------+
| 2018-01-17 09:28:07 |
+---------------------+
1 row in set (0.00 sec)
MariaDB [(none)]> select user();
+----------------+
| user() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.01 sec)

主從資料庫

使用VMWare建立兩臺centos7系統的虛擬機器,安裝資料庫服務,並將兩臺資料庫配置為主從資料庫模式(master和slave)。配置完成後,在從節點,執行show status slave\G檢視從節點的複製狀態。將檢視從節點服務狀態的返回結果以文字形式提交到答題框。(資料庫使用者名稱root,密碼000000;關於資料庫的命令均使用小寫)

參考答案

[mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.2.222 //主伺服器地址
Master_User: mysync //授權帳戶名,儘量避免使用root
Master_Port: 3306 //資料庫埠,部分版本沒有此行
Connect_Retry: 60
Master_Log_File: mysql-bin.000004
Read_Master_Log_Pos: 600 //#同步讀取二進位制日誌的位置,大於等於Exec_Master_Log_Pos
Relay_Log_File: ddte-relay-bin.000003
Relay_Log_Pos: 251
Relay_Master_Log_File: mysql-bin.000004
Slave_IO_Running: Yes //此狀態必須YES
Slave_SQL_Running: Yes //此狀態必須YES
......

在xserver1、xserver2上安裝mariadb資料庫,並配置為主從資料庫(xserver1為主節點、xserver2為從節點),實現兩個資料庫的主從同步。配置完畢後,請在xserver2上的資料庫中執行“show slave status \G”命令查詢從節點複製狀態,將查詢到的結果以文字形式提交到答題框。

參考答案

MariaDB [(none)]> start slave;
MariaDB [(none)]> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: mysql1
Master_User: user
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 245
Relay_Log_File: mariadb-relay-bin.000005
Relay_Log_Pos: 529
Relay_Master_Log_File: mysql-bin.000003
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 245
Relay_Log_Space: 1256
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 30
1 row in set (0.00 sec)

使用提供的“all-in-one”虛擬機器,進入資料庫。 (1)建立本地使用者examuser,密碼為000000; (2)查詢mysql資料庫中的user表的host,user,password欄位; (3)賦予這個使用者對所有資料庫擁有“查詢”“刪除”“更新”“建立”的本地許可權。依次將操作命令和返回結果以文字形式提交到答題框。

參考答案

[MariaDB [(none)]> insert into mysql.user(host,user,Password) values("localhost","examuser",Password("000000"));
Query OK, 1 row affected, 4 warnings (0.00 sec)
MariaDB [(none)]> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [mysql]> select host,user,password from user;
+-----------+----------+-------------------------------------------+
| host | user | password |
+-----------+----------+-------------------------------------------+
| localhost | root | *032197AE5731D4664921A6CCAC7CFCE6A0698693 |
| xiandian | root | *032197AE5731D4664921A6CCAC7CFCE6A0698693 |
| 127.0.0.1 | root | *032197AE5731D4664921A6CCAC7CFCE6A0698693 |
| ::1 | root | *032197AE5731D4664921A6CCAC7CFCE6A0698693 |
| localhost | keystone | *032197AE5731D4664921A6CCAC7CFCE6A0698693 |
| % | keystone | *032197AE5731D4664921A6CCAC7CFCE6A0698693 |
| localhost | glance | *032197AE5731D4664921A6CCAC7CFCE6A0698693 |
| % | glance | *032197AE5731D4664921A6CCAC7CFCE6A0698693 |
| localhost | nova | *032197AE5731D4664921A6CCAC7CFCE6A0698693 |
| % | nova | *032197AE5731D4664921A6CCAC7CFCE6A0698693 |
| localhost | neutron | *032197AE5731D4664921A6CCAC7CFCE6A0698693 |
| % | neutron | *032197AE5731D4664921A6CCAC7CFCE6A0698693 |
| localhost | cinder | *032197AE5731D4664921A6CCAC7CFCE6A0698693 |
| % | cinder | *032197AE5731D4664921A6CCAC7CFCE6A0698693 |
| localhost | heat | *032197AE5731D4664921A6CCAC7CFCE6A0698693 |
| % | heat | *032197AE5731D4664921A6CCAC7CFCE6A0698693 |
| localhost | aodh | *032197AE5731D4664921A6CCAC7CFCE6A0698693 |
| % | aodh | *032197AE5731D4664921A6CCAC7CFCE6A0698693 |
| localhost | examuser | *032197AE5731D4664921A6CCAC7CFCE6A0698693 |
+-----------+----------+-------------------------------------------+
19 rows in set (0.00 sec)
MariaDB [mysql]> grant select,delete,update,create on *.* to examuser@"localhost" identified by "000000";
Query OK, 0 rows affected (0.01 sec)

OpenStack管理

Keystone

使用提供的“all-in-one”虛擬機器,建立使用者testuser,密碼為xiandian,將testuser使用者分配給admin專案,賦予使用者admin的許可權。依次將操作命令和查詢結果以文字形式提交到答題框。

參考答案

[root@xiandian~]# source /etc/keystone/admin-openrc.sh
[root@xiandian~]# openstack user create --domain demo --password xiandian testuser
+-----------+----------------------------------+
| Field     | Value                           |
+-----------+----------------------------------+
| domain_id | 5a486c51bc8e4dffa4a181f6c54e0938 |
| enabled   | True                             |
| id       | ec6d67cdb3ac4b3ca827587c14be0a3e |
| name     | testuser                         |
+-----------+----------------------------------+
[root@xiandian ~]# openstack role add --project admin --user testuser admin

Glance

登入OpenStack的controller節點,使用crt的傳輸工具將提供的cirros-0.3.4-x86_64-disk.img映象上傳至“iaas-all”節點的/root目錄下;使用glance命令將映象上傳,並命名為mycirros,最後使用glance命令檢視該映象的詳細資訊。將上述所有操作命令和返回結果以文字形式提交到答題框。

參考答案:

[root@xiandian ~]# source /etc/keystone/admin-openrc.sh

[root@xiandian ~]# glance image-create --name mycirros --disk-format qcow2 --container-format bare --progress < cirros-0.3.4-x86_64-disk.img

[=============================>] 100%

+------------------+--------------------------------------+

| Property | Value |

+------------------+--------------------------------------+

| checksum | ee1eca47dc88f4879d8a229cc70a07c6 |

| container_format | bare |

| created_at | 2019-10-24T10:16:52Z |

| disk_format | qcow2 |

| id | d3663be2-3ebf-443a-b3fc-b3e39bda8783 |

| min_disk | 0 |

| min_ram | 0 |

| name | mycirros |

| owner | 0ab2dbde4f754b699e22461426cd0774 |

| protected | False |

| size | 13287936 |

| status | active |

| tags | [] |

| updated_at | 2019-10-24T10:16:52Z |

| virtual_size | None |

| visibility | private |

+------------------+--------------------------------------+

[root@xiandian ~]# glance image-show d3663be2-3ebf-443a-b3fc-b3e39bda8783

+------------------+--------------------------------------+

| Property | Value |

+------------------+--------------------------------------+

| checksum | ee1eca47dc88f4879d8a229cc70a07c6 |

| container_format | bare |

| created_at | 2019-10-24T10:16:52Z |

| disk_format | qcow2 |

| id | d3663be2-3ebf-443a-b3fc-b3e39bda8783 |

| min_disk | 0 |

| min_ram | 0 |

| name | mycirros |

| owner | 0ab2dbde4f754b699e22461426cd0774 |

| protected | False |

| size | 13287936 |

| status | active |

| tags | [] |

| updated_at | 2019-10-24T10:16:52Z |

| virtual_size | None |

| visibility | private |

+------------------+--------------------------------------+

使用VMWare軟體啟動提供的opensatckallinone映象,自行檢查openstack中各服務的狀態,若有問題自行排查。在xserver1節點的/root目錄下存在一個cirros-0.3.4-x86_64-disk.img映象;使用glance命令將映象上傳,並命名為mycirros,最後將glance image-show id命令的返回結果以文字形式提交到答題框。

參考答案

[root@xiandian ~]# glance image-show d3663be2-3ebf-443a-b3fc-b3e39bda8783
+------------------+--------------------------------------+
| Property | Value |
+------------------+--------------------------------------+
| checksum | ee1eca47dc88f4879d8a229cc70a07c6 |
| container_format | bare |
| created_at | 2019-10-24T10:16:52Z |
| disk_format | qcow2 |
| id | d3663be2-3ebf-443a-b3fc-b3e39bda8783 |
| min_disk | 0 |
| min_ram | 0 |
| name | mycirros |
| owner | 0ab2dbde4f754b699e22461426cd0774 |
| protected | False |
| size | 13287936 |
| status | active |
| tags | [] |
| updated_at | 2019-10-24T10:16:52Z |
| virtual_size | None |
| visibility | private |
+------------------+--------------------------------------+

Nova

使用提供的“all-in-one”虛擬機器,通過nova的相關命令建立名為exam,ID為1234,記憶體為1024M,硬碟為20G,虛擬核心數量為2的雲主機型別,檢視exam的詳細資訊。依次將操作命令及返回結果以文字形式提交到答題框。

參考答案

[root@xiandian ~]# nova flavor-create exam 1234 1024 20 2
+------+------+-----------+------+-----------+------+-------+-------------+-----------+
| ID | Name | Memory_MB | Disk | Ephemeral | Swap | VCPUs | RXTX_Factor | Is_Public |
+------+------+-----------+------+-----------+------+-------+-------------+-----------+
| 1234 | exam | 1024 | 20 | 0 | | 2 | 1.0 | True |
+------+------+-----------+------+-----------+------+-------+-------------+-----------+
[root@xiandian ~]# nova flavor-show 1234
+----------------------------+-------+
| Property | Value |
+----------------------------+-------+
| OS-FLV-DISABLED:disabled | False |
| OS-FLV-EXT-DATA:ephemeral | 0 |
| disk | 20 |
| extra_specs | {} |
| id | 1234 |
| name | exam |
| os-flavor-access:is_public | True |
| ram | 1024 |
| rxtx_factor | 1.0 |
| swap | |
| vcpus | 2 |
+----------------------------+-------+

Neutron

使用VMWare軟體啟動提供的opensatckallinone映象,自行檢查openstack中各服務的狀態,若有問題自行排查。在dashboard介面建立雲主機外部網路ext-net,子網為ext-subnet,雲主機浮動IP可用網段為192.168.200.100 ~ 192.168.200.200,閘道器為192.168.200.1。建立雲主機內部網路int-net1,子網為int-subnet1,雲主機子網IP可用網段為10.0.0.100 ~ 10.0.0.200,閘道器為10.0.0.1。新增名為ext-router的路由器,新增閘道器在ext-net網路,新增內部埠到int-net1網路,完成內部網路int-net1和外部網路的連通。將執行neutron router-show ext-router命令所返回的結果以文字形式提交到答題框。

參考答案

[root@controller ~]# neutron router-show 9d0e62e4-6340-4686-8d99-3fc715166302
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| admin_state_up | True |
| availability_zone_hints | |
| availability_zones | nova |
| description | |
| distributed | False |
| external_gateway_info | {"network_id": "49af02fe-8496-4337-9817-eee1a72feef0", "enable_snat": true, "external_fixed_ips": [{"subnet_id": "1e097cb7-9630-418d-bfd1-57e80354b39a", |
| | "ip_address": "192.168.200.3"}]} |
| ha | False |
| id | 9d0e62e4-6340-4686-8d99-3fc715166302 |
| name | ext-router |
| routes | |
| status | ACTIVE |
| tenant_id | 38e4fd41edaf40189d152dda18935b97 |
+-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+

Dashboard

使用VMWare建立兩臺CentOS7.2的作業系統,自行配置網路與IP,使用提供的軟體包,安裝OpenStack平臺。安裝完成後,使用curl命令查詢http://192.168.100.10/dashboard/auth/login/。將curl命令的查詢結果以文字形式提交到答題框。

參考答案

[root@controller ~]# curl http://192.168.100.10/dashboard/auth/login/
Login - XianDian Dashboard
雲端計算基礎架構服務平臺

Cinder

使用VMWare軟體啟動提供的opensatckallinone映象,自行檢查openstack中各服務的狀態,若有問題自行排查。使用Cinder服務,建立名為“ lvm”的卷型別,然後建立一塊帶“lvm” 標識的雲硬碟,名稱為 BlockVloume,大小為 2G,查詢該雲硬碟詳細資訊。完成後,將cinder show BlockVloume命令的返回結果以文字形式提交到答題框。

參考答案

[root@xiandian ~]# cinder show BlockVloume
+--------------------------------+--------------------------------------+
| Property | Value |
+--------------------------------+--------------------------------------+
| attachments | [] |
| availability_zone | nova |
| bootable | false |
| consistencygroup_id | None |
| created_at | 2018-01-18T05:04:06.000000 |
| description | None |
| encrypted | False |
| id | 9f685fd4-4f33-4f0c-b70e-467dab381c24 |
| metadata | {} |
| migration_status | None |
| multiattach | False |
| name | BlockVloume |
| os-vol-host-attr:host | xiandian@lvm#LVM |
| os-vol-mig-status-attr:migstat | None |
| os-vol-mig-status-attr:name_id | None |
| os-vol-tenant-attr:tenant_id | 0ab2dbde4f754b699e22461426cd0774 |
| replication_status | disabled |
| size | 2 |
| snapshot_id | None |
| source_volid | None |
| status | available |
| updated_at | 2018-01-18T05:04:10.000000 |
| user_id | 53a1cf0ad2924532aa4b7b0750dec282 |
| volume_type | lvm |
+--------------------------------+--------------------------------------+

Docker安裝管理

Registry

使用xserver1節點,自行配置YUM源,安裝docker服務(需要用到的包為xserver1節點/root目錄下的Docker.tar.gz)。安裝完服務後,將registry_latest.tar上傳到xserver1節點中並配置為私有倉庫。要求啟動registry容器時,將內部儲存檔案的目錄對映到外部的/opt/registry目錄,將內部的5000埠對映到外部5000埠。依次將啟動registry容器的命令及返回結果、執行docker info命令的返回結果以文字形式提交到答題框。

參考答案

[root@master ~]# docker run -d -v /opt/registry:/var/lib/registry -p 5000:5000 --restart=always --name registry registry:latest
[root@master ~]# docker info
Containers: 33
Running: 16
Paused: 0
Stopped: 17
Images: 22
Server Version: 18.09.6
Storage Driver: devicemapper
Pool Name: docker-253:0-113162281-pool
Pool Blocksize: 65.54kB
Base Device Size: 10.74GB
Backing Filesystem: xfs
Udev Sync Supported: true
Data file: /dev/loop0
Metadata file: /dev/loop1
Data loop file: /var/lib/docker/devicemapper/devicemapper/data
Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
Data Space Used: 3.573GB
Data Space Total: 107.4GB
Data Space Available: 18.72GB
Metadata Space Used: 22.59MB
Metadata Space Total: 2.147GB
Metadata Space Available: 2.125GB
Thin Pool Minimum Free Space: 10.74GB
Deferred Removal Enabled: true
Deferred Deletion Enabled: true
Deferred Deleted Device Count: 0
Library Version: 1.02.158-RHEL7 (2019-05-13)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: b34a5c8af56e510852c35414db4c1f4fa6172339
runc version: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-1062.7.1.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.913GiB
Name: master
ID: U4ME:YWV6:WZEK:7R7W:5OLN:MO4A:NVNH:AEPR:L7GE:UD4S:UZOY:GZXQ
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
192.168.70.10:5000
127.0.0.0/8
Live Restore Enabled: false
Product License: Community Engine
WARNING: the devicemapper storage-driver is deprecated, and will be removed in a future release.
WARNING: devicemapper: usage of loopback devices is strongly discouraged for production use.
Use `--storage-opt dm.thinpooldev` to specify a custom block storage device.

Images

假設當前存在docker映象mysql:latest,將該映象上傳至本地,然後將該映象推送至本地倉庫(假設倉庫地址為192.168.100.100:5000),從私有倉庫中拉取mariadb:v10.3.18映象。執行mysql映象,要求將內部3306埠對映到外部的13306埠,提供互動介面,後臺執行,容器名為xmysql。最後將mysql映象和建立的容器刪除。依次提交操作命令。

參考答案

# docker load -i < mysql:latest
# docker push 192.168.100.100:5000/mysql:latest
# docker pull mariadb:v10.3.18
# docker run –name xmysql -itd -p 13306:3306 mysql:latest /bin/bash
# docker rmi mysql:latest
# docker rm -f xmysql

使用xserver1節點,上傳nginx_latest.tar到xserver1節點中,然後將該映象打標籤,上傳至私有倉庫。使用xserver2節點,自行安裝docker服務,配置xserver2節點使用xserver1的私有倉庫,配置完畢後,在xserver2節點拉取nginx_latest.tar映象。最後將在xserver2上執行docker images命令返回的結果以文字形式提交到答題框。

參考答案

[root@master ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
192.168.100.11:5000/nginx latest 94f6bc30fd27 4 seconds ago 126MB

假設當前存在docker映象tomcat:latest,現在將tomcat映象匯出,匯出名稱為tomcat_images.tar,放在/media目錄下,將以上操作命令填入答題框。

參考答案

[root@server images]# docker save tomcat:latest > /media/tomcat_images.tar

部署Swarm

使用xserver1、xserver2節點,自行配置好網路,安裝好docker-ce。部署Swarm叢集,並安裝Portainer圖形化管理工具,部署完成後,使用瀏覽器登入ip:9000介面,進入Swarm控制檯。將curl swarm ip:9000返回的結果以文字形式提交到答題框。

參考答案

[root@master ~]# curl 192.168.100.10:9000
<!DOCTYPE html><html lang="en" ng-app="portainer">
<head>
<meta charset="utf-8">
<title>Portainer</title>
<meta name="description" content="">
<meta name="author" content="Portainer.io">
<div class="row" style="text-align: center">
Loading Portainer...
<i class="fa fa-cog fa-spin" style="margin-left: 5px"></i>
</div>
<!-- !panel -->
</div>

相關文章