详解 InnoDB Cluster 主机名问题

news2025/2/27 14:16:21

详解 InnoDB Cluster 主机名问题

文章目录

  • 详解 InnoDB Cluster 主机名问题
    • 导言
    • 测试过程
    • 结论

导言

因在写 【InnoDB Cluster】修改已有集群实例名称及成员实例选项 时发现主机名这块有一些问题,在其中进行了部分测试,但为使其内容精简,故将此部分单独拿出来形成一篇文章。要了解更多信息,请读者参阅该篇文章。

测试过程

使用cluster.setInstanceOption('旧成员实例名称','label','新成员实例名称')来修改成员实例名称。

 MySQL  ic-source:33060+ ssl  JS > cluster.setInstanceOption('replica3:3306','label','replica2.ic')
Setting the value of 'label' to 'replica2.ic' in the instance: 'replica3:3306' ...

Successfully set the value of 'label' to 'replica2.ic' in the cluster member: 'replica3:3306'.

cluster.status()结果:

 MySQL  ic-source:33060+ ssl  JS > cluster.status()
{
    "clusterName": "myCluster", 
    "defaultReplicaSet": {
        "name": "default", 
        "primary": "ic-source:3306", 
        "ssl": "REQUIRED", 
        "status": "OK", 
        "statusText": "Cluster is ONLINE and can tolerate up to ONE failure.", 
        "topology": {
            "ic-replica1:3306": {
                "address": "ic-replica1:3306", 
                "memberRole": "SECONDARY", 
                "mode": "R/O", 
                "readReplicas": {}, 
                "replicationLag": "applier_queue_applied", 
                "role": "HA", 
                "status": "ONLINE", 
                "version": "8.0.31"
            }, 
            "ic-source:3306": {
                "address": "ic-source:3306", 
                "memberRole": "PRIMARY", 
                "mode": "R/W", 
                "readReplicas": {}, 
                "replicationLag": "applier_queue_applied", 
                "role": "HA", 
                "status": "ONLINE", 
                "version": "8.0.31"
            }, 
            "replica2.ic": {
                "address": "replica3:3306", 
                "memberRole": "SECONDARY", 
                "mode": "R/O", 
                "readReplicas": {}, 
                "replicationLag": "applier_queue_applied", 
                "role": "HA", 
                "status": "ONLINE", 
                "version": "8.0.31"
            }
        }, 
        "topologyMode": "Single-Primary"
    }, 
    "groupInformationSourceMember": "ic-source:3306"
}

cluster.options()结果:

 MySQL  ic-source:33060+ ssl  JS > cluster.options()
 ...
         "tags": {
            "global": [], 
            "ic-replica1:3306": [], 
            "ic-source:3306": [], 
            "replica2.ic": []
        },
 ...
 
            "replica2.ic": [

注意,这里有个问题,我故意拿 replica3:3306 作为cluster.setInstanceOption()方法的实例名称参数,却依然可以运行,证明旧的实例名称并没有完全失效。那是主机缓存的问题吗?

我们来FLUSH HOSTS;试试。

mysql> flush hosts;                            
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> show warnings;
+---------+------+--------------------------------------------------------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                                                                              |
+---------+------+--------------------------------------------------------------------------------------------------------------------------------------+
| Warning | 1287 | 'FLUSH HOSTS' is deprecated and will be removed in a future release. Please use TRUNCATE TABLE performance_schema.host_cache instead |
+---------+------+--------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> show warnings;
+---------+------+--------------------------------------------------------------------------------------------------------------------------------------+
| Level   | Code | Message                                                                                                                              |
+---------+------+--------------------------------------------------------------------------------------------------------------------------------------+
| Warning | 1287 | 'FLUSH HOSTS' is deprecated and will be removed in a future release. Please use TRUNCATE TABLE performance_schema.host_cache instead |
+---------+------+--------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> show tables from performance_schema like 'host%';
+--------------------------------------+
| Tables_in_performance_schema (host%) |
+--------------------------------------+
| host_cache                           |
| hosts                                |
+--------------------------------------+
2 rows in set (0.04 sec)

mysql> select * from performance_schema.host_cache; 
Empty set (0.06 sec)

再次设置label选项:

 MySQL  ic-source:33060+ ssl  JS > cluster.setInstanceOption('replica3:3306','label','replica2')
Setting the value of 'label' to 'replica2' in the instance: 'replica3:3306' ...

Successfully set the value of 'label' to 'replica2' in the cluster member: 'replica3:3306'.
 MySQL  ic-source:33060+ ssl  JS > cluster.status()
{
    "clusterName": "myCluster", 
    "defaultReplicaSet": {
        "name": "default", 
        "primary": "ic-source:3306", 
        "ssl": "REQUIRED", 
        "status": "OK", 
        "statusText": "Cluster is ONLINE and can tolerate up to ONE failure.", 
        "topology": {
            "ic-replica1:3306": {
                "address": "ic-replica1:3306", 
                "memberRole": "SECONDARY", 
                "mode": "R/O", 
                "readReplicas": {}, 
                "replicationLag": "applier_queue_applied", 
                "role": "HA", 
                "status": "ONLINE", 
                "version": "8.0.31"
            }, 
            "ic-source:3306": {
                "address": "ic-source:3306", 
                "memberRole": "PRIMARY", 
                "mode": "R/W", 
                "readReplicas": {}, 
                "replicationLag": "applier_queue_applied", 
                "role": "HA", 
                "status": "ONLINE", 
                "version": "8.0.31"
            }, 
            "replica2": {
                "address": "replica3:3306", 
                "memberRole": "SECONDARY", 
                "mode": "R/O", 
                "readReplicas": {}, 
                "replicationLag": "applier_queue_applied", 
                "role": "HA", 
                "status": "ONLINE", 
                "version": "8.0.31"
            }
        }, 
        "topologyMode": "Single-Primary"
    }, 
    "groupInformationSourceMember": "ic-source:3306"
}

还是可以运行。那再截断performance_schema.hosts表呢?

mysql> select * from performance_schema.hosts;
+-------------+---------------------+-------------------+-------------------------------+--------------------------+
| HOST        | CURRENT_CONNECTIONS | TOTAL_CONNECTIONS | MAX_SESSION_CONTROLLED_MEMORY | MAX_SESSION_TOTAL_MEMORY |
+-------------+---------------------+-------------------+-------------------------------+--------------------------+
| NULL        |                  39 |                86 |                        272128 |                 66816672 |
| localhost   |                   2 |                 5 |                       1477504 |                  1985033 |
| ic-source   |                   0 |                45 |                       2466600 |                  2817255 |
| ic-replica1 |                   0 |                 2 |                          8240 |                    74084 |
| ic-replica2 |                   0 |                 6 |                         20576 |                   126813 |
| replica2    |                   1 |                38 |                         20576 |                    74084 |
| source      |                  15 |               159 |                       2466360 |                  2860667 |
| replica1    |                   1 |                 3 |                         20576 |                    74084 |
+-------------+---------------------+-------------------+-------------------------------+--------------------------+
8 rows in set (0.00 sec)

mysql> truncate table performance_schema.hosts;
Query OK, 0 rows affected (0.09 sec)

mysql> select * from performance_schema.hosts; 
+-----------+---------------------+-------------------+-------------------------------+--------------------------+
| HOST      | CURRENT_CONNECTIONS | TOTAL_CONNECTIONS | MAX_SESSION_CONTROLLED_MEMORY | MAX_SESSION_TOTAL_MEMORY |
+-----------+---------------------+-------------------+-------------------------------+--------------------------+
| NULL      |                  39 |                39 |                        108512 |                  1370284 |
| localhost |                   2 |                 2 |                        647040 |                   671012 |
| replica2  |                   1 |                 1 |                          8240 |                    74084 |
| source    |                  15 |                15 |                       1841072 |                  2397944 |
| replica1  |                   1 |                 1 |                          8240 |                    74084 |
+-----------+---------------------+-------------------+-------------------------------+--------------------------+
5 rows in set (0.00 sec)

再次设置label选项:

 MySQL  ic-source:33060+ ssl  JS > cluster.setInstanceOption('replica3:3306','label','replica2.ic')
Setting the value of 'label' to 'replica2.ic' in the instance: 'replica3:3306' ...

Successfully set the value of 'label' to 'replica2.ic' in the cluster member: 'replica3:3306'.

还是可以运行。

 MySQL  ic-source:33060+ ssl  JS > cluster.status()
 ...
            "replica2.ic": {
                "address": "replica3:3306", 
                "memberRole": "SECONDARY", 
                "mode": "R/O", 
                "readReplicas": {}, 
                "replicationLag": "applier_queue_applied", 
                "role": "HA", 
                "status": "ONLINE", 
                "version": "8.0.31"
            }

所以估计还是其他地方有缓存,或者和addresses可以识别出旧的实例名称。继而,我修改addresses中的mysqlClassic值为 r2-table:3306,即普通 MySQL 客户端使用的经典(标准) MySQL 协议的通讯地址。

mysql> update instances set addresses=json_replace(addresses,'$.mysqlClassic','r2-table:3306') where instance_id=4;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from instances where instance_id=4;
+-------------+--------------------------------------+---------------+--------------------------------------+---------------+-------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+
| instance_id | cluster_id                           | address       | mysql_server_uuid                    | instance_name | addresses                                                                                 | attributes                                                                                                                                             | description |
+-------------+--------------------------------------+---------------+--------------------------------------+---------------+-------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+
|           4 | f465b0e3-6ce3-11ed-8310-000c298d6cb9 | replica3:3306 | 2737b324-a0f6-11ea-afd1-000c2988ff33 | replica2.ic   | {"mysqlX": "replica3:33060", "grLocal": "r2-table:3306", "mysqlClassic": "r2-table:3306"} | {"joinTime": "2022-11-26 01:12:34.768", "server_id": 1250867127, "recoveryAccountHost": "%", "recoveryAccountUser": "mysql_innodb_cluster_1250867127"} | NULL        |
+-------------+--------------------------------------+---------------+--------------------------------------+---------------+-------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+-------------+
1 row in set (0.00 sec)

然后尝试修改label,发现报错,

 MySQL  ic-source:33060+ ssl  JS > cluster.setInstanceOption('replica3:3306','label','replica2')
Cluster.setInstanceOption: The instance 'replica3:3306' does not belong to the cluster. (RuntimeError)

 MySQL  ic-source:33060+ ssl  JS > cluster.status()
{
    "clusterName": "myCluster", 
    "defaultReplicaSet": {
        "name": "default", 
        "primary": "ic-source:3306", 
        "ssl": "REQUIRED", 
        "status": "OK", 
        "statusText": "Cluster is ONLINE and can tolerate up to ONE failure.", 
        "topology": {
            "ic-replica1:3306": {
                "address": "ic-replica1:3306", 
                "memberRole": "SECONDARY", 
                "mode": "R/O", 
                "readReplicas": {}, 
                "replicationLag": "applier_queue_applied", 
                "role": "HA", 
                "status": "ONLINE", 
                "version": "8.0.31"
            }, 
            "ic-source:3306": {
                "address": "ic-source:3306", 
                "memberRole": "PRIMARY", 
                "mode": "R/W", 
                "readReplicas": {}, 
                "replicationLag": "applier_queue_applied", 
                "role": "HA", 
                "status": "ONLINE", 
                "version": "8.0.31"
            }, 
            "replica2.ic": {
                "address": "r2-table:3306", 
                "instanceErrors": [
                    "ERROR: Metadata for this instance does not match hostname reported by instance (metadata=r2-table:3306, actual=replica3:3306). Use rescan() to update the metadata."
                ], 
                "memberRole": "SECONDARY", 
                "mode": "R/O", 
                "readReplicas": {}, 
                "replicationLag": "applier_queue_applied", 
                "role": "HA", 
                "status": "ONLINE", 
                "version": "8.0.31"
            }
        }, 
        "topologyMode": "Single-Primary"
    }, 
    "groupInformationSourceMember": "ic-source:3306"
}

这里我们暂时先不rescan(),尝试使用其他成员实例名称(当前成员实例名称 replica2.ic,当前成员实例的 group_replication_local_address 变量值 r2-cnf:3306,和当前元数据表中新设的值 r2-table:3306 ):

 MySQL  ic-source:33060+ ssl  JS > cluster.setInstanceOption('replica2.ic','label','replica2')
Cluster.setInstanceOption: The instance 'replica2.ic:3306' does not belong to the cluster. (RuntimeError)
 MySQL  ic-source:33060+ ssl  JS > cluster.setInstanceOption('r2-cnf:3306','label','replica2')
Cluster.setInstanceOption: The instance 'r2-cnf:3306' does not belong to the cluster. (RuntimeError)
 MySQL  ic-source:33060+ ssl  JS > cluster.setInstanceOption('r2-table:3306','label','replica2')
Cluster.setInstanceOption: The instance 'r2-table:3306' does not belong to the cluster. (RuntimeError)

再试下mysqlX的值 replica3:33060 ,显然协议都不对:

 MySQL  ic-source:33060+ ssl  JS > cluster.setInstanceOption('replica3:33060','label','replica2')
ERROR: Unable to connect to the target instance 'replica3:33060'. Please verify the connection settings, make sure the instance is available and try again.
Cluster.setInstanceOption: Could not open connection to 'replica3:33060': The provided URI uses the X protocol, which is not supported by this command. (RuntimeError)

都报错,证明改这个东西导致 MYSQL Shell 元数据与实际情况出现了不匹配,虽然集群仍保持高可用,成员实例仍保持在线状态,但 MYSQL Shell API 已经无法对该成员实例进行修改了。我验证了此时也仍可建立新客户端会话。由此证明mysqlClassic很重要!
图1

那么我们改回正确的值 replica3:3306

mysql> update instances set addresses=json_replace(addresses,'$.mysqlClassic','replica3:3306') where instance_id=4;         
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

查看集群状态显示已经恢复了。把所有/etc/hosts中该 IP 地址对应的名称全都拿来作为成员实例名称传入该方法的第一个参数中:

 MySQL  ic-source:33060+ ssl  JS > cluster.setInstanceOption('r2-table:3306','label','replica2')
Setting the value of 'label' to 'replica2' in the instance: 'r2-table:3306' ...

Successfully set the value of 'label' to 'replica2' in the cluster member: 'r2-table:3306'.
 MySQL  ic-source:33060+ ssl  JS > cluster.setInstanceOption('replica3:3306','label','replica2.ic')
Setting the value of 'label' to 'replica2.ic' in the instance: 'replica3:3306' ...

Successfully set the value of 'label' to 'replica2.ic' in the cluster member: 'replica3:3306'.
 MySQL  ic-source:33060+ ssl  JS > cluster.setInstanceOption('r2-cnf:3306','label','replica2')
Setting the value of 'label' to 'replica2' in the instance: 'r2-cnf:3306' ...
 MySQL  ic-source:33060+ ssl  JS > cluster.setInstanceOption('replica2.ic:3306','label','replica2.ic')
Setting the value of 'label' to 'replica2.ic' in the instance: 'replica2.ic:3306' ...

Successfully set the value of 'label' to 'replica2.ic' in the cluster member: 'replica2.ic:3306'.
 MySQL  ic-source:33060+ ssl  JS > cluster.setInstanceOption('ic-replica2:3306','label','replica2')
Setting the value of 'label' to 'replica2' in the instance: 'ic-replica2:3306' ...

Successfully set the value of 'label' to 'replica2' in the cluster member: 'ic-replica2:3306'.

都可以运行,证明并不是只识别旧的实例名称,而是/etc/hosts中为该 IP 地址定义的所有名称!

那么为什么如此呢?前面我们已经分析得出结论,需要重启 MySQL 服务器(进程)才会将修改的主机名应用到数据库。所以这个实例名称 MySQL Shell API 是通过 MySQL 的主机名(SELECT @@hostname;)和协议使用的端口号拼接而成的。因为 MySQL 8.0.27 版本以后的 MySQL 8.0 组复制通信堆栈 支持 MySQL 通信协议 作为可选项,且 InnoDB Cluster 默认采用 MySQL 通信堆栈。所以此处的端口号是 MYSQL 默认的 3306 ,而非 XCOM 默认的 33061

mysql> SELECT @@group_replication_communication_stack;
+-----------------------------------------+
| @@group_replication_communication_stack |
+-----------------------------------------+
| MYSQL                                   |
+-----------------------------------------+
1 row in set (0.00 sec)

如果我们刚刚使用rescan()呢?再现刚刚的问题:

mysql> update instances set addresses=json_replace(addresses,'$.mysqlClassic','r2-table:3306') where instance_id=4;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0
}
 MySQL  ic-source:33060+ ssl  JS > cluster.rescan()
Rescanning the cluster...

Result of the rescanning operation for the 'myCluster' cluster:
{
    "name": "myCluster", 
    "newTopologyMode": null, 
    "newlyDiscoveredInstances": [], 
    "unavailableInstances": [], 
    "updatedInstances": [
        {
            "host": "replica3:3306", 
            "id": 4, 
            "label": "replica2", 
            "member_id": "2737b324-a0f6-11ea-afd1-000c2988ff33", 
            "old_host": "ic-replica2:3306"
        }
    ]
}

The instance 'replica3:3306' is part of the cluster but its reported address has changed. Old address: ic-replica2:3306. Current address: replica3:3306.
Updating instance metadata...
The instance metadata for 'replica3:3306' was successfully updated.

 MySQL  ic-source:33060+ ssl  JS > cluster.status()
{
    "clusterName": "myCluster", 
    "defaultReplicaSet": {
        "name": "default", 
        "primary": "ic-source:3306", 
        "ssl": "REQUIRED", 
        "status": "OK", 
        "statusText": "Cluster is ONLINE and can tolerate up to ONE failure.", 
        "topology": {
            "ic-replica1:3306": {
                "address": "ic-replica1:3306", 
                "memberRole": "SECONDARY", 
                "mode": "R/O", 
                "readReplicas": {}, 
                "replicationLag": "applier_queue_applied", 
                "role": "HA", 
                "status": "ONLINE", 
                "version": "8.0.31"
            }, 
            "ic-source:3306": {
                "address": "ic-source:3306", 
                "memberRole": "PRIMARY", 
                "mode": "R/W", 
                "readReplicas": {}, 
                "replicationLag": "applier_queue_applied", 
                "role": "HA", 
                "status": "ONLINE", 
                "version": "8.0.31"
            }, 
            "replica2": {
                "address": "replica3:3306", 
                "memberRole": "SECONDARY", 
                "mode": "R/O", 
                "readReplicas": {}, 
                "replicationLag": "applier_queue_applied", 
                "role": "HA", 
                "status": "ONLINE", 
                "version": "8.0.31"
            }
        }, 
        "topologyMode": "Single-Primary"
    }, 
    "groupInformationSourceMember": "ic-source:3306"
}

再次印证了我刚刚的猜想。

结论

主机名这块,最关键的是 MySQL 的主机名(SELECT @@hostname;),而非操作系统当前的主机名。 当然,只要 MySQL 服务器(进程)一重启,就会读取操作系统当前的主机名作为 MySQL 的主机名(SELECT @@hostname;)。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/39214.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

程序员必知的三款在线绘图工具

文章目录2.draw.io3.Lucidchart4.PrcessOn5.小结正所谓“一图胜千言”,无论是商务办公、PPT 演示、学习总结、技术交流、项目开发,我们常常都需要制作一些图表、流程图、架构图来更直观地呈现内容以及归类整理知识点。 今天就来说下程序员们常用的三款在…

【矩阵论】正规方程——生成子空间

5.1 子空间 5.1.1. 定义 设 W⊂CnW\subset C^nW⊂Cn ,即子空间对线性组合封闭 若(1)对∀α,β∈W,有αβ∈W(对加法封闭)(2)对∀α∈W,∀k∈C,有kα∈W(对数乘封闭)\begin{aligned} 若 &(1)对\forall \alpha,\beta\in W,有\…

秋招失利,拿到这份“Java 高分指南(25 专题)”,金三银四翻盘有望

面试造火箭,工作拧螺丝!金九银十灰溜溜地落榜,备受打击。正当准备明年金三银四之际,意外喜提朋友赠送的这“Java 高分指南(25 专题)”:Elasticsearch、微服务、Linux、JavaOOP、集合/泛型、Mysq…

Flutter高仿微信-第57篇-添加好友

Flutter高仿微信系列共59篇,从Flutter客户端、Kotlin客户端、Web服务器、数据库表结构、Xmpp即时通讯服务器、视频通话服务器、腾讯云服务器全面讲解。 详情请查看 效果图: 实现代码: /*** Author : wangning* Email : maoning20080809163.c…

ThreadLocal

文章目录一、ThreadLocal是什么二、ThreadLocal作用三、ThreadLocal的设计结构早期:现在:四、ThreadLocal核心方法1. set方法2. get方法3. remove方法五、ThreadLocal内存泄漏六、使用场景七、参考资料前言: 再写博客时,遇到了如何处理保存用户的信息时出…

基于共享储能电站的工业用户 日前优化经济调度matlab程序(yalmip+cplex)(yalmip+gurobi)

基于共享储能电站的工业用户 日前优化经济调度matlab程序(yalmipcplex)(yalmipgurobi) 参考文献:基于共享储能电站的工业用户 日前优化经济调度 摘要: 文章提出一种基于共享储能电站的工业用户日前优化经济调度方法。…

nginx反向代理,负载均衡配置

文章目录一.nginx代理简介二.nginx配置简介三.nginx作为反向代理的配置四.nginx作为负载均衡的配置五.使用nginx代理的坑一.nginx代理简介 其实nginx作为代理有两种 正向代理: 隐藏客户端的信息;如科学上网 反向代理: 隐藏服务端的信息;如负载均衡 二.nginx配置…

11.26

目录 一.做题出错 1. 2.数组长度的一半 3.选择题 二.优先级队列(堆) 1.二叉树的顺序存储 1.1 存储方式 1.2下标关系 2.堆(heap) 2.1概念 2.2 操作-向下调整 三 建堆 四.优先级队列 1 概念 2 内部原理 3.操作-入队 offer() 4.操作-出队 五.计算糖果 一.做题出错…

docker如何下载国外镜像

目录背景解决方案1、创建阿里云镜像仓库2、使用https://labs.play-with-docker.com下载镜像3、将镜像上传到阿里云镜像仓库4、从阿里云镜像仓库中拉取镜像到我们linux系统中5、改变我们linux系统中拉取的镜像名称背景 今天在安装grafana和prometheus,但是在下载下面…

Java数据结构

目录 1、栈 2、队列 3、数组 4、链表 5、树 7、平衡二叉树 8、红黑树 1、栈 特点:先进后出,后进先出 数据进入栈模型的过程称为:压/进栈 数据离开栈模型的过程称为:弹/出栈 2、队列 特点:先进先出,后进后出 数据从后…

MyBatis-Plus中的更新操作(通过id更新和条件更新)

目录 前言 一、通过id更新 二、条件更新 2.1 使用QueryWrapper进行条件更新 2.2 使用UpdateWrapper进行条件更新 总结 前言 本文学习MP中的更新操作方法,带大家一起查看源码,了解更新操作的方法。学会熟练地去运用更新方法解决自己在项目中的问题…

Linus 文件处理(三)

目录 一、前言 二、扫描目录 1、opendir 2、readdir 3、telldir 4、seekdir 5、 closedir 6、A Directory-Scanning Program 三、Errors 1、strerror 2、perror 一、前言 本文将简单介绍Linux文件和目录,以及如何操作它们(如何创建文件、打开…

独家 | 使用python马尔科夫链方法建模星巴克等待时长

作者:Piero Paialunga翻译:陈超校对:和中华本文约4200字,建议阅读11分钟本文使用马尔科夫链的方法对星巴克购买咖啡的等待时长进行建模。以下内容关于如何使用马尔科夫链计算你在星巴克咖啡的等待时长。图片来自Unplash&#xff0…

Spring - ApplicationContextInitializer 扩展接口

文章目录Preorg.springframework.context.ApplicationContextInitializer扩展点扩展接口扩展生效方式方式一 : Spring SPI扩展方式二 : 配置文件方式三 :启动类手工add测试结果Pre Spring Boot - 扩展接口一览 org.springframework.context.…

详解诊断数据库ODX-C

文章目录 前言一、ODX—C作用是什么?二、ODX-C数据库在工具ODXStudio的编辑方法总结前言 ODX是全球通用的一种诊断数据库格式,相比CDD文件(Vector公司私有的一种数据库格式),应用场景和范围更广,包含了不同的子类: ODX-C\-D\-V\-E\-F\-FD 今天这篇文章仅对ODX-C做一个…

开源物联网系统 ThingsBoard 上手

开源物联网系统 ThingsBoard 上手 centos yum 被占用问题解决: 描述:Another app is currently holding the yum lock; waiting for it to exit 参考:https://blog.csdn.net/Dan1374219106/article/details/112450922 查看yum占用&#xff1a…

制作一个简单HTML中华传统文化网页(HTML+CSS)

🎉精彩专栏推荐 💭文末获取联系 ✍️ 作者简介: 一个热爱把逻辑思维转变为代码的技术博主 💂 作者主页: 【主页——🚀获取更多优质源码】 🎓 web前端期末大作业: 【📚毕设项目精品实战案例 (10…

scrapy的入门使用

目录 一、 安装scrapy 1.windonws/Mac安装命令: 2. 安装依赖包:pip install pypiwin32 二、 scrapy项目开发流程 1.创建项目:    2.生成一个爬虫: 3.提取数据: 4.保存数据: 三、 创建项目 四、创建爬虫 五、完善爬虫 5.2 定位元素以及提取…

序列化与反序列化笔记

序列化与反序列化 为什么会有序列化与反序列化的需求呢? 序列化是把对象转换成有序字节流,通常都是一段可阅读的字符串,以便在网络上传输或者保存在本地文件中。同样,如果我们想直接使用某对象时,就可能通过反序列化…

23-Vue之事件修饰符

事件修饰符前言阻止默认行为阻止冒泡事件前言 本篇来学习两个常用的事件修饰符 阻止默认行为 .prevent : 阻止默认行为 <!DOCTYPE html> <html lang"en"> <head><meta charset"UTF-8"><meta name"viewport" cont…