ToB企服应用市场:ToB评测及商务社交产业平台

标题: 23年云盘算全国职业技能大赛-私有云 [打印本页]

作者: 乌市泽哥    时间: 2024-6-23 14:43
标题: 23年云盘算全国职业技能大赛-私有云
任务 1 私有云服务搭建[5 分]

1.1.1 底子情况配置[0.2 分]

   1.控制节点主机名为 controller,设置盘算节点主机名为 compute;
2.hosts 文件将 IP 地点映射为主机名。
使用提供的用户名暗码,登录提供的 OpenStack 私有云平台,在当前租户下,
使用 CentOS7.9镜像,创建两台云主机,云主机类型使用 4vCPU/12G/100G_50G
类型。当前租户下默认存在一张网卡,自行创建第二张网卡并连接至 controller
和 compute 节点(第二张网卡的网段为 10.10.X.0/24,X 为工位号,不需要创建
路由)。自行查抄安全组计谋,以确保网络正常通信与 ssh连接,然后按以下要
求配置服务器:
(1)设置控制节点主机名为 controller,设置盘算节点主机名为 compute;
(2)修改 hosts 文件将 IP 地点映射为主机名;
  1. [root@controller ~]# hostnamectl set-hostname controller
  2. [root@compute ~]# hostnamectl set-hostname compute
  3. [root@controller ~]# cat /etc/hosts
  4. 127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
  5. ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
  6. 192.168.100.10 controller
  7. 192.168.100.20 compute
  8. [root@controller ~]#
复制代码
1.查看控制节点名字为 controller,查看 hosts 文件中有正确的主机名和 IP 映射计 0.1 分
2.控制节点正确使用两块网卡计 0.1 分
1.1.2 Yum 源配置[0.2 分]

   使用提供的 http 服务地点,分别设置 controller 节点和 compute 节点的 yum
源文件 http.repo。
使用提供的 http 服务地点,在 http 服务下,存在 centos7.9 和 iaas 的网络
yum 源,使用该 http 源作为安装 iaas 平台的网络源。分别设置 controller 节点和
compute 节点的 yum 源文件 http.repo。
  1. [root@controller ~]# cat /etc/yum.repos.d/local.repo
  2. [centos]
  3. name=centos
  4. baseurl=file:///opt/centos  #比赛使用的是http远程yum源
  5. gpgcheck=0
  6. enabled=1
  7. [iaas]
  8. name=iaas
  9. baseurl=file:///opt/iaas/iaas-repo
  10. gpgcheck=0
  11. enabled=1
  12. [root@controller ~]#
复制代码
1.查看/etc/yum.repos.d/http.repo 文件,有正确的 baseurl 路径,计 0.2 分
1.1.3 配置无秘钥 ssh[0.2 分]

   配置 controller 节点可以无秘钥访问 compute 节点。
配置 controller节点可以无秘钥访问 compute节点,配置完成后,尝试 ssh连
接 compute 节点的 hostname 进行测试。
  1. [root@controller ~]# ssh compute
  2. Last login: Sun Sep 18 21:40:30 2023 from 192.168.100.1
  3. ################################
  4. #    Welcome  to  OpenStack    #
  5. ################################
  6. [root@compute ~]# ssh controller
  7. Last login: Sun Sep 18 21:39:59 2023 from 192.168.100.1
  8. ################################
  9. #    Welcome  to  OpenStack    #
  10. ################################
  11. [root@controller ~]#
复制代码
1.查看控制节点答应盘算节点无秘钥登录计 0.2 分
1.1.4 底子安装[0.2 分]

   在控制节点和盘算节点上分别安装 openstack-iaas 软件包。
在控制节点和盘算节点上分别安装 openstack-iaas 软件包,根据表 2 配置两个节点脚本文件中的根本变量(配置脚本文件为/etc/openstack/openrc.sh,即暗码默认000000)。
  1. [root@controller ~]# yum install -y openstack-iaas
  2. Loaded plugins: fastestmirror
  3. Determining fastest mirrors
  4. centos                                                                                           | 3.6 kB  00:00:00
  5. iaas                                                                                             | 2.9 kB  00:00:00
  6. Package openstack-iaas-2.0.1-2.noarch already installed and latest version
  7. Nothing to do
  8. [root@controller ~]# sed -i 's/^.//'g /etc/openstack/openrc.sh
  9. #去点第一行的注释符
  10. [root@controller ~]# sed -i 's/PASS=/PASS=000000/'g /etc/openstack/openrc.sh
  11. #替换PASS=为PASS=000000
  12. [root@controller ~]# cat /etc/openstack/openrc.sh
  13. #--------------------system Config--------------------##
  14. #Controller Server Manager IP. example:x.x.x.x
  15. HOST_IP=192.168.100.10
  16. #Controller HOST Password. example:000000
  17. HOST_PASS=000000
  18. #Controller Server hostname. example:controller
  19. HOST_NAME=controller
  20. #Compute Node Manager IP. example:x.x.x.x
  21. HOST_IP_NODE=192.168.100.20
  22. #Compute HOST Password. example:000000
  23. HOST_PASS_NODE=000000
  24. #Compute Node hostname. example:compute
  25. HOST_NAME_NODE=compute
  26. #--------------------Chrony Config-------------------##
  27. #Controller network segment IP.  example:x.x.0.0/16(x.x.x.0/24)
  28. network_segment_IP=192.168.100.0/24
  29. #--------------------Rabbit Config ------------------##
  30. #user for rabbit. example:openstack
  31. RABBIT_USER=openstack
  32. #Password for rabbit user .example:000000
  33. RABBIT_PASS=000000
  34. #--------------------MySQL Config---------------------##
  35. #Password for MySQL root user . exmaple:000000
  36. DB_PASS=000000
  37. #--------------------Keystone Config------------------##
  38. #Password for Keystore admin user. exmaple:000000
  39. DOMAIN_NAME=huhy
  40. ADMIN_PASS=Root@123
  41. DEMO_PASS=Root@123
  42. #Password for Mysql keystore user. exmaple:000000
  43. KEYSTONE_DBPASS=000000
  44. #--------------------Glance Config--------------------##
  45. #Password for Mysql glance user. exmaple:000000
  46. GLANCE_DBPASS=000000
  47. #Password for Keystore glance user. exmaple:000000
  48. GLANCE_PASS=000000
  49. #--------------------Placement Config----------------------##
  50. #Password for Mysql placement user. exmaple:000000
  51. PLACEMENT_DBPASS=000000
  52. #Password for Keystore placement user. exmaple:000000
  53. PLACEMENT_PASS=000000
  54. #--------------------Nova Config----------------------##
  55. #Password for Mysql nova user. exmaple:000000
  56. NOVA_DBPASS=000000
  57. #Password for Keystore nova user. exmaple:000000
  58. NOVA_PASS=000000
  59. #--------------------Neutron Config-------------------##
  60. #Password for Mysql neutron user. exmaple:000000
  61. NEUTRON_DBPASS=000000
  62. #Password for Keystore neutron user. exmaple:000000
  63. NEUTRON_PASS=000000
  64. #metadata secret for neutron. exmaple:000000
  65. METADATA_SECRET=000000
  66. #External Network Interface. example:eth1
  67. INTERFACE_NAME=ens37
  68. #External Network The Physical Adapter. example:provider
  69. Physical_NAME=provider
  70. #First Vlan ID in VLAN RANGE for VLAN Network. exmaple:101
  71. minvlan=1
  72. #Last Vlan ID in VLAN RANGE for VLAN Network. example:200
  73. maxvlan=1000
  74. #--------------------Cinder Config--------------------##
  75. #Password for Mysql cinder user. exmaple:000000
  76. CINDER_DBPASS=000000
  77. #Password for Keystore cinder user. exmaple:000000
  78. CINDER_PASS=000000
  79. #Cinder Block Disk. example:md126p3
  80. BLOCK_DISK=sdb1
  81. #--------------------Swift Config---------------------##
  82. #Password for Keystore swift user. exmaple:000000
  83. SWIFT_PASS=000000
  84. #The NODE Object Disk for Swift. example:md126p4.
  85. OBJECT_DISK=sdb2
  86. #The NODE IP for Swift Storage Network. example:x.x.x.x.
  87. STORAGE_LOCAL_NET_IP=192.168.100.20
  88. #--------------------Trove Config----------------------##
  89. #Password for Mysql trove user. exmaple:000000
  90. TROVE_DBPASS=000000
  91. #Password for Keystore trove user. exmaple:000000
  92. TROVE_PASS=000000
  93. #--------------------Heat Config----------------------##
  94. #Password for Mysql heat user. exmaple:000000
  95. HEAT_DBPASS=000000
  96. #Password for Keystore heat user. exmaple:000000
  97. HEAT_PASS=000000
  98. #--------------------Ceilometer Config----------------##
  99. #Password for Gnocchi ceilometer user. exmaple:000000
  100. CEILOMETER_DBPASS=000000
  101. #Password for Keystore ceilometer user. exmaple:000000
  102. CEILOMETER_PASS=000000
  103. #--------------------AODH Config----------------##
  104. #Password for Mysql AODH user. exmaple:000000
  105. AODH_DBPASS=000000
  106. #Password for Keystore AODH user. exmaple:000000
  107. AODH_PASS=000000
  108. #--------------------ZUN Config----------------##
  109. #Password for Mysql ZUN user. exmaple:000000
  110. ZUN_DBPASS=000000
  111. #Password for Keystore ZUN user. exmaple:000000
  112. ZUN_PASS=000000
  113. #Password for Keystore KURYR user. exmaple:000000
  114. KURYR_PASS=000000
  115. #--------------------OCTAVIA Config----------------##
  116. #Password for Mysql OCTAVIA user. exmaple:000000
  117. OCTAVIA_DBPASS=000000
  118. #Password for Keystore OCTAVIA user. exmaple:000000
  119. OCTAVIA_PASS=000000
  120. #--------------------Manila Config----------------##
  121. #Password for Mysql Manila user. exmaple:000000
  122. MANILA_DBPASS=000000
  123. #Password for Keystore Manila user. exmaple:000000
  124. MANILA_PASS=000000
  125. #The NODE Object Disk for Manila. example:md126p5.
  126. SHARE_DISK=sdb3
  127. #--------------------Cloudkitty Config----------------##
  128. #Password for Mysql Cloudkitty user. exmaple:000000
  129. CLOUDKITTY_DBPASS=000000
  130. #Password for Keystore Cloudkitty user. exmaple:000000
  131. CLOUDKITTY_PASS=000000
  132. #--------------------Barbican Config----------------##
  133. #Password for Mysql Barbican user. exmaple:000000
  134. BARBICAN_DBPASS=000000
  135. #Password for Keystore Barbican user. exmaple:000000
  136. BARBICAN_PASS=000000
  137. ###############################################################
  138. #####在vi编辑器中执行:%s/^.\{1\}//  删除每行前1个字符(#号)#####
  139. ###############################################################
  140. [root@controller ~]#
  141. [root@controller ~]# scp /etc/openstack/openrc.sh compute:/etc/openstack/
  142. #传输完毕后,设置磁盘分区,分出三块!!!对应的磁盘名称写入环境变量中
复制代码
1.查抄情况变量文件配置正确计 0.2 分
1.1.5 数据库安装与调优[0.5 分]

   在控制节点上使用安装 Mariadb、RabbitMQ 等服务。并进行干系操纵。在 controller 节点上使用 iaas-install-mysql.sh 脚本安装 Mariadb、Memcached、RabbitMQ 等服务。安装服务完毕后,修改/etc/my.cnf 文件,完成下列要求:
1.设置数据库支持巨细写;
2.设置数据库缓存 innodb 表的索引,数据,插入数据时的缓冲为 4G;
3.设置数据库的 log buffer 为 64MB;
4.设置数据库的 redo log 巨细为 256MB;
5.设置数据库的 redo log 文件组为 2。
6.修改 Memcached 的干系配置,将内存占用巨细设置为 512MB,调解最大
连接数参数为 2048;
7.调解 Memcached 的数据摘要算法(hash)为 md5;
  1. [root@controller ~]# iaas-pre-host.sh
  2. [root@compute ~]# iaas-pre-host.sh
  3. #执行完这一步,一定要重新连接,刷新一下,不然rabbitmq服务会报错
  4. [root@controller ~]# iaas-install-mysql.sh
  5. [root@controller ~]# cat /etc/my.cnf
  6. #
  7. # This group is read both both by the client and the server
  8. # use it for options that affect everything
  9. #
  10. [client-server]
  11. #
  12. # This group is read by the server
  13. #
  14. [mysqld]
  15. # Disabling symbolic-links is recommended to prevent assorted security risks
  16. symbolic-links=0
  17. default-storage-engine = innodb
  18. innodb_file_per_table
  19. collation-server = utf8_general_ci
  20. init-connect = 'SET NAMES utf8'
  21. character-set-server = utf8
  22. max_connections=10000
  23. innodb_log_buffer_size = 4M
  24. #此参数确定些日志文件所用的内存大小,以M为单位。缓冲区更大能提高性能,但意外的故障将会丢失数据。MySQL开发人员建议设置为1-8M之间
  25. innodb_log_file_size = 32M
  26. #此参数确定数据日志文件的大小,更大的设置可以提高性能,但也会增加恢复故障数据库所需的时间
  27. innodb_log_files_in_group = 3
  28. #为提高性能,MySQL可以以循环方式将日志文件写到多个文件。推荐设置为3
  29. #1,数据库不区分大小写,其中 0:区分大小写,1:不区分大小写
  30. lower_case_table_names =1
  31. #2,设置innodb的数据缓冲为4G
  32. innodb_buffer_pool_size = 4G
  33. #3,传输数据包的大小值
  34. max_allowed_packet = 30M
  35. #
  36. # include all files from the config directory
  37. #
  38. !includedir /etc/my.cnf.d
  39. [root@controller ~]#
复制代码
  1. [root@controller ~]# cat /etc/sysconfig/memcached
  2. PORT="11211"
  3. USER="memcached"
  4. MAXCONN="2048"
  5. CACHESIZE="512"
  6. OPTIONS="-l 127.0.0.1,::1,controller"
  7. hash_algorithm=md5
复制代码
1.查抄数据库和 memcached 配置正确计 0.5 分
1.1.6 Keystone 服务安装与使用[0.5 分]

   在控制节点上安装 Keystone 服务并创建用户。
在 controller 节点上使用 iaas-install-keystone.sh 脚本安装 Keystone 服务。然后创建OpenStack域210Demo,其中包罗Engineering与Production项目,
在域 210Demo 中创建组 Devops,其中需包罗以下用户:
1.Robert 用户是 Engineering 项目标用户(member)与管理员(admin),email 地点为:Robert@lab.example.com。
2.George 用户是 Engineering 项目标用户(member),email 地点为:George@lab.example.com。
3.William 用户是 Production 项目标用户(member)与管理员(admin),email 地点为:William@lab.example.com。
4.John 用户是 Production 项目标用户( member ) , email 地点为:John@lab.example.com。
  创建项目210Demo
  1. [root@controller ~]# source /etc/keystone/admin-openrc.sh
  2. [root@controller ~]# openstack domain create 210Demo
  3. +-------------+----------------------------------+
  4. | Field       | Value                            |
  5. +-------------+----------------------------------+
  6. | description |                                  |
  7. | enabled     | True                             |
  8. | id          | f962300124244efa9527a1b335522a4a |
  9. | name        | 210Demo                          |
  10. | options     | {}                               |
  11. | tags        | []                               |
  12. +-------------+----------------------------------+
  13. [root@controller ~]#
复制代码
创建Engineering和Production项目
  1. [root@controller ~]# openstack project create --domain 210Demo Engineering
  2. +-------------+----------------------------------+
  3. | Field       | Value                            |
  4. +-------------+----------------------------------+
  5. | description |                                  |
  6. | domain_id   | f962300124244efa9527a1b335522a4a |
  7. | enabled     | True                             |
  8. | id          | d2b59861f6df43998ea04558d4632b61 |
  9. | is_domain   | False                            |
  10. | name        | Engineering                      |
  11. | options     | {}                               |
  12. | parent_id   | f962300124244efa9527a1b335522a4a |
  13. | tags        | []                               |
  14. +-------------+----------------------------------+
  15. [root@controller ~]# openstack project create --domain 210Demo Production
  16. +-------------+----------------------------------+
  17. | Field       | Value                            |
  18. +-------------+----------------------------------+
  19. | description |                                  |
  20. | domain_id   | f962300124244efa9527a1b335522a4a |
  21. | enabled     | True                             |
  22. | id          | 1bf6d32e545b409197b89d7402ff7dec |
  23. | is_domain   | False                            |
  24. | name        | Production                       |
  25. | options     | {}                               |
  26. | parent_id   | f962300124244efa9527a1b335522a4a |
  27. | tags        | []                               |
  28. +-------------+----------------------------------+
  29. [root@controller ~]#
复制代码
创建组Devops
  1. [root@controller ~]# openstack group create --domain 210Demo Devops
  2. +-------------+----------------------------------+
  3. | Field       | Value                            |
  4. +-------------+----------------------------------+
  5. | description |                                  |
  6. | domain_id   | f962300124244efa9527a1b335522a4a |
  7. | id          | 01312098b02c4fb8bf1d8e8a82b0334e |
  8. | name        | Devops                           |
  9. +-------------+----------------------------------+
  10. [root@controller ~]#
复制代码
创建用户Robert并分配到组Devops,并将其添加到Engineering项目中的成员和管理员
  1. [root@controller ~]# openstack user create --domain 210Demo --password 000000 --email Robert@lab.example.com Robert
  2. +---------------------+----------------------------------+
  3. | Field               | Value                            |
  4. +---------------------+----------------------------------+
  5. | domain_id           | f962300124244efa9527a1b335522a4a |
  6. | email               | Robert@lab.example.com           |
  7. | enabled             | True                             |
  8. | id                  | 4045810cf03a4780acf2c714052e533c |
  9. | name                | Robert                           |
  10. | options             | {}                               |
  11. | password_expires_at | None                             |
  12. +---------------------+----------------------------------+
  13. [root@controller ~]# openstack group add user Devops Robert
  14. [root@controller ~]# openstack role add --project Engineering --user Robert member
  15. [root@controller ~]# openstack role add --project Engineering --user Robert admin
复制代码
创建用户George分配到组Devops,并将其添加到Engineering项目中的成员
  1. [root@controller ~]# openstack user create --domain 210Demo --password 000000 --email George@lab.example.com George
  2. +---------------------+----------------------------------+
  3. | Field               | Value                            |
  4. +---------------------+----------------------------------+
  5. | domain_id           | f962300124244efa9527a1b335522a4a |
  6. | email               | George@lab.example.com           |
  7. | enabled             | True                             |
  8. | id                  | 47b811b2ff374ac38547464413f532dc |
  9. | name                | George                           |
  10. | options             | {}                               |
  11. | password_expires_at | None                             |
  12. +---------------------+----------------------------------+
  13. [root@controller ~]# openstack group add user Devops George
  14. [root@controller ~]# openstack role add --project Engineering --user George member
  15. [root@controller ~]#
复制代码
创建用户William分配到组Devops,并将其添加到Production项目中的成员和管理员
  1. [root@controller ~]# openstack user create --domain 210Demo --password 000000 --email William@lab.example.com William
  2. +---------------------+----------------------------------+
  3. | Field               | Value                            |
  4. +---------------------+----------------------------------+
  5. | domain_id           | f962300124244efa9527a1b335522a4a |
  6. | email               | William@lab.example.com          |
  7. | enabled             | True                             |
  8. | id                  | 9b83aaaeef354609ba882728921ce757 |
  9. | name                | William                          |
  10. | options             | {}                               |
  11. | password_expires_at | None                             |
  12. +---------------------+----------------------------------+
  13. [root@controller ~]# openstack group add user Devops William
  14. [root@controller ~]# openstack role add --project Production --user William member
  15. [root@controller ~]# openstack role add --project Production --user William admin
  16. [root@controller ~]#
复制代码
创建用户John并分配到组Devops,并将John用户分配为Production项目标成员
  1. [root@controller ~]# openstack user create --domain 210Demo --password 000000 --email John@lab.example.com John
  2. +---------------------+----------------------------------+
  3. | Field               | Value                            |
  4. +---------------------+----------------------------------+
  5. | domain_id           | f962300124244efa9527a1b335522a4a |
  6. | email               | John@lab.example.com             |
  7. | enabled             | True                             |
  8. | id                  | 419aa40221cb49649572468c65a6ff59 |
  9. | name                | John                             |
  10. | options             | {}                               |
  11. | password_expires_at | None                             |
  12. +---------------------+----------------------------------+
  13. [root@controller ~]# openstack group add user Devops John
  14. [root@controller ~]# openstack role add --project Production --user John member
  15. [root@controller ~]#
复制代码
1.查抄平台中的 210Demo 域中是否有题目所需的用户与项目,正确计 0.5 分
1.1.7 Glance 安装与使用[0.5 分]

   在控制节点上安装 Glance 服务。上传镜像至平台,并设置镜像启动的要求参数。在 controller 节点上使用 iaas-install-glance.sh 脚本安装 glance 服务。然后使用提供的coreos_production_pxe.vmlinuz 镜像(该镜像为 Ironic Deploy 镜像,是一个 AWS 内核格式的镜像,在 OpenStack Ironic 裸金属服务时需要用到)上传到 OpenStack 平台中,命名为 deploy-vmlinuz。
  1. [root@controller ~]# openstack image create --disk-format aki --container-format aki --file coreos_production_pxe.vmlinuz deploy-vmlinuz
  2. +------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  3. | Field            | Value                                                                                                                                                                                      |
  4. +------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  5. | checksum         | 69ca72c134cac0def0e6a42b4f0fba67                                                                                                                                                           |
  6. | container_format | aki                                                                                                                                                                                        |
  7. | created_at       | 2023-10-08T03:18:25Z                                                                                                                                                                       |
  8. | disk_format      | aki                                                                                                                                                                                        |
  9. | file             | /v2/images/29e830bc-e7ac-4f65-94f5-7da4ade21949/file                                                                                                                                       |
  10. | id               | 29e830bc-e7ac-4f65-94f5-7da4ade21949                                                                                                                                                       |
  11. | min_disk         | 0                                                                                                                                                                                          |
  12. | min_ram          | 0                                                                                                                                                                                          |
  13. | name             | deploy-vmlinuz                                                                                                                                                                             |
  14. | owner            | 8bde12ff804e42498661b7454994c446                                                                                                                                                           |
  15. | properties       | os_hash_algo='sha512', os_hash_value='7241aeaf86a4f12dab2fccdc4b8ff592f16d13b37e8deda539c97798cdda47623002a4bddd0a89b5d17e6c7bc2eb9e81f4a031699175c11e73dc821030dfc7f4', os_hidden='False' |
  16. | protected        | False
  17.                                                                                         |
  18. | schema           | /v2/schemas/image
  19.                                                                                         |
  20. | size             | 43288240
  21.                                                                                         |
  22. | status           | active
  23.                                                                                         |
  24. | tags             |
  25.                                                                                         |
  26. | updated_at       | 2023-10-08T03:18:26Z
  27.                                                                                         |
  28. | virtual_size     | None
  29.                                                                                         |
  30. | visibility       | shared
  31.                                                                                         |
  32. +------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. [root@controller ~]#
复制代码
1.查抄 glance 服务安装正确计 0.1 分
2.查抄 deploy-vmlinuz 镜像内核格式正确计 0.4 分
1.1.8 Nova 安装与优化[0.5 分]

   在控制节点和盘算节点上分别安装 Nova 服务。安装完成后,完成 Nova 干系配置。在 controller 节点和 compute 节点上分别使用 iaas-install-placement.sh 脚本、iaas-install-nova -controller.sh 脚本、iaas-install-nova-compute.sh 脚本安装 Nova 服务。在 OpenStack 中,修改干系配置文件,修改调理器规则接纳缓存调理器,缓存主机信息,提拔调理时间。
  1. [root@controller ~]# vi /etc/nova/nova.conf
  2. driver=simple_scheduler
复制代码
1.查抄 nova 服务调理器配置正确计 0.5 分
1.1.9 Neutron 安装[0.2 分]

   在控制和盘算节点上正确安装 Neutron 服务。使用提供的脚本 iaas-install-neutron-controller.sh 和 iaas-install-neutroncompute.sh,在 controller 和 compute 节点上安装 neutron 服务。
  1. [root@controller ~]# iaas-install-neutron-controller.sh
  2. [root@compute~]# iaas-install-neutron-compute.sh
复制代码
1.查抄 neutron 服务安装正确计 0.1 分
2.查抄 neutron 服务的 linuxbridge 网桥服务启动正确计 0.1 分
1.1.10 Dashboard 安装[0.5 分]

   在控制节点上安装 Dashboard 服务。安装完成后,将 Dashboard 中的 Django数据修改为存储在文件中。在controller节点上使用iaas-install-dashboad.sh脚本安装Dashboard服务。安装完成后,修改干系配置文件,完成下列两个操纵:
1.使得登录 Dashboard 平台的时间不需要输入域名;
2.将 Dashboard 中的 Django 数据修改为存储在文件中。
  1. [root@controller ~]# iaas-install-dashboard.sh
  2. [root@controller ~]# vim /etc/openstack-dashboard/local_settings
  3. SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
  4. 改为
  5. SESSION_ENGINE = 'django.contrib.sessions.backends.file'
  6. OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True
  7. 改为
  8. OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = False
复制代码
1.查抄 Dashboard 服务中 Djingo 数据修改为存储在文件中配置正确计 0.2 分
2.查抄 Dashboard 服务中登陆平台不输入域名配置正确计 0.3 分
1.1.11 Swift 安装[0.5 分]

   在控制节点和盘算节点上分别安装 Swift 服务。安装完成后,将 cirros 镜像进行分片存储。在控制节点和盘算节点上分别使用 iaas-install-swift-controller.sh 和 iaasinstall-swift-compute.sh 脚本安装Swift 服务。安装完成后,使用下令创建一个名叫 examcontainer 的 容 器 , 将 cirros-0.3.4-x86_64-disk.img 镜像上传到examcontainer 容器中,并设置分段存放,每一段巨细为 10M。
  1. [root@controller ~]# iaas-install-swift-controller.sh
  2. [root@compute ~]# iaas-install-swift-compute.sh
  3. [root@controller ~]# ls
  4. anaconda-ks.cfg  cirros-0.3.4-x86_64-disk.img  logininfo.txt
  5. [root@controller ~]# swift post examcontainers
  6. [root@controller ~]# swift upload examcontaiers -S 10000000 cirros-0.3.4-x86_64-disk.img
  7. cirros-0.3.4-x86_64-disk.img segment 1
  8. cirros-0.3.4-x86_64-disk.img segment 0
  9. cirros-0.3.4-x86_64-disk.img
  10. [root@controller ~]# du -sh cirros-0.3.4-x86_64-disk.img
  11. 13M     cirros-0.3.4-x86_64-disk.img
  12. [root@controller ~]#
  13. #因为镜像就13M,所有存储为两段
复制代码
1.查抄 swift 服务安装正确计 0.3 分
2.分段上传 cirros 镜像正确计 0.2 分
1.1.12 Cinder 创建硬盘[0.5 分]

   在控制节点和盘算节点分别安装 Cinder 服务,请在盘算节点,对块存储进行扩容操纵。在控制节点和盘算节点分别使用 iaas-install-cinder-controller.sh、iaas-installcinder-compute.sh 脚本安装Cinder 服务,请在盘算节点,对块存储进行扩容操纵,即在盘算节点再分出一个 5G 的分区,加入到 cinder 块存储的后端存储中去。
  1. [root@controller ~]# iaas-install-cinder-controller.sh
  2. [root@compute ~]# iaas-install-cinder-compute.sh
  3. [root@compute ~]# lsblk
  4. NAME                                            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
  5. sda                                               8:0    0  200G  0 disk
  6. ├─sda1                                            8:1    0    1G  0 part /boot
  7. └─sda2                                            8:2    0   19G  0 part
  8.   ├─centos-root                                 253:0    0   17G  0 lvm  /
  9.   └─centos-swap                                 253:1    0    2G  0 lvm  [SWAP]
  10. sdb                                               8:16   0   50G  0 disk
  11. ├─sdb1                                            8:17   0   10G  0 part
  12. │ ├─cinder--volumes-cinder--volumes--pool_tmeta 253:2    0   12M  0 lvm
  13. │ │ └─cinder--volumes-cinder--volumes--pool     253:4    0  9.5G  0 lvm
  14. │ └─cinder--volumes-cinder--volumes--pool_tdata 253:3    0  9.5G  0 lvm
  15. │   └─cinder--volumes-cinder--volumes--pool     253:4    0  9.5G  0 lvm
  16. ├─sdb2                                            8:18   0   10G  0 part /swift/node/sdb2
  17. ├─sdb3                                            8:19   0   10G  0 part
  18. └─sdb4                                            8:20   0    5G  0 part
  19. sr0                                              11:0    1  4.4G  0 rom
  20. [root@compute ~]#
  21. [root@compute ~]# vgdisplay
  22.   --- Volume group ---
  23.   VG Name               cinder-volumes
  24.   System ID
  25.   Format                lvm2
  26.   Metadata Areas        1
  27.   Metadata Sequence No  4
  28.   VG Access             read/write
  29.   VG Status             resizable
  30.   MAX LV                0
  31.   Cur LV                1
  32.   Open LV               0
  33.   Max PV                0
  34.   Cur PV                1
  35.   Act PV                1
  36.   VG Size               <10.00 GiB
  37.   PE Size               4.00 MiB
  38.   Total PE              2559
  39.   Alloc PE / Size       2438 / 9.52 GiB
  40.   Free  PE / Size       121 / 484.00 MiB
  41.   VG UUID               3k0yKg-iQB2-b2CM-a0z2-2ddJ-cdG3-8WpyrG
  42.   --- Volume group ---
  43.   VG Name               centos
  44.   System ID
  45.   Format                lvm2
  46.   Metadata Areas        1
  47.   Metadata Sequence No  3
  48.   VG Access             read/write
  49.   VG Status             resizable
  50.   MAX LV                0
  51.   Cur LV                2
  52.   Open LV               2
  53.   Max PV                0
  54.   Cur PV                1
  55.   Act PV                1
  56.   VG Size               <19.00 GiB
  57.   PE Size               4.00 MiB
  58.   Total PE              4863
  59.   Alloc PE / Size       4863 / <19.00 GiB
  60.   Free  PE / Size       0 / 0
  61.   VG UUID               acAXNK-eqKm-qs9b-ly3T-R3Sh-8qyv-nELNWv
  62.   [root@compute ~]# vgextend cinder-volumes /dev/sdb4
  63.   Volume group "cinder-volumes" successfully extended
  64. [root@compute ~]# vgdisplay
  65.   --- Volume group ---
  66.   VG Name               cinder-volumes
  67.   System ID
  68.   Format                lvm2
  69.   Metadata Areas        2
  70.   Metadata Sequence No  5
  71.   VG Access             read/write
  72.   VG Status             resizable
  73.   MAX LV                0
  74.   Cur LV                1
  75.   Open LV               0
  76.   Max PV                0
  77.   Cur PV                2
  78.   Act PV                2
  79.   VG Size               14.99 GiB
  80.   PE Size               4.00 MiB
  81.   Total PE              3838
  82.   Alloc PE / Size       2438 / 9.52 GiB
  83.   Free  PE / Size       1400 / <5.47 GiB
  84.   VG UUID               3k0yKg-iQB2-b2CM-a0z2-2ddJ-cdG3-8WpyrG
  85.   --- Volume group ---
  86.   VG Name               centos
  87.   System ID
  88.   Format                lvm2
  89.   Metadata Areas        1
  90.   Metadata Sequence No  3
  91.   VG Access             read/write
  92.   VG Status             resizable
  93.   MAX LV                0
  94.   Cur LV                2
  95.   Open LV               2
  96.   Max PV                0
  97.   Cur PV                1
  98.   Act PV                1
  99.   VG Size               <19.00 GiB
  100.   PE Size               4.00 MiB
  101.   Total PE              4863
  102.   Alloc PE / Size       4863 / <19.00 GiB
  103.   Free  PE / Size       0 / 0
  104.   VG UUID               acAXNK-eqKm-qs9b-ly3T-R3Sh-8qyv-nELNWv
  105. [root@compute ~]#
复制代码
1.查抄 cinder 后端存储扩容成功计 0.5 分
1.1.13 配置主机禁 ping [0.5 分]

   修改 controller 节点的干系配置文件,配置 controller 节点克制其他节点可以ping 它。
  1. vi /etc/sysctl.conf
  2. # 0表示: 允许, 1: 表示不允许
  3. net.ipv4.icmp_echo_ignore_all = 1
  4. sysctl -p
复制代码
1.查抄系统配置文件正确计 0.5 分
任务 2 私有云服务运维[15 分]

1.2.1 Heat 编排-创建用户[1 分]

   编写 Heat 模板 create_user.yaml,创建名为 heat-user 的用户。使 用 自 己 搭 建 的 OpenStack 私 有 云 平 台 , 使 用 heat 编写摸板(heat_template_version: 2016-04-08)创建名为”chinaskills”的 domain,在此 domain下创建名为 beijing_group 的租户,在此租户下创建名为 cloud 的用户,将此文件命名及生存在/root/user_create.yml。(竞赛系统会实验 yaml 文件,请确保实验的情况)
  1. [root@controller ~]# cat create_user.yaml
  2. heat_template_version: 2016-04-08
  3. resources:
  4.   user:
  5.     type: OS::Keystone::User
  6.     properties:
  7.       name: heat-user
  8.       password: "123456"
  9.       domain: default
  10.       default_project: admin
  11.       roles: [{"role": admin, "project": admin}]
  12. [root@controller ~]# openstack stack create -t create_user.yaml test-user
  13. +---------------------+--------------------------------------+
  14. | Field               | Value                                |
  15. +---------------------+--------------------------------------+
  16. | id                  | e0249dae-19d3-48fd-b3a8-fa57af083765 |
  17. | stack_name          | test-user                            |
  18. | description         | No description                       |
  19. | creation_time       | 2023-10-05T09:06:44Z                 |
  20. | updated_time        | None                                 |
  21. | stack_status        | CREATE_IN_PROGRESS                   |
  22. | stack_status_reason | Stack CREATE started                 |
  23. +---------------------+--------------------------------------+
  24. [root@controller ~]# openstack user list
  25. +----------------------------------+-------------------+
  26. | ID                               | Name              |
  27. +----------------------------------+-------------------+
  28. | 39e9cdd82c474808940e31ade25c2598 | admin             |
  29. | 86b5d5d442134ff9a0c61f297949fb2a | demo              |
  30. | be0000a08553469da89c9eec73adc6ae | glance            |
  31. | 6fbfc10d83cd42e7b1e2fa2437222898 | placement         |
  32. | 2f8a154305444599a35743b5f6915a6a | nova              |
  33. | 5f355d0887694a4e8108b77fb2ba978c | neutron           |
  34. | af2a87d4b9f74091a0e59d73a12c1ea0 | heat              |
  35. | 199d3d04353544769bf080c49103b6aa | heat_domain_admin |
  36. | 8f8937fa4cac4026b2be760fa184ffec | heat-user         |
  37. +----------------------------------+-------------------+
  38. [root@controller ~]#
复制代码
  1. [root@controller ~]# cat user_create.yml
  2. heat_template_version: 2016-04-08
  3. resources:
  4.   chinaskills:
  5.     type: OS::Keystone::Domain
  6.     properties:
  7.       name: chinaskills
  8.   beijing_group:
  9.     type: OS::Keystone::Project
  10.     properties:
  11.       name: beijing_group
  12.       domain: { get_resource: chinaskills }
  13.   cloud_user:
  14.     type: OS::Keystone::User
  15.     properties:
  16.       name: cloud
  17.       domain: { get_resource: chinaskills }
  18.       password: 000000
  19.       default_project: { get_resource: beijing_group }
  20.       
  21. [root@controller ~]# openstack stack create -t user_create.yml test
  22. +---------------------+--------------------------------------+
  23. | Field               | Value                                |
  24. +---------------------+--------------------------------------+
  25. | id                  | 0ac5aaef-73e7-462d-84a9-b9ae05acbbc8 |
  26. | stack_name          | test                                 |
  27. | description         | No description                       |
  28. | creation_time       | 2023-10-05T09:51:44Z                 |
  29. | updated_time        | None                                 |
  30. | stack_status        | CREATE_IN_PROGRESS                   |
  31. | stack_status_reason | Stack CREATE started                 |
  32. +---------------------+--------------------------------------+
  33. [root@controller ~]# openstack domain list
  34. +----------------------------------+-------------+---------+--------------------------+
  35. | ID                               | Name        | Enabled | Description              |
  36. +----------------------------------+-------------+---------+--------------------------+
  37. | 2141d34db6ab4ae09ab21ba9c9ed3f0f | heat        | True    | Stack projects and users |
  38. | d1a0c1fb7520410ba583e9c8b6afc133 | chinaskills | True    |                          |
  39. | default                          | Default     | True    | The default domain       |
  40. +----------------------------------+-------------+---------+--------------------------+
  41. [root@controller ~]#
  42. [root@controller ~]# openstack project show beijing_group
  43. +-------------+----------------------------------+
  44. | Field       | Value                            |
  45. +-------------+----------------------------------+
  46. | description |                                  |
  47. | domain_id   | d1a0c1fb7520410ba583e9c8b6afc133 |
  48. | enabled     | True                             |
  49. | id          | 4dd4e129959d4eeb879367b549a666d9 |
  50. | is_domain   | False                            |
  51. | name        | beijing_group                    |
  52. | options     | {}                               |
  53. | parent_id   | d1a0c1fb7520410ba583e9c8b6afc133 |
  54. | tags        | []                               |
  55. +-------------+----------------------------------+
  56. [root@controller ~]# openstack user show cloud
  57. +---------------------+----------------------------------+
  58. | Field               | Value                            |
  59. +---------------------+----------------------------------+
  60. | description         |                                  |
  61. | domain_id           | d1a0c1fb7520410ba583e9c8b6afc133 |
  62. | enabled             | True                             |
  63. | id                  | aa57e11217924cac9d9a18ffa139fe41 |
  64. | name                | cloud                            |
  65. | options             | {}                               |
  66. | password_expires_at | None                             |
  67. +---------------------+----------------------------------+
  68. [root@controller ~]#
复制代码
1.实验 heat 模板成功创建出域和租户以及用户正确计 1 分
1.2.2 KVM 优化[1 分]

   在 OpenStack 平台上修改干系配置文件,启用-device virtio-net-pci in kvm。在自行搭建的 OpenStack 私有云平台或赛项提供的 all-in-one 平台上,修改干系配置文件,启用-device virtio-net-pci in kvm。
  1. #修改/etc/nova/nova.conf文件添加以下参数
  2. --libvirt_use_virtio_for_bridges=true
复制代码
1.查抄 nova 服务 KVM 配置正确计 1 分
1.2.3 NFS 对接 Glance 后端存储[1 分]

   使用 OpenStack 私有云平台,创建一台云主机,安装 NFS 服务,然后对接Glance 后端存储。使用赛项提供的 OpenStack 私有云平台,创建一台云主机(镜像使用CentOS7.9,flavor 使用带暂时磁盘 50G 的),配置该主机为 nfs 的 server 端,将该云主机中的 50G 磁盘通过/mnt/test 目录进行共(目录不存在可自行创建)。然后配置 controller 节点为 nfs 的 client 端,要求将/mnt/test 目录作为glance 后端存储的挂载目录。
  1. [root@nfs-server ~]# mkdir /mnt/test
  2. [root@nfs-server ~]# vi /etc/exports
  3. /mnt/test 10.24.200.0/24(rw,no_root_squash,no_all_squash,sync,anonuid=501,anongid=501)
  4. [root@nfs-server ~]# exportfs -r
复制代码
  1. [root@controller ~]# mount -t nfs 10.24.193.142:/mnt/test /var/lib/glance/images/
  2. [root@controller ~]# df -h
  3. Filesystem               Size  Used Avail Use% Mounted on
  4. /dev/vda1                 50G  2.7G   48G   6% /
  5. devtmpfs                 5.8G     0  5.8G   0% /dev
  6. tmpfs                    5.8G  4.0K  5.8G   1% /dev/shm
  7. tmpfs                    5.8G   49M  5.8G   1% /run
  8. tmpfs                    5.8G     0  5.8G   0% /sys/fs/cgroup
  9. /dev/loop0               9.4G   33M  9.4G   1% /swift/node/vda5
  10. tmpfs                    1.2G     0  1.2G   0% /run/user/0
  11. 10.24.193.142:/mnt/test   20G  865M   20G   5% /var/lib/glance/images
  12. [root@controller ~]# cd /var/lib/glance/
  13. [root@controller glance]# chown glance:glance images/
复制代码
1.查抄挂载共享目录正确计 0.5 分
2.查抄共享目录用户合组正确计 0.5 分
1.2.4 Redis 主从[1 分]

   使用赛项提供的 OpenStack 私有云平台,创建两台云主机,配置为 redis 的主从架构。使用赛项提供的 OpenStack 私有云平台,申请两台 CentOS7.9 系统的云主机,使用提供的 http 源,在两个节点安装 redis 服务并启动,配置 redis 的访问需要暗码,暗码设置为 123456。然后将这两个 redis 节点配置为 redis 的主从架构。
  1. 参考前年国赛
复制代码
1.查抄 redis 主从集群部署正确计 1 分
1.2.5 Linux 系统调优-脏数据回写[1 分]

   修改系统配置文件,要求将回写磁盘的时间暂时调解为 60 秒。Linux 系统内存中会存在脏数据,一样平常系统默认脏数据 30 秒后会回写磁盘,修改系统配置文件,要求将回写磁盘的时间暂时调解为 60秒。完成后提交 controller 节点的用户名、暗码和 IP 地点到答题框。
  1. [root@controller ~]# vi /etc/sysctl.conf
  2. #添加写入
  3. vm.dirty_expire_centisecs=6000
  4. [root@controller ~]# sysctl –p
  5. vm.dirty_expire_centisecs = 6000
复制代码
1.2.6 Glance 调优[1 分]

   在 OpenStack 平台中,修改干系配置文件,将子进程数目相应的配置修改成2。在 OpenStack 平台中,glance-api 处理哀求的子进程数目默认是 0,只有一个主进程,请修改干系配置文件,将子进程数目相应的配置修改成 2,如许的话有一个主进程加 2 个子进程来并发处理哀求。
  1. [root@controller ~]# vi /etc/glance/glance-api.conf
  2. #workers = <None>
  3. 改为
  4. workers = 2
  5. [root@controller ~]# systemctl restart openstack-glance-*
复制代码
1.查抄 glance 服务进程配置正确计 1 分
1.2.7 Ceph 部署[1 分]

   使用提供的 ceph.tar.gz 软件包,安装 ceph 服务并完成初始化操纵。使用提供的 ceph-14.2.22.tar.gz 软件包,在 OpenStack 平台上创建三台CentOS7.9 系统的云主机,使用这三个节点安装 ceph 服务并完成初始化操纵,第一个节点为 mon/osd 节点,第二、三个节点为 osd 节点,部署完 ceph 后,创建 vms、images、volumes 三个 pool。
底子情况配置
  IP主机名10.0.0.10storage0110.0.0.11storage0210.0.0.12storage03 关闭防火墙与selinux

  1. sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config; setenforce 0; systemctl stop firewalld; systemctl disable firewalld
复制代码
配置离线源

  1. tar xvf ceph.tar.gz -C /opt/
  2. mkdir /etc/yum.repos.d/bak
  3. mv /etc/yum.repos.d/CentOS-* /etc/yum.repos.d/bak/
  4. cat >> /etc/yum.repos.d/local.repo << EOF
  5. [ceph]
  6. name=ceph
  7. baseurl=file:///opt/ceph/
  8. gpgcheck=0
  9. EOF
  10. yum clean all; yum makecache
  11. yum install -y vsftpd
  12. echo "anon_root=/opt" >> /etc/vsftpd/vsftpd.conf
  13. systemctl enable --now vsftpd
复制代码

  1. mkdir /etc/yum.repos.d/bak
  2. mv /etc/yum.repos.d/CentOS-* /etc/yum.repos.d/bak/
  3. cat >> /etc/yum.repos.d/local.repo << EOF
  4. [ceph]
  5. name=ceph
  6. baseurl=ftp://10.0.0.10/ceph/
  7. gpgcheck=0
  8. EOF
  9. yum clean all; yum makecache
复制代码
配置hosts解析

  1. hostnamectl set-hostname storage01/02/03
  2. cat >> /etc/hosts << EOF
  3. 10.0.0.10 storage01
  4. 10.0.0.11 storage02
  5. 10.0.0.12 storage03
  6. EOF
复制代码
配置免密

  1. ssh-copy-id -i  /root/.ssh/id_rsa.pub root@storage01
  2. ssh-copy-id -i  /root/.ssh/id_rsa.pub root@storage02
  3. ssh-copy-id -i  /root/.ssh/id_rsa.pub root@storage03
复制代码
安装部署ceph集群
安装服务

  1. yum install -y ceph-deploy
复制代码
2配置集群

  1. mkdir ceph-cluster
  2. cd ceph-cluster
  3. #包差依赖,需要导入阿里云rpel源
  4. wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
  5. yum install python2-pip.noarch -y
  6. ceph-deploy new --cluster-network 10.0.0.0/24 --public-network 10.0.0.0/24 storage01
复制代码

  1. yum install -y ceph ceph-radosgw
复制代码

  1. ceph-deploy install --no-adjust-repos storage01 storage02 storage03
复制代码

  1. # 不用配置主机,会根据配置文件完成
  2. ceph-deploy mon create-initial
  3. # 把配置文件和admin密钥拷贝Ceph集群各节点,以免得每次执行"ceph"命令时不得不明确指定MON节点地址和ceph.client.admin.keyring
  4. ceph-deploy admin storage01 storage02 storage03
复制代码

  1. ceph-deploy mgr create storage02
复制代码

  1. yum install ceph-common -y
复制代码
添加osd

  1. ceph-deploy disk list storage01 storage02 storage03
复制代码

  1. ceph-deploy disk zap storage01 /dev/sdb
  2. ceph-deploy disk zap storage02 /dev/sdb
  3. ceph-deploy disk zap storage03 /dev/sdb
复制代码

  1. ceph-deploy osd create storage01 --data /dev/sdb
  2. ceph-deploy osd create storage02 --data /dev/sdb
  3. ceph-deploy osd create storage03 --data /dev/sdb
复制代码
扩展监视器节点

  1. ceph-deploy mon add storage02
  2. ceph-deploy mon add storage03
复制代码
扩展管理器节点

  1. ceph-deploy mgr create storage01
复制代码
禁用不安全模式

  1. ceph config set mon auth_allow_insecure_global_id_reclaim false
复制代码
1.查抄 ceph 集群状态为 OK 正确计 0.5 分
2.查抄 ceph 集群的 osd 正确计 0.5 分
1.2.8 Glance 对接 Ceph 存储[1 分]

   修改 OpenStack 平台中 Glance 服务的配置文件,将 Glance 后端存储改为Ceph 存储。在自己搭建的 OpenStack 平台中修改 glance 服务的干系配置文件,将glance 后端存储改为 ceph 存储。也就是所以的镜像会上传至 ceph 的 images pool中。通过下令使用 cirros-0.3.4-x86_64-disk.img 镜像文件上传至云平台中,镜像命名为 cirros。
  1.2.9 Cinder 对接 Ceph 存储[1 分]

   修改 OpenStack 平台中 cinder服务的配置文件,将 cinder后端存储改为 Ceph存储。修改 OpenStack 平台中 cinder 服务的干系配置文件,将 cinder 后端存储改为 ceph 存储。使创建的 cinder 块存储卷在 ceph 的 volumes pool 中。配置完成后,在 OpenStack 平台中使用创建卷 cinder-volume1,巨细为 1G。
  1.查抄 cinder 服务存储配置正确计 1 分
1.2.10 Nova 对接 Ceph 存储[1 分]

   修改 OpenStack 平台中 Nova 服务的配置文件,将 Nova 后端存储改为 Ceph存储。修改 OpenStack 平台中 nova 服务的干系配置文件,将 nova 后端存储改为ceph 存储。使 nova 所创建的假造机都存储在 ceph 的 vms pool 中。配置完成后在 OpenStack 平台中使用下令创建云主机 server1。
  1.查抄 nova 服务存储配置正确计 0.5 分
2.查抄云主机在 vms pool 中正确计 0.5 分
openstack T版对接ceph 14版本做glance、nova、cinder后端存储
节点IPcontroller192.168.200.10compute192.168.200.20storage01192.168.200.30storage2192.168.200.31storage3192.168.200.32 创建cinder、glance、nova存储池
  1. [root@storage01 ceph-cluster]# ceph osd pool create volumes 8
  2. pool 'volumes' created
  3. [root@storage01 ceph-cluster]# ceph osd pool create images 8
  4. pool 'images' created
  5. [root@storage01 ceph-cluster]# ceph osd pool create vms 8
  6. pool 'vms' created
  7. [root@storage01 ceph-cluster]# ceph osd lspools
  8. 4 volumes
  9. 5 images
  10. 6 vms
复制代码
创建用户以及密钥
  1. [root@storage01 ceph-cluster]# ceph auth get-or-create client.cinder mon "allow r" osd "allow class-read object_prefix rbd_children,allow rwx pool=volumes,allow rwx pool=vms,allow rx pool=images"
  2. [client.cinder]
  3.         key = AQDRE3tkDVGeFxAAPkGPKGlqh74pRl2dzIJXAw==
  4. [root@storage01 ceph-cluster]# ceph auth get-or-create client.glance mon "allow r" osd "allow class-read object_prefix rbd_children,allow rwx pool=images"
  5. [client.glance]
  6.         key = AQDaE3tkKTQCIRAAwRQ/VeIjL4G5GjmsJIbTwg==
  7. [root@storage01 ceph-cluster]#
复制代码
openstack节点创建ceph目录,T版默认创建了
  1. [root@controller ~]# mkdir /etc/ceph/
复制代码
  1. [root@compute ~]# mkdir /etc/ceph/
复制代码
ceph导出密钥glance和cinder,并导入到opesntack
  1. [root@storage01 ceph-cluster]# ceph auth get client.glance -o ceph.client.glance.keyring
  2. exported keyring for client.glance
  3. [root@storage01 ceph-cluster]# ceph auth get client.cinder -o ceph.client.cinder.keyring
  4. exported keyring for client.cinder
  5. [root@storage01 ceph-cluster]#
复制代码
  1. [root@storage01 ceph-cluster]# scp ceph.client.glance.keyring root@192.168.200.10:/etc/ceph/
复制代码
  1. [root@storage01 ceph-cluster]# scp ceph.client.glance.keyring root@192.168.200.20:/etc/ceph/
复制代码
  1. [root@storage01 ceph-cluster]# scp ceph.client.cinder.keyring root@192.168.200.10:/etc/ceph/
复制代码
  1. [root@storage01 ceph-cluster]# scp ceph.client.cinder.keyring root@192.168.200.20:/etc/ceph/
复制代码
拷贝认证文件到集群
  1. [root@storage01 ceph-cluster]# scp ceph.conf root@192.168.200.20:/etc/ceph/
复制代码
  1. [root@storage01 ceph-cluster]# scp ceph.conf root@192.168.200.10:/etc/ceph/
复制代码
盘算节点添加libvirt密钥
  1. [root@compute ~]# cd /etc/ceph/
  2. [root@compute ceph]# UUID=$(uuidgen)
复制代码
  1. cat >> secret.xml << EOF
  2. <secret ephemeral='no' private='no'>
  3.   <uuid>$UUID</uuid>
  4.   <usage type='ceph'>
  5.     <name>client.cinder secret</name>
  6.   </usage>
  7. </secret>
  8. EOF
复制代码
  1. [root@compute ceph]# virsh secret-define --file secret.xml
  2. Secret 8ea0cbae-86a9-4c1c-9f03-fd4b144b8839 created
复制代码
  1. [root@compute ceph]# cat ceph.client.cinder.keyring
  2. [client.cinder]
  3.         key = AQDRE3tkDVGeFxAAPkGPKGlqh74pRl2dzIJXAw==
  4.         caps mon = "allow r"
  5.         caps osd = "allow class-read object_prefix rbd_children,allow rwx pool=volumes,allow rwx pool=vms,allow rx pool=images"
  6. [root@compute ceph]# virsh secret-set-value --secret ${UUID} --base64 $(cat ceph.client.cinder.keyring | grep key | awk -F ' ' '{print $3}')
  7. Secret value set
  8. [root@compute ceph]# virsh secret-list
  9. UUID                                  Usage
  10. --------------------------------------------------------------------------------
  11. 8ea0cbae-86a9-4c1c-9f03-fd4b144b8839  ceph client.cinder secret
  12. [root@compute ceph]#
复制代码
安装客户端工具
  1. [root@controller ~]# yum install -y ceph-common
复制代码
  1. [root@compute ~]# yum install -y ceph-common
复制代码
对接glance后端存储
更改配置文件属性
  1. [root@controller ~]# chown glance.glance /etc/ceph/ceph.client.glance.keyring
复制代码
  1. [root@controller ~]# vi /etc/glance/glance-api.conf
复制代码
  1. [glance_store]
  2. #stores = file,http
  3. #default_store = file
  4. #filesystem_store_datadir = /var/lib/glance/images/
  5. stores = rbd,file,http
  6. default_store = rbd
  7. rbd_store_pool = images
  8. rbd_store_user = glance
  9. rbd_store_ceph_conf = /etc/ceph/ceph.conf
  10. rbd_store_chunk_size = 8
复制代码
重启服务
  1. [root@controller ~]# systemctl restart openstack-glance*
复制代码
测试
  1. [root@controller ~]# openstack image create --disk-format qcow2 cirros-ceph --file /opt/iaas/images/cirros-0.3.4-x86_64-disk.img
  2. +------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  3. | Field            | Value                                                                                                                                                                                      |
  4. +------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  5. | checksum         | ee1eca47dc88f4879d8a229cc70a07c6                                                                                                                                                           |
  6. | container_format | bare                                                                                                                                                                                       |
  7. | created_at       | 2023-06-03T14:36:37Z                                                                                                                                                                       |
  8. | disk_format      | qcow2                                                                                                                                                                                      |
  9. | file             | /v2/images/c015136d-f3e0-4150-abd2-f7fd3fd6dbd7/file                                                                                                                                       |
  10. | id               | c015136d-f3e0-4150-abd2-f7fd3fd6dbd7                                                                                                                                                       |
  11. | min_disk         | 0                                                                                                                                                                                          |
  12. | min_ram          | 0                                                                                                                                                                                          |
  13. | name             | cirros-ceph                                                                                                                                                                                |
  14. | owner            | fb7a2a10b81f43fcbf4ccef895c56937
  15.                                                                                         |
  16. | properties       | os_hash_algo='sha512', os_hash_value='1b03ca1bc3fafe448b90583c12f367949f8b0e665685979d95b004e48574b953316799e23240f4f739d1b5eb4c4ca24d38fdc6f4f9d8247a2bc64db25d6bbdb2', os_hidden='False' |
  17. | protected        | False
  18.                                                                                         |
  19. | schema           | /v2/schemas/image
  20.                                                                                         |
  21. | size             | 13287936
  22.                                                                                         |
  23. | status           | active
  24.                                                                                         |
  25. | tags             |
  26.                                                                                         |
  27. | updated_at       | 2023-06-03T14:36:42Z
  28.                                                                                         |
  29. | virtual_size     | None
  30.                                                                                         |
  31. | visibility       | shared
  32.                                                                                         |
  33. +------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. [root@controller ~]#
复制代码
ceph节点查看
  1. [root@storage01 ceph]# rbd ls images
  2. c015136d-f3e0-4150-abd2-f7fd3fd6dbd7
复制代码
与openstack创建镜像id对应一致
对接nova后端存储
修改盘算节点配置文件
  1. [root@compute ceph]# vi /etc/nova/nova.conf
复制代码
  1. [DEFAULT]
  2. .....
  3. live_migration_flag = "VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE"
  4. [libvirt]
  5. images_type = rbd
  6. images_rbd_pool = vms
  7. images_rbd_ceph_conf = /etc/ceph/ceph.conf
  8. rbd_user = cinder
  9. rbd_secret_uuid = 8ea0cbae-86a9-4c1c-9f03-fd4b144b8839
复制代码
重启服务
  1. [root@compute ceph]# systemctl restart openstack-nova-compute.service
复制代码
测试
  1. [root@controller ~]# openstack server list
  2. +--------------------------------------+------+--------+--------------------+-------------+---------+
  3. | ID                                   | Name | Status | Networks           | Image       | Flavor  |
  4. +--------------------------------------+------+--------+--------------------+-------------+---------+
  5. | d999b371-9e98-4cdb-98b8-407e900c631c | test | ACTIVE | int-net=10.0.0.206 | cirros-ceph | m1.tiny |
  6. +--------------------------------------+------+--------+--------------------+-------------+---------+
复制代码
  1. [root@storage01 ceph]# rbd ls vms
  2. d999b371-9e98-4cdb-98b8-407e900c631c_disk
复制代码
对接cinder后端存储
修改文件属性,集群节点
  1. [root@controller ~]# chown cinder.cinder /etc/ceph/ceph.client.cinder.keyring
复制代码
  1. [root@compute ~]# chown cinder.cinder /etc/ceph/ceph.client.cinder.keyring
复制代码
修改配置文件,控制节点
  1. [root@controller ~]# vi /etc/cinder/cinder.conf
复制代码
  1. [DEFAULT]
  2. .....
  3. default_volume_type = ceph
复制代码
重启服务
  1. [root@controller ~]# systemctl restart *cinder*
复制代码
修改文件,盘算节点
  1. [root@compute ceph]# vi /etc/cinder/cinder.conf
复制代码
  1. [DEFAULT]
  2. .....
  3. enabled_backends = ceph,lvm
  4. [ceph]
  5. volume_driver = cinder.volume.drivers.rbd.RBDDriver
  6. rbd_pool = volumes
  7. rbd_ceph_conf = /etc/ceph/ceph.conf
  8. rbd_flatten_volume_from_snapshot = false
  9. rbd_max_clone_depth = 5
  10. rbd_store_chunk_size = 4
  11. rados_connect_timeout = -1
  12. glance_api_version = 2
  13. rbd_user = cinder
  14. rbd_secret_uuid = 8ea0cbae-86a9-4c1c-9f03-fd4b144b8839
  15. volume_backend_name = ceph
复制代码
重启服务
  1. [root@compute ceph]# systemctl restart openstack-cinder-volume.service
复制代码
测试
  1. [root@controller ~]# openstack volume type create ceph
  2. +-------------+--------------------------------------+
  3. | Field       | Value                                |
  4. +-------------+--------------------------------------+
  5. | description | None                                 |
  6. | id          | c357956b-2521-439d-af59-ae2e9cc5c5aa |
  7. | is_public   | True                                 |
  8. | name        | ceph                                 |
  9. +-------------+--------------------------------------+
  10. [root@controller ~]# cinder --os-username admin --os-tenant-name admin type-key ceph set volume_backend_name=ceph
  11. WARNING:cinderclient.shell:API version 3.59 requested,
  12. WARNING:cinderclient.shell:downgrading to 3.50 based on server support.
  13. [root@controller ~]# openstack volume create ceph-test --type ceph --size 1
  14.         +---------------------+--------------------------------------+
  15. | Field               | Value                                |
  16. +---------------------+--------------------------------------+
  17. | attachments         | []                                   |
  18. | availability_zone   | nova                                 |
  19. | bootable            | false                                |
  20. | consistencygroup_id | None                                 |
  21. | created_at          | 2023-06-03T15:36:09.000000           |
  22. | description         | None                                 |
  23. | encrypted           | False                                |
  24. | id                  | fdf6c10a-31dc-4245-ae7b-b7bc0e24477d |
  25. | migration_status    | None                                 |
  26. | multiattach         | False                                |
  27. | name                | ceph-test                            |
  28. | properties          |                                      |
  29. | replication_status  | None                                 |
  30. | size                | 1                                    |
  31. | snapshot_id         | None                                 |
  32. | source_volid        | None                                 |
  33. | status              | creating                             |
  34. | type                | ceph                                 |
  35. | updated_at          | None                                 |
  36. | user_id             | 9ff19a0bedd5461aa3fff4a80f10054c     |
  37. +---------------------+--------------------------------------+
  38. [root@controller ~]#
复制代码
  1. [root@storage01 ceph]# rbd ls volumes
  2. volume-fdf6c10a-31dc-4245-ae7b-b7bc0e24477d
复制代码
卷id雷同,验证成功
1.查抄 glance 服务存储配置正确计 1 分
1.2.11 私有云平台优化:系统网络优化[1 分]

   使用自行创建的 OpenStack 云盘算平台,配置控制节点的网络缓存,使得每个 UDP 连接(发送、受)保证能有最小 358 KiB 最大 460 KiB 的 buffer,重启后仍然生效。
  1. [root@controller ~]# cat /etc/sysctl.conf
  2. # sysctl settings are defined through files in
  3. # /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
  4. #
  5. # Vendors settings live in /usr/lib/sysctl.d/.
  6. # To override a whole file, create a new file with the same in
  7. # /etc/sysctl.d/ and put new settings there. To override
  8. # only specific settings, add a file with a lexically later
  9. # name in /etc/sysctl.d/ and put new settings there.
  10. #
  11. # For more information, see sysctl.conf(5) and sysctl.d(5).
  12. net.bridge.bridge-nf-call-iptables = 1
  13. net.bridge.bridge-nf-call-ip6tables = 1
  14. net.core.rmem_default = 358400
  15. net.core.rmem_max = 460800
  16. net.core.wmem_default = 358400
  17. net.core.wmem_max = 460800
  18. [root@controller ~]# sysctl -p
  19. net.bridge.bridge-nf-call-iptables = 1
  20. net.bridge.bridge-nf-call-ip6tables = 1
  21. net.core.rmem_default = 358400
  22. net.core.rmem_max = 460800
  23. net.core.wmem_default = 358400
  24. net.core.wmem_max = 460800
复制代码
1.查抄网络缓存的系统配置正确计 1 分

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。




欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/) Powered by Discuz! X3.4