mariadb 高可用集群

news2024/11/27 14:50:00

目录

1.相同操作:修改hosts文件 把四台机IP写进去

2.  www 管理机

4.管理


简介:

MHA(Master High Availability)目前在MySQL高可用方面是一个相对成熟的解决方案,它由日本DeNA公司youshimaton(现就职于Facebook公司)开发,是一套优秀的作为MySQL高可用性环境下故障切换和主从提升的高可用软件。在MySQL故障切换过程中,MHA能做到在0~30秒之内自动完成数据库的故障切换操作,并且在进行故障切换的过程中,MHA能在最大程度上保证数据的一致性,以达到真正意义上的高可用。

1.环境:qqq主机  www管理机   eee从   rrr从

1.相同操作:修改hosts文件 把四台机IP写进去

 

 生成密钥:ssh-keygen -t rsa

复制密钥 所有机必须复制管理机 另保证全部可以相互登陆

ssh-copy-id -i .ssh/id_rsa.pub root@名字

查看cat /root/.ssh/authorized_keys

主机操作
[root@qqq ~]# cat /root/.ssh/authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDcqcvxC7TYVQ7cq8iSF2GAEFerIYvGQopFV69qpkocUl6FtOTfgInI5PXEqeD3AUCpgSiYOmvB7qqHEKS8njVLqrTVSOB/U8DNG6myOHyQpjfV1CUETpWs7nakv7Hg7UrWIA1MR5lj8ZtHGXlYoK1lEAdHGRDgtFY8dj+kHpuT2Ul4LV4o1gK3sXthxo3yb1kfeQ8ZlSp3VbSNB3jU/RPeIOeVJpuKBn/71+NeWU1xEEZLWVgO6YAJRRiflPrEj8m0sCmWzAn4oi1yGDZKoYHhynkjCkxp2Q2HJ4RRzDcA6Auk/WHy8UtmVkeHM5ByDrkYSwhivx//Eyb+5SLs29e7 root@qqq
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDci146ceYUzMlxV6eKmGUsjTXAYzRW4xWSX3e3arqDvuttTIOAB9/on9sgiFjTIQz1z8AXjFwldLzcpus0eRZT5hz/mNHKIgF2FEcpk8wZoNNX13pyaCn0LnuZkmDXXCPaV2n8uCyr3OA/q9sCoyRp8uWNshIZRFHjxmRHj47hV9fkusaZrr7l+yFM4l7LsrDGjwTj16mhehGDc52LgQML6Y86GcI+0gd0QW4aypiLOOEiKQYM1PbGd9M6fAjImQQCkWm5XDTmIOXwI09KuqVvICFJWxUEoW0EAHX4qMZauDjDoYDfE0SnggRvlzgmPhWh9WOZsYuwppdQCdTBaRir root@www
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCqwuvAyEW/kF+defnFn22yYf0IAjaIxkMFPCd6V3fLVN4zwZAvj0bhgCSLyQkV9H23hwaqRrsI+maYVyuB0qWULJBpE+ZCIiBjj15dGjGYuB6NBvymtdbOVPExQXW9VGUQcRPlt8uhcVoJ4SB7wWXC2TJXFwKRu3WYdFAJZUW5cytMblLWBdBoZKRORwGF+c+4LpGuocx/+SH6u+OrR1lfoYNf05fbZXmgJsm0x+ExVWAos6ne7LD0p48zMKvoBAok7R0xKCXw6uOPzxB0FKvyy4Lz4feWhjwR4rxoMIOgFKp0BkMW+dN0xrR4SUNlCU37oe9IsgX9njZzGHbO/yJz root@eee
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDD0e8ASnVTyhpCB71hZpYkP7izLgg4xCmX8dJVjvhWY/n89AzhzjIR45V+06td6RlO+U29ffurO5RFx8ryf8xOyeuTD3COCUBMaz+3+HUWNtei92fxLfjFYt1JWbBBt385eHM63HDdRQBHmvnBPuCUaOhm0urdYQye2HR0f35towDrT/kRAZYCFyw9yRzfZKjt7d4Iki2ooAyuPpvtPSucuQnKAQIUsguiQ8H7bnBCmkQIelJTwz+jwbKlCjdVNO6OjfrUB54P065lwV/zOj69elJ/yZ12APsAAxSQTLlxUsVi+m8cuIaJR5jlZDStOObwCHH66BpUuyHYOOsl2+Nh root@rrr

将authorized_keysau文件发送给其他人

scp .ssh/authorized_keys root@名字:.ssh/

主机
[root@qqq ~]# scp .ssh/authorized_keys root@www:.ssh/
The authenticity of host 'www (192.168.1.139)' can't be established.
ECDSA key fingerprint is SHA256:KUnDzA9EBdTNT0UE3pDB18XcdeWBK780vEkpfsZR7PI.
ECDSA key fingerprint is MD5:f6:96:4e:cc:7f:5d:73:60:d6:e3:22:7c:00:25:32:3a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'www,192.168.1.139' (ECDSA) to the list of known hosts.
root@www's password: 
authorized_keys                                                     100% 1560     2.0MB/s   00:00    
[root@qqq ~]# scp .ssh/authorized_keys root@eee:.ssh/
The authenticity of host 'eee (192.168.1.129)' can't be established.
ECDSA key fingerprint is SHA256:cgSRKW28gqwbirXE1h/m+vDUazLg1njP+nkrYGzy+I4.
ECDSA key fingerprint is MD5:c2:e1:24:10:c9:ce:32:eb:61:4d:a1:0b:ef:11:d2:d8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'eee,192.168.1.129' (ECDSA) to the list of known hosts.
root@eee's password: 
authorized_keys                                                     100% 1560     2.0MB/s   00:00    
[root@qqq ~]# scp .ssh/authorized_keys root@rrr:.ssh/
The authenticity of host 'rrr (192.168.1.127)' can't be established.
ECDSA key fingerprint is SHA256:qKSdToSlnsPSocexQbkMwS5tYDYo4jM6a+e7mIihZC0.
ECDSA key fingerprint is MD5:2b:72:4f:16:82:a1:72:ae:0f:3d:dc:c1:90:bd:ee:c8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'rrr,192.168.1.127' (ECDSA) to the list of known hosts.
root@rrr's password: 
authorized_keys                                                     100% 1560     1.9MB/s   00:00    

ssh 登陆测试每台机相互可以免密登陆

2.  www 管理机

安装 yum -y install epel-release

        yum -y install mariadb mariadb-server

        rpm -ivh mha4mysql-node-0.56-0.el6.noarch.rpm             网上下载

修改配置文件

vim /etc/my.cnf
server-id = 1
log-bin = master-log
relay-log = relay-log
skip_name_resolve  

重启  mariadb

授权给从库使用  grant replication slave on *.* to ‘slave’@'%' identified by '123';】

授权用户给manager管理master使用 grant all on *.* to mha@'%' identified by '123';

查看二进制文件         show master status;

MySQL 进入
MariaDB [(none)]>  grant replication slave on *.* to 'slave'@'%' identified by '123'; grant all on *.* to 'mha'@'%' identified by '123'; 
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]>  show master status;
+-------------------+----------+--------------+------------------+
| File              | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+-------------------+----------+--------------+------------------+
| master-log.000003 |      911 |              |                  |
+-------------------+----------+--------------+------------------+

退出保存 exit

3.从  eee  配置

安装   yum -y install mariadb mariadb-server epel-release

           rpm -ivh mha4mysql-node-0.56-0.el6.noarch.rpm                  需要下载包

配置写入


vim /etc/my.cnf

server-id = 2                
relay-log = relay-log         
log-bin = master-log         
read_only = ON               
relay_log_purge = 0           
skip_name_resolve              
log_slave_updates = 1

mysql 进入

添加主库信息
MariaDB [(none)]>  change master to master_host='192.168.1.139',master_user='slave',master_password='123',master_log_file='master-log.000003',master_log_pos=911;
Query OK, 0 rows affected (0.00 sec)

开启从库复制进程
MariaDB [(none)]> start slave;
Query OK, 0 rows affected (0.00 sec)

查看主从复制状态      看到两个yes就是成功
MariaDB [(none)]> show slave status \G;
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 192.168.1.139
                  Master_User: slave
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: master-log.000003
          Read_Master_Log_Pos: 911
               Relay_Log_File: relay-log.000002
                Relay_Log_Pos: 530
        Relay_Master_Log_File: master-log.000003
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: 

授权用户给manager管理slave使用
 grant all on *.* to 'mha'@'%' identified by '123';

exit保存退出

到这里 从rrr也和eee一样了

vim /etc/my.cnf
server-id = 3              只需要把这里改成三 若还有从递增就行了       
relay-log = relay-log         
log-bin = master-log         
read_only = ON               
relay_log_purge = 0           
skip_name_resolve              
log_slave_updates = 1

4.管理

安装  yum -y install mariadb mariadb-server epel-release

        yum -y install mha4mysql-node-0.56-0.el6.noarch.rpm mha4mysql-manager-0.56-0.el6.noarch.rpm

创建文件目录

[root@qqq /]# mkdir /etc/mha_master
[root@qqq /]#  vim /etc/mha_master/mha.cnf

写入

[root@qqq /]#  vim /etc/mha_master/mha.cnf

ssh_user=root
repl_user=slave
repl_password=123
ping_interval=1
[server1]
hostname=192.168.1.139
ssh_port=22
candidate_master=1
[server2]
hostname=192.168.1.129
ssh_port=22
candidate_master=1
[server3]
hostname=192.168.1.127
ssh_port=22

对各个节点进行检测masterha_check_ssh --conf=/etc/mha_master/mha.cnf      看到ok就okl


[root@qqq /]#  masterha_check_ssh --conf=/etc/mha_master/mha.cnf
Fri Jun 16 17:06:43 2023 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Fri Jun 16 17:06:43 2023 - [info] Reading application default configuration from /etc/mha_master/mha.cnf..
Fri Jun 16 17:06:43 2023 - [info] Reading server configuration from /etc/mha_master/mha.cnf..
Fri Jun 16 17:06:43 2023 - [info] Starting SSH connection tests..
Fri Jun 16 17:06:44 2023 - [debug] 
Fri Jun 16 17:06:43 2023 - [debug]  Connecting via SSH from root@192.168.1.139(192.168.1.139:22) to root@192.168.1.129(192.168.1.129:22)..
Fri Jun 16 17:06:43 2023 - [debug]   ok.
Fri Jun 16 17:06:43 2023 - [debug]  Connecting via SSH from root@192.168.1.139(192.168.1.139:22) to root@192.168.1.127(192.168.1.127:22)..
Fri Jun 16 17:06:44 2023 - [debug]   ok.
Fri Jun 16 17:06:45 2023 - [debug] 
Fri Jun 16 17:06:44 2023 - [debug]  Connecting via SSH from root@192.168.1.127(192.168.1.127:22) to root@192.168.1.139(192.168.1.139:22)..
Fri Jun 16 17:06:44 2023 - [debug]   ok.
Fri Jun 16 17:06:44 2023 - [debug]  Connecting via SSH from root@192.168.1.127(192.168.1.127:22) to root@192.168.1.129(192.168.1.129:22)..
Fri Jun 16 17:06:45 2023 - [debug]   ok.
Fri Jun 16 17:06:45 2023 - [debug] 
Fri Jun 16 17:06:43 2023 - [debug]  Connecting via SSH from root@192.168.1.129(192.168.1.129:22) to root@192.168.1.139(192.168.1.139:22)..
Fri Jun 16 17:06:44 2023 - [debug]   ok.
Fri Jun 16 17:06:44 2023 - [debug]  Connecting via SSH from root@192.168.1.129(192.168.1.129:22) to root@192.168.1.127(192.168.1.127:22)..
Fri Jun 16 17:06:44 2023 - [debug]   ok.
Fri Jun 16 17:06:45 2023 - [info] All SSH connection tests passed successfully.

检查管理的MySQL复制集群的连接配置参数是否OK

masterha_check_repl --conf=/etc/mha_master/mha.cnf

最后看到这个就是成功了       MySQL Replication Health is OK.


[root@qqq /]# masterha_check_repl --conf=/etc/mha_master/mha.cnf
Fri Jun 16 17:09:48 2023 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Fri Jun 16 17:09:48 2023 - [info] Reading application default configuration from /etc/mha_master/mha.cnf..
Fri Jun 16 17:09:48 2023 - [info] Reading server configuration from /etc/mha_master/mha.cnf..
Fri Jun 16 17:09:48 2023 - [info] MHA::MasterMonitor version 0.56.
Fri Jun 16 17:09:49 2023 - [info] GTID failover mode = 0
Fri Jun 16 17:09:49 2023 - [info] Dead Servers:
Fri Jun 16 17:09:49 2023 - [info] Alive Servers:
Fri Jun 16 17:09:49 2023 - [info]   192.168.1.139(192.168.1.139:3306)
Fri Jun 16 17:09:49 2023 - [info]   192.168.1.129(192.168.1.129:3306)
Fri Jun 16 17:09:49 2023 - [info]   192.168.1.127(192.168.1.127:3306)
Fri Jun 16 17:09:49 2023 - [info] Alive Slaves:
Fri Jun 16 17:09:49 2023 - [info]   192.168.1.129(192.168.1.129:3306)  Version=5.5.68-MariaDB (oldest major version between slaves) log-bin:enabled
Fri Jun 16 17:09:49 2023 - [info]     Replicating from 192.168.1.139(192.168.1.139:3306)
Fri Jun 16 17:09:49 2023 - [info]     Primary candidate for the new Master (candidate_master is set)
Fri Jun 16 17:09:49 2023 - [info]   192.168.1.127(192.168.1.127:3306)  Version=5.5.68-MariaDB (oldest major version between slaves) log-bin:enabled
Fri Jun 16 17:09:49 2023 - [info]     Replicating from 192.168.1.139(192.168.1.139:3306)
Fri Jun 16 17:09:49 2023 - [info]     Primary candidate for the new Master (candidate_master is set)
Fri Jun 16 17:09:49 2023 - [info] Current Alive Master: 192.168.1.139(192.168.1.139:3306)
Fri Jun 16 17:09:49 2023 - [info] Checking slave configurations..
Fri Jun 16 17:09:49 2023 - [warning]  relay_log_purge=0 is not set on slave 192.168.1.129(192.168.1.129:3306).
Fri Jun 16 17:09:49 2023 - [warning]  relay_log_purge=0 is not set on slave 192.168.1.127(192.168.1.127:3306).
Fri Jun 16 17:09:49 2023 - [info] Checking replication filtering settings..
Fri Jun 16 17:09:49 2023 - [info]  binlog_do_db= , binlog_ignore_db= 
Fri Jun 16 17:09:49 2023 - [info]  Replication filtering check ok.
Fri Jun 16 17:09:49 2023 - [info] GTID (with auto-pos) is not supported
Fri Jun 16 17:09:49 2023 - [info] Starting SSH connection tests..
Fri Jun 16 17:09:52 2023 - [info] All SSH connection tests passed successfully.
Fri Jun 16 17:09:52 2023 - [info] Checking MHA Node version..
Fri Jun 16 17:09:52 2023 - [info]  Version check ok.
Fri Jun 16 17:09:52 2023 - [info] Checking SSH publickey authentication settings on the current master..
Fri Jun 16 17:09:52 2023 - [info] HealthCheck: SSH to 192.168.1.139 is reachable.
Fri Jun 16 17:09:53 2023 - [info] Master MHA Node version is 0.56.
Fri Jun 16 17:09:53 2023 - [info] Checking recovery script configurations on 192.168.1.139(192.168.1.139:3306)..
Fri Jun 16 17:09:53 2023 - [info]   Executing command: save_binary_logs --command=test --start_pos=4 --binlog_dir=/var/lib/mysql,/var/log/mysql --output_file=/mydata/mha_master/app1/save_binary_logs_test --manager_version=0.56 --start_file=master-log.000003 
Fri Jun 16 17:09:53 2023 - [info]   Connecting to root@192.168.1.139(192.168.1.139:22).. 
  Creating /mydata/mha_master/app1 if not exists.. Creating directory /mydata/mha_master/app1.. done.
   ok.
  Checking output directory is accessible or not..
   ok.
  Binlog found at /var/lib/mysql, up to master-log.000003
Fri Jun 16 17:09:53 2023 - [info] Binlog setting check done.
Fri Jun 16 17:09:53 2023 - [info] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers..
Fri Jun 16 17:09:53 2023 - [info]   Executing command : apply_diff_relay_logs --command=test --slave_user='mha' --slave_host=192.168.1.129 --slave_ip=192.168.1.129 --slave_port=3306 --workdir=/mydata/mha_master/app1 --target_version=5.5.68-MariaDB --manager_version=0.56 --relay_log_info=/var/lib/mysql/relay-log.info  --relay_dir=/var/lib/mysql/  --slave_pass=xxx
Fri Jun 16 17:09:53 2023 - [info]   Connecting to root@192.168.1.129(192.168.1.129:22).. 
Creating directory /mydata/mha_master/app1.. done.
  Checking slave recovery environment settings..
    Opening /var/lib/mysql/relay-log.info ... ok.
    Relay log found at /var/lib/mysql, up to relay-log.000002
    Temporary relay log file is /var/lib/mysql/relay-log.000002
    Testing mysql connection and privileges.. done.
    Testing mysqlbinlog output.. done.
    Cleaning up test file(s).. done.
Fri Jun 16 17:09:53 2023 - [info]   Executing command : apply_diff_relay_logs --command=test --slave_user='mha' --slave_host=192.168.1.127 --slave_ip=192.168.1.127 --slave_port=3306 --workdir=/mydata/mha_master/app1 --target_version=5.5.68-MariaDB --manager_version=0.56 --relay_log_info=/var/lib/mysql/relay-log.info  --relay_dir=/var/lib/mysql/  --slave_pass=xxx
Fri Jun 16 17:09:53 2023 - [info]   Connecting to root@192.168.1.127(192.168.1.127:22).. 
Creating directory /mydata/mha_master/app1.. done.
  Checking slave recovery environment settings..
    Opening /var/lib/mysql/relay-log.info ... ok.
    Relay log found at /var/lib/mysql, up to relay-log.000002
    Temporary relay log file is /var/lib/mysql/relay-log.000002
    Testing mysql connection and privileges.. done.
    Testing mysqlbinlog output.. done.
    Cleaning up test file(s).. done.
Fri Jun 16 17:09:54 2023 - [info] Slaves settings check done.
Fri Jun 16 17:09:54 2023 - [info] 
192.168.1.139(192.168.1.139:3306) (current master)
 +--192.168.1.129(192.168.1.129:3306)
 +--192.168.1.127(192.168.1.127:3306)

Fri Jun 16 17:09:54 2023 - [info] Checking replication health on 192.168.1.129..
Fri Jun 16 17:09:54 2023 - [info]  ok.
Fri Jun 16 17:09:54 2023 - [info] Checking replication health on 192.168.1.127..
Fri Jun 16 17:09:54 2023 - [info]  ok.
Fri Jun 16 17:09:54 2023 - [warning] master_ip_failover_script is not defined.
Fri Jun 16 17:09:54 2023 - [warning] shutdown_script is not defined.
Fri Jun 16 17:09:54 2023 - [info] Got exit code 0 (Not master dead).

MySQL Replication Health is OK.

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

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

相关文章

C51/C52--LCD1602

目录 一、LCD1602简介 二、LCD1602的工作(显示)原理 三、技术参数 四、外形参数,引脚功能 五、连接方式 六、示例程序与结果 一、LCD1602简介 LCD1602液晶显示器是广泛使用的一种字符型液晶显示模块。它是由字符型液晶显示屏&#xff0…

chatgpt赋能python:如何使用Python找出重复元素

如何使用Python找出重复元素 在Python编程中,有时候需要查找并删除重复的元素。这些元素可以是列表、字符串等数据类型。在本文中,将介绍如何使用Python查找并删除重复元素。以下是我们将要涉及到的一些主题: 为什么需要查找重复元素&#…

深挖面试题讲解

面试题讲解🍴 文章目录 面试题讲解🍴和equals()的区别🍔1️⃣注意事项2️⃣明确问题3️⃣总结 什么是HashCode🍇1️⃣HashCode的描述2️⃣常见误区3️⃣hashCode的作用4️⃣总结 String、StringBuffer、StringBuilder的区别&#…

chatgpt赋能python:Python编程:如何找出给定的n个数中的最大值及其对应的最小下标

Python编程:如何找出给定的n个数中的最大值及其对应的最小下标 当需要在一组数字中找到最大值时,Python提供了内置函数 max() 。 但是,如果我们需要找出最大值的同时还需要找出其最小下标,该怎么办呢? 在本文中&#…

初始化命令

创建项目 vue2 vue3 create demo vue3 vue3 create demo vue2 webpack vue2 init webpack demo vue3 vite yarn create vite demo --template vue sass cnpm下载 --save-dev -D 开发环境 --save -S 生产环境 cnpm i node-sass4.14.1 sass-loader7.3.1 --save-…

[架构之路-215]- 架构 - 概念架构 - 模块(Module)、组件(Component)、包(Package)、对象、函数的区别

前言: 在软件架构中,一个重要的任务就是切分系统,而切分系统进程涉及到一个基本的概念,如模块(Module)、组件(Component)、包(Package)、对象,本…

管理类联考——写作——技巧篇——论证有效性——谬误概念汇总简释

批判性思维常见逻辑谬误 有些错误出现在我们澄清或定义某个观点的时候,有些错误出现在我们收集证据或者用证据和理由支撑某个观点的时候,有些错误出现在我们尝试从证据得出结论的时候,有些错误甚至出现在我们评估他人的观点或者理由的时候。…

美味度配方

8 种配料每种配料可以放 1 到 5 克,美味度为配料质量之和,给定一个美味度 n,求解 8 种配料的所有搭配方案及方案数量 。 (本笔记适合学了 Python 循环,正在熟炼的 coder 翻阅) 【学习的细节是欢悦的历程】 Python 官网&#xff1a…

chatgpt赋能python:把图像放在中间的SEO优化指南

把图像放在中间的SEO优化指南 当我们在设计网站或博客时,经常会使用图像来增加文章的吸引力和清晰度。但是,图像的位置对于搜索引擎优化(SEO)很重要,因为搜索引擎无法理解和索引图像的内容,所以我们需要通…

chatgpt赋能python:Python抢商品:自动化实现秒杀购物的利器

Python抢商品:自动化实现秒杀购物的利器 随着互联网和电商的高度融合,电商平台受到越来越多的用户关注和青睐。在线购物已成为人们日常生活中必不可少的一部分,不管是网购小白还是技术大牛,都喜欢在各种平台上刷到想要的商品。但…

chatgpt赋能python:让Python帮助你轻松抢券

让Python帮助你轻松抢券 在这个数字化时代,抢购已成为电商平台上最为火热的活动之一。限时抢购、秒杀活动、优惠券折扣等等,都吸引了大量消费者的关注。然而,随着购物热潮的兴起,商品的库存有限,抢购难度越来越大。在…

高效能研发团队-使用自动化改进效率

在开发过程中利用自动化技术,可以帮助我们: 节约开发人员的时间,让他们做更有价值的事情。减少了开发流程中的人员依赖和相互等待的情况。加快了迭代速度,提前把问题暴露出来。另外一种形式的知识沉淀,减少人员流动带…

【学习日记2023.6.19】 之 RabbitMQ服务异步通信_消息可靠性_死信交换机_惰性队列_MQ集群

文章目录 服务异步通信-高级篇4. 消息可靠性4.1 生产者消息确认4.1.1 修改配置4.1.2 定义Return回调4.1.3 定义ConfirmCallback 4.2 消息持久化4.2.1 交换机持久化4.2.2 队列持久化4.2.3 消息持久化 4.3 消费者消息确认4.3.1 演示none模式4.3.2 演示auto模式 4.4 消费失败重试机…

第六章 calendar模块(日历)

1. calendar模块介绍 calendar 模块(日历模块)的方法都是与日历相关的,例如生成指定年份的日历、判断指定年份是否为闰年等。默认情况下,这些日历把星期一当作一周的第一天,星期天为一周的最后一天(按照欧…

【前端知识】React 基础巩固(十六)——脚手架的介绍和环境搭建

React 基础巩固(十六)——脚手架的介绍和环境搭建 前端脚手架 三大框架的脚手架 Vue: vue/cliAngular: angular/cliReact: create-react-app 作用:帮助我们生成一个通用的目录结构,并且已经将我们所需的工程环境配置好脚手架需要依赖什么? …

Win11 + VS2022 + CMake3. 26.4 编译VTK8.2.0

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录 前言一、下载VTK源码二、生成解决方案三、编译安装VTK项目四、报错总结 前言 最近由于有项目要用到VTK,所以想重新学一遍VTK。当然要从编译VTK开始。因…

【pytorch】新的windows电脑从头搭建pytorch深度学习环境(完整版+附安装包)

文章目录 新的windows电脑搭建pytorch深度学习环境电脑环境的配置显卡驱动cudacudnn pytorch开发软件的安装minicondavscode pytorch环境的安装conda安装python环境安装pytorch和torchvision 附录1:部分torch、torchvision、torchaudio版本对应关系附录2&#xff1a…

chatgpt赋能python:Python抢票教程:快速抢到心仪的票

Python抢票教程:快速抢到心仪的票 随着互联网的飞速发展,越来越多人选择在网上购买演唱会、球赛、展览等门票,而这些热门票常常被秒杀一空,可怎么办呢?Python帮你解决这个问题! 什么是Python抢票 Python…

JUC之CompletableFuture

文章目录 1 Future接口1.1 FutureTask相关接口关系1.2 Future接口的优缺点1.2.1 优点1.2.2 缺点 2 Complatable Future2.1 CompletionStage2.2 使用案例2.2.1 runAsync2.2.2 supplyAsync2.2.3 join和get的区别2.2.4 CF simple project使用案例2.2.5 CF 常用API2.2.5.1 获取结果…

chatgpt赋能python:Python中将局部变量赋值给全局变量的方法

Python中将局部变量赋值给全局变量的方法 Python是一种灵活、高效的编程语言,许多开发人员喜欢使用这种语言来开发应用程序。在Python中,我们可以定义全局变量和局部变量。全局变量是定义在整个程序中的变量,而局部变量是定义在函数中的变量…