容器部署的openstack进入数据库流程、查看install目录流程、容器部署使用virsh命令流程【查看计算节点上的虚拟机信息】

本文主要是介绍容器部署的openstack进入数据库流程、查看install目录流程、容器部署使用virsh命令流程【查看计算节点上的虚拟机信息】,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

说明

  • 何为容器部署,无需多说吧?
    如下 计算节点的容器
    在这里插入图片描述

进入数据库方法【控制节点】

获取nova密码

首先获取nova数据库的密码
控制节点执行:grep mysql /etc/kolla/nova-api/nova.conf 【目录不是固定的,可以通过find命令查找nova.conf文件查看】,如下,1Gr2qFT0LmZ46v0GrFUJmXEFTTBHWVWzofxkxLAn就是密码

[root@controller01 ~]# grep mysql /etc/kolla/nova-api/nova.conf
connection = mysql+pymysql://nova:1Gr2qFT0LmZ46v0GrFUJmXEFTTBHWVWzofxkxLAn@10.241.101.240:3306/nova
connection = mysql+pymysql://nova_api:Msgi5FFcPqlkT26lDaH7wcceAE1cQNbsyzQ6TbzQ@10.241.101.240:3306/nova_api
[root@controller01 ~]# 

查看数据库容器

肯定会有一个数据库容器的,如我这是mariadb

[root@controller01 ~]# docker ps 
CONTAINER ID        IMAGE                                                                          COMMAND                  CREATED             STATUS              PORTS               NAMES                              openvswitch_vswitchd
...
0e12fe84c1d1        10.241.101.32:9980/kolla/centos-binary-iscsid:5.0.6.6                          "kolla_start"            2 years ago         Up 2 years                              iscsid
fcaf8d58d941        10.241.101.32:9980/kolla/centos-binary-mariadb:5.0.6.6                         "kolla_start"            2 years ago         Up 23 months                            mariadb
85cb175184b1        10.241.101.32:9980/kolla/centos-binary-memcached:5.0.6.6                       "kolla_start"            2 years ago         Up 23 months                            memcached
...
[root@controller01 ~]#

进入容器

[root@controller01 ~]#  docker exec -it mariadb /bin/bash
(mariadb)[mysql@controller01 /]$ mysql -unova -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 170661721
Server version: 10.0.38-MariaDB-wsrep MariaDB Server, wsrep_25.25.rc3fc46eCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> 

容器内登录数据库

(mariadb)[mysql@controller01 /]$ mysql -unova -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 170666994
Server version: 10.0.38-MariaDB-wsrep MariaDB Server, wsrep_25.25.rc3fc46eCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> 

查看测试

MariaDB [(none)]> 
MariaDB [(none)]> use nova;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -ADatabase changed
MariaDB [nova]> 
MariaDB [nova]> select * from instances where uuid= '19ec09a5-151b-4111-a4bd-636d10794912' \G
*************************** 1. row ***************************created_at: 2022-01-18 14:15:33updated_at: 2023-10-12 01:33:59deleted_at: NULLid: 3237internal_id: NULLuser_id: cd7e88be84f14196a468f443b345288cproject_id: 22fce3ac5d094a32a652555584dd47fbimage_ref: kernel_id: ramdisk_id: launch_index: 0key_name: NULLkey_data: NULLpower_state: 0vm_state: activememory_mb: 65536vcpus: 16hostname: rms-database2host: compute30user_data: I2Nsb3VkLWNvbmZpZw0KZGlzYWJsZV9yb290OiBGYWxzZQ0KcGFzc3dvcmQ6IGlSbVNEYXRhQmFzZTNKIyEha2UmaiheXikNCmNocGFzc3dkOg0KICAgIGxpc3Q6IHwNCiAgICAgICAgICByb290OmlSbVNEYXRhQmFzZTNKIyEha2UmaiheXikNCiAgICBleHBpcmU6IEZhbHNlDQpzc2hfcHdhdXRoOiBUcnVlreservation_id: r-zvgjpx0llaunched_at: 2022-01-18 14:16:02terminated_at: NULLdisplay_name: rms-database2display_description: rms-database2availability_zone: corelocked: 0os_type: NULLlaunched_on: compute30instance_type_id: 70vm_mode: NULLuuid: 19ec09a5-151b-4111-a4bd-636d10794912architecture: NULLroot_device_name: /dev/vdaaccess_ip_v4: NULLaccess_ip_v6: NULLconfig_drive: Truetask_state: NULL
default_ephemeral_device: NULLdefault_swap_device: NULLprogress: 0auto_disk_config: 0shutdown_terminate: 0disable_terminate: 0root_gb: 200ephemeral_gb: 0cell_name: NULLnode: compute30deleted: 0locked_by: NULLcleaned: 0ephemeral_key_uuid: NULL
1 row in set (0.00 sec)MariaDB [nova]>     

查看install目录流程【计算节点】

查看容器

  • nova_compute 和nova_libvirt 这2个容器都是可以查看实例目录的,进任意一个都行
[root@compute30 ~]# docker ps
CONTAINER ID        IMAGE                                                                      COMMAND                  CREATED             STATUS              PORTS               NAMES
0f14cdcf6f90        10.241.101.32:9980/kolla/centos-binary-neutron-openvswitch-agent:5.0.6.6   "kolla_start"            2 years ago         Up 2 years                              neutron_openvswitch_agent
733b936d9a69        10.241.101.32:9980/kolla/centos-binary-openvswitch-vswitchd:5.0.6.6        "kolla_start"            2 years ago         Up 2 years                              openvswitch_vswitchd
d3dfc7bd9741        10.241.101.32:9980/kolla/centos-binary-openvswitch-db-server:5.0.6.6       "kolla_start"            2 years ago         Up 2 years                              openvswitch_db
cc979a6d2dc3        10.241.101.32:9980/kolla/centos-binary-nova-compute:5.0.6.6                "kolla_start"            2 years ago         Up 4 months                             nova_compute
2fd8430c10fc        10.241.101.32:9980/kolla/centos-binary-nova-libvirt:5.0.6.6                "kolla_start"            2 years ago         Up 2 years                              nova_libvirt
5317fd6f9dc4        10.241.101.32:9980/kolla/centos-binary-nova-ssh:5.0.6.6                    "kolla_start"            2 years ago         Up 2 years                              nova_ssh
63dc84cd0a08        10.241.101.32:9980/kolla/centos-binary-chrony:5.0.6.6                      "kolla_start"            2 years ago         Up 13 months                            chrony
c502dcb7f5d1        10.241.101.32:9980/kolla/centos-binary-cron:5.0.6.6                        "kolla_start"            2 years ago         Up 2 years                              cron
37f17293ad92        10.241.101.32:9980/kolla/centos-binary-kolla-toolbox:5.0.6.6               "kolla_start"            2 years ago         Up 2 years                              kolla_toolbox
aa0a7798f731        10.241.101.32:9980/kolla/centos-binary-fluentd:5.0.6.6                     "dumb-init --single-…"   2 years ago         Up 2 years                              fluentd
[root@compute30 ~]#

进入容器

  • 进入nova_libvirt查看
    我这的实例目录是/var/lib/nova/instances/【你的如果不是就用find搜索instances即可】
[root@compute30 ~]# docker exec -it nova_libvirt bash
(nova-libvirt)[root@compute30 /]# cd /var/lib/nova/instances/
(nova-libvirt)[root@compute30 instances]# ls
19ec09a5-151b-4111-a4bd-636d10794912  b0cc2a24-1c9c-46d3-bd3b-ef90b78c871c  b7a9b013-d364-4588-b8ae-f6cbd4ba704f  _base          daaf62bf-ed53-4a16-892a-798ac427254b  f8a41b8e-c989-4645-9f18-fdeee075c8d9
4fad6565-b24b-4617-bb8e-4110ebd43026  b3b091ee-fcbc-4a2a-8a09-7250ee144f3c  b99dc9e3-0d6b-4b3b-965a-d4e10791c4f0  compute_nodes  f76744d4-afbc-4d92-80e0-cbdb7b30be15  locks
(nova-libvirt)[root@compute30 instances]# cd 19ec09a5-151b-4111-a4bd-636d10794912/
(nova-libvirt)[root@compute30 19ec09a5-151b-4111-a4bd-636d10794912]# ls
console.log
(nova-libvirt)[root@compute30 19ec09a5-151b-4111-a4bd-636d10794912]# 
  • 进入nova_compute查看
    可以看到显示内容和nova_libvrit一样的
[root@compute30 ~]# docker exec -it nova_compute bash
(nova-compute)[nova@compute30 /]$ cd /var/lib/nova/instances/
(nova-compute)[nova@compute30 /var/lib/nova/instances]$ ls
19ec09a5-151b-4111-a4bd-636d10794912  _base                                 b3b091ee-fcbc-4a2a-8a09-7250ee144f3c  b99dc9e3-0d6b-4b3b-965a-d4e10791c4f0  daaf62bf-ed53-4a16-892a-798ac427254b  f8a41b8e-c989-4645-9f18-fdeee075c8d9
4fad6565-b24b-4617-bb8e-4110ebd43026  b0cc2a24-1c9c-46d3-bd3b-ef90b78c871c  b7a9b013-d364-4588-b8ae-f6cbd4ba704f  compute_nodes                         f76744d4-afbc-4d92-80e0-cbdb7b30be15  locks
(nova-compute)[nova@compute30 /var/lib/nova/instances]$ cd 19ec09a5-151b-4111-a4bd-636d10794912/
(nova-compute)[nova@compute30 /var/lib/nova/instances/19ec09a5-151b-4111-a4bd-636d10794912]$ ls
console.log
(nova-compute)[nova@compute30 

使用virsh命令流程【计算节点】

查看容器

  • virsh命令是基于libvirt服务的,所以我们这需要进入nova_libvirt容器
[root@compute30 ~]# docker ps
CONTAINER ID        IMAGE                                                                      COMMAND                  CREATED             STATUS              PORTS               NAMES
0f14cdcf6f90        10.241.101.32:9980/kolla/centos-binary-neutron-openvswitch-agent:5.0.6.6   "kolla_start"            2 years ago         Up 2 years                              neutron_openvswitch_agent
733b936d9a69        10.241.101.32:9980/kolla/centos-binary-openvswitch-vswitchd:5.0.6.6        "kolla_start"            2 years ago         Up 2 years                              openvswitch_vswitchd
d3dfc7bd9741        10.241.101.32:9980/kolla/centos-binary-openvswitch-db-server:5.0.6.6       "kolla_start"            2 years ago         Up 2 years                              openvswitch_db
cc979a6d2dc3        10.241.101.32:9980/kolla/centos-binary-nova-compute:5.0.6.6                "kolla_start"            2 years ago         Up 4 months                             nova_compute
2fd8430c10fc        10.241.101.32:9980/kolla/centos-binary-nova-libvirt:5.0.6.6                "kolla_start"            2 years ago         Up 2 years                              nova_libvirt
5317fd6f9dc4        10.241.101.32:9980/kolla/centos-binary-nova-ssh:5.0.6.6                    "kolla_start"            2 years ago         Up 2 years                              nova_ssh
63dc84cd0a08        10.241.101.32:9980/kolla/centos-binary-chrony:5.0.6.6                      "kolla_start"            2 years ago         Up 13 months                            chrony
c502dcb7f5d1        10.241.101.32:9980/kolla/centos-binary-cron:5.0.6.6                        "kolla_start"            2 years ago         Up 2 years                              cron
37f17293ad92        10.241.101.32:9980/kolla/centos-binary-kolla-toolbox:5.0.6.6               "kolla_start"            2 years ago         Up 2 years                              kolla_toolbox
aa0a7798f731        10.241.101.32:9980/kolla/centos-binary-fluentd:5.0.6.6                     "dumb-init --single-…"   2 years ago         Up 2 years                              fluentd
[root@compute30 ~]#

进入容器执行命令查看虚拟机和其uuid

[root@compute30 ~]# docker exec -it nova_libvirt bash
(nova-libvirt)[root@compute30 /]# 
(nova-libvirt)[root@compute30 /]# virsh list --allId    Name                           State
----------------------------------------------------27    instance-00000c37              running33    instance-00000cf0              running41    instance-00000e08              running45    instance-0000144d              running52    instance-00000c5a              running54    instance-00000c0a              running60    instance-00000d0e              running(nova-libvirt)[root@compute30 /]# 
(nova-libvirt)[root@compute30 /]# virsh domuuid 27
b99dc9e3-0d6b-4b3b-965a-d4e10791c4f0(nova-libvirt)[root@compute30 /]# 
(nova-libvirt)[root@compute30 /]# virsh domuuid 33
b0cc2a24-1c9c-46d3-bd3b-ef90b78c871c(nova-libvirt)[root@compute30 /]#

不进入容器执行命令查看虚拟机和其uuid

  • 命令:docker exec NAMES 命令【docker ps 查看NAMES】
[root@compute30 ~]# docker exec nova_libvirt  virsh list --allId    Name                           State
----------------------------------------------------27    instance-00000c37              running33    instance-00000cf0              running41    instance-00000e08              running45    instance-0000144d              running54    instance-00000c0a              running79    instance-00000ca5              running[root@compute30 ~]#
[root@compute30 ~]# docker exec nova_libvirt  virsh domuuid 27
b99dc9e3-0d6b-4b3b-965a-d4e10791c4f0[root@compute30 ~]# 
  • 换一个容器查看时间继续测试
[root@compute30 ~]# docker exec nova_compute date
Thu Oct 12 17:40:38 CST 2023
[root@compute30 ~]# 

这篇关于容器部署的openstack进入数据库流程、查看install目录流程、容器部署使用virsh命令流程【查看计算节点上的虚拟机信息】的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/202008

相关文章

nginx -t、nginx -s stop 和 nginx -s reload 命令的详细解析(结合应用场景)

《nginx-t、nginx-sstop和nginx-sreload命令的详细解析(结合应用场景)》本文解析Nginx的-t、-sstop、-sreload命令,分别用于配置语法检... 以下是关于 nginx -t、nginx -s stop 和 nginx -s reload 命令的详细解析,结合实际应

SQL server数据库如何下载和安装

《SQLserver数据库如何下载和安装》本文指导如何下载安装SQLServer2022评估版及SSMS工具,涵盖安装配置、连接字符串设置、C#连接数据库方法和安全注意事项,如混合验证、参数化查... 目录第一步:打开官网下载对应文件第二步:程序安装配置第三部:安装工具SQL Server Manageme

C#连接SQL server数据库命令的基本步骤

《C#连接SQLserver数据库命令的基本步骤》文章讲解了连接SQLServer数据库的步骤,包括引入命名空间、构建连接字符串、使用SqlConnection和SqlCommand执行SQL操作,... 目录建议配合使用:如何下载和安装SQL server数据库-CSDN博客1. 引入必要的命名空间2.

使用Python删除Excel中的行列和单元格示例详解

《使用Python删除Excel中的行列和单元格示例详解》在处理Excel数据时,删除不需要的行、列或单元格是一项常见且必要的操作,本文将使用Python脚本实现对Excel表格的高效自动化处理,感兴... 目录开发环境准备使用 python 删除 Excphpel 表格中的行删除特定行删除空白行删除含指定

SpringBoot结合Docker进行容器化处理指南

《SpringBoot结合Docker进行容器化处理指南》在当今快速发展的软件工程领域,SpringBoot和Docker已经成为现代Java开发者的必备工具,本文将深入讲解如何将一个SpringBo... 目录前言一、为什么选择 Spring Bootjavascript + docker1. 快速部署与

golang程序打包成脚本部署到Linux系统方式

《golang程序打包成脚本部署到Linux系统方式》Golang程序通过本地编译(设置GOOS为linux生成无后缀二进制文件),上传至Linux服务器后赋权执行,使用nohup命令实现后台运行,完... 目录本地编译golang程序上传Golang二进制文件到linux服务器总结本地编译Golang程序

深入理解Go语言中二维切片的使用

《深入理解Go语言中二维切片的使用》本文深入讲解了Go语言中二维切片的概念与应用,用于表示矩阵、表格等二维数据结构,文中通过示例代码介绍的非常详细,需要的朋友们下面随着小编来一起学习学习吧... 目录引言二维切片的基本概念定义创建二维切片二维切片的操作访问元素修改元素遍历二维切片二维切片的动态调整追加行动态

Linux下删除乱码文件和目录的实现方式

《Linux下删除乱码文件和目录的实现方式》:本文主要介绍Linux下删除乱码文件和目录的实现方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录linux下删除乱码文件和目录方法1方法2总结Linux下删除乱码文件和目录方法1使用ls -i命令找到文件或目录

prometheus如何使用pushgateway监控网路丢包

《prometheus如何使用pushgateway监控网路丢包》:本文主要介绍prometheus如何使用pushgateway监控网路丢包问题,具有很好的参考价值,希望对大家有所帮助,如有错误... 目录监控网路丢包脚本数据图表总结监控网路丢包脚本[root@gtcq-gt-monitor-prome

Python通用唯一标识符模块uuid使用案例详解

《Python通用唯一标识符模块uuid使用案例详解》Pythonuuid模块用于生成128位全局唯一标识符,支持UUID1-5版本,适用于分布式系统、数据库主键等场景,需注意隐私、碰撞概率及存储优... 目录简介核心功能1. UUID版本2. UUID属性3. 命名空间使用场景1. 生成唯一标识符2. 数