Mysql高级——Mysql8一主一从,多主多从搭建

修改 /etc/hosts文件

ip地址 master1
ip地址 master2
ip地址 slave1
ip地址 slave2

一主一从

create database master1db;create table master1db.master1tab(name char(50));insert into master1db.master1tab VALUES(1111);insert into master1db.master1tab VALUES(2222);

master1 日志

[root@localhost opt]# vim /etc/my.cnf
[root@localhost opt]# cat /etc/my.cnf[mysqld]datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.socklog-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
log_bin
server-id=1
systemctl restart mysqld

创建用户

create user 'rep'@'192.168.18.%' identified by '123321zk';
grant replication slave,replication client on *.* to 'rep'@'192.168.18.%';alter user 'rep'@'192.168.18.%' identified with  mysql_native_password  by '123321zk';

master1上备份数据库

[root@localhost opt]# mysqldump -uroot -p'123321zk' --all-databases --single-transaction --master-data=2 --flush-logs > `date +%F`-mysql-all.sql[root@localhost opt]# ls
2023-10-12                                              mysql-community-common-8.0.25-1.el7.x86_64.rpm
2023-10-12-mysql-all.sql                                mysql-community-libs-8.0.25-1.el7.x86_64.rpm
mysql-community-client-8.0.25-1.el7.x86_64.rpm          mysql-community-server-8.0.25-1.el7.x86_64.rpm
mysql-community-client-plugins-8.0.25-1.el7.x86_64.rpm  rh

从机master2登录

[root@localhost opt]# mysql -urep -p'123321zk' -h master1;
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 8.0.25 MySQL Community Server - GPLCopyright (c) 2000, 2021, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> 

修改master2的配置文件

[root@localhost opt]# vim /etc/my.cnf
[root@localhost opt]# cat /etc/my.cnf[mysqld]datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.socklog-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
server-id=2
systemctl restart mysqld

master2用root登录

[root@localhost opt]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.25 MySQL Community Server - GPLCopyright (c) 2000, 2021, Oracle and/or its affiliates.Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> 

手动同步数据

复制master1的sql文件到matser2上

[root@localhost opt]# scp 2023-10-12-mysql-all.sql  master2:/opt
The authenticity of host 'master2 (192.168.18.131)' can't be established.
ECDSA key fingerprint is 83:bc:ac:37:44:8d:ea:4f:c7:c5:f7:2b:c5:0c:ee:b4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'master2,192.168.18.131' (ECDSA) to the list of known hosts.
root@master2's password: 
2023-10-12-mysql-all.sql                                                                     100% 1190KB   1.2MB/s   00:00    
[root@localhost opt]# 

master2查看

[root@localhost opt]# ls
2023-10-12-mysql-all.sql                                mysql-community-common-8.0.25-1.el7.x86_64.rpm  rh
mysql-community-client-8.0.25-1.el7.x86_64.rpm          mysql-community-libs-8.0.25-1.el7.x86_64.rpm
mysql-community-client-plugins-8.0.25-1.el7.x86_64.rpm  mysql-community-server-8.0.25-1.el7.x86_64.rpm

master2上root用户执行

mysql> source /opt/2023-10-12-mysql-all.sql;
Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)Query OK, 0 rows affected (0.00 sec)
.....# 查询成功!
mysql> select * from master1db.master1tab;
+------+
| name |
+------+
| 1111 |
| 2222 |
+------+
2 rows in set (0.00 sec)

配置日志偏移量

mysql> change master to master_host='master1',master_user='rep',master_password='123321zk',master_log_file='localhost-bin.000002',master_log_pos=156;
Query OK, 0 rows affected, 8 warnings (0.05 sec)

启动从机master2

mysql> start slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)

master1查看偏移量

mysql> show master status;
+----------------------+----------+--------------+------------------+-------------------+
| File                 | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+----------------------+----------+--------------+------------------+-------------------+
| localhost-bin.000002 |      448 |              |                  |                   |
+----------------------+----------+--------------+------------------+-------------------+
1 row in set (0.00 sec)

master2更新偏移量

mysql> change master to master_host='master1',master_user='rep',master_password='123321zk',master_log_file='localhost-bin.000002',master_log_pos=448;
Query OK, 0 rows affected, 8 warnings (0.05 sec)mysql> start slave;
Query OK, 0 rows affected, 1 warning (0.12 sec)mysql> show slave status\G;
*************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: master1Master_User: repMaster_Port: 3306Connect_Retry: 60Master_Log_File: localhost-bin.000002Read_Master_Log_Pos: 448Relay_Log_File: localhost-relay-bin.000002Relay_Log_Pos: 328Relay_Master_Log_File: localhost-bin.000002Slave_IO_Running: YesSlave_SQL_Running: YesReplicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0Last_Error: Skip_Counter: 0Exec_Master_Log_Pos: 448Relay_Log_Space: 541Until_Condition: NoneUntil_Log_File: Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: NoLast_IO_Errno: 0Last_IO_Error: Last_SQL_Errno: 0Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 1Master_UUID: d4996f86-68fd-11ee-ae55-000c29980ceaMaster_Info_File: mysql.slave_master_infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Slave has read all relay log; waiting for more updatesMaster_Retry_Count: 86400Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: Master_public_key_path: Get_master_public_key: 0Network_Namespace: 
1 row in set, 1 warning (0.00 sec)ERROR: 
No query specifiedmysql> 

双主双从

修改master1的配置文件

[root@localhost ~]# vim /etc/my.cnf[mysqld]datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.socklog-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pidlog-bin=/var/lib/mysql/binlog
server-id=1
# 跳过不备份数据库
binlog-ignore-db=mysql
binlog-ignore-db=information_schema
# 数据库
binlog-do-db=mydb2
# 日志格式
binlog_format=statement
# 过期时间
expire_logs_days=7
slave_skip_errors=1062
# 作为从数据库 写入操作也要更新二进制文件
log-slave-updates
# 标识自增长字段每次递增的量 就是步长
auto-increment-increment=2
# 表示自增从哪个数开始
auto-increment-offset=1

重启master1数据库

systemctl restart mysqld

修改master2配置文件

[root@localhost ~]# cat /etc/my.cnf[mysqld]datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.socklog-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pidlog-bin=/var/lib/mysql/binlog
server-id=3
# 跳过不备份数据库
binlog-ignore-db=mysql
binlog-ignore-db=information_schema
# 数据库
binlog-do-db=mydb2
# 日志格式
binlog_format=statement
# 过期时间
expire_logs_days=7
slave_skip_errors=1062
# 作为从数据库 写入操作也要更新二进制文件
log-slave-updates
# 标识自增长字段每次递增的量 就是步长
auto-increment-increment=2
# 表示自增从哪个数开始
auto-increment-offset=2
systemctl restart mysqld

更改slave1配置文件

[root@localhost ~]# cat /etc/my.cnf[mysqld]datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.socklog-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid# 服务id
server-id=2
# 启用中继日志
relay-log=mysql-relay

更改slave2配置文件

[mysqld]datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.socklog-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid# 服务id
server-id=4
# 启用中继日志
relay-log=mysql-relay

分别重启slave1和slave2

systemctl restart mysqld

master1,master2配置 创建用户并授权 两个主数据库都要创

mysql> CREATE USER 'repl_user'@'%' IDENTIFIED WITH mysql_native_password BY '123321zk';
Query OK, 0 rows affected (0.01 sec)mysql> CREATE USER 'slave_sync_user'@'%' IDENTIFIED WITH mysql_native_password BY '123321zk';
Query OK, 0 rows affected (0.00 sec)mysql> GRANT REPLICATION SLAVE ON *.* TO 'repl_user'@'%';
Query OK, 0 rows affected (0.00 sec)mysql> GRANT REPLICATION SLAVE ON *.* TO 'slave_sync_user'@'%';
Query OK, 0 rows affected (0.01 sec)

在这里插入图片描述

主1从1

查看master1的偏移量

mysql> show master status;
+---------------+----------+--------------+--------------------------+-------------------+
| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB         | Executed_Gtid_Set |
+---------------+----------+--------------+--------------------------+-------------------+
| binlog.000003 |     1198 | mydb2        | mysql,information_schema |                   |
+---------------+----------+--------------+--------------------------+-------------------+
1 row in set (0.00 sec)

修改slave1 配置主master1从关系

mysql> change master to master_host='master1',master_user='slave_sync_user',master_password='123321zk',master_log_file='binlog.000003',master_log_pos=1198;
Query OK, 0 rows affected, 8 warnings (0.51 sec)

启动slave1

mysql> start slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> show slave status\G;
*************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: master1Master_User: slave_sync_userMaster_Port: 3306Connect_Retry: 60Master_Log_File: binlog.000003Read_Master_Log_Pos: 1198Relay_Log_File: mysql-relay.000002Relay_Log_Pos: 321Relay_Master_Log_File: binlog.000003Slave_IO_Running: YesSlave_SQL_Running: YesReplicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0Last_Error: Skip_Counter: 0Exec_Master_Log_Pos: 1198Relay_Log_Space: 526Until_Condition: NoneUntil_Log_File: Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: NoLast_IO_Errno: 0Last_IO_Error: Last_SQL_Errno: 0Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 1Master_UUID: d4996f86-68fd-11ee-ae55-000c29980ceaMaster_Info_File: mysql.slave_master_infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Slave has read all relay log; waiting for more updatesMaster_Retry_Count: 86400Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: Master_public_key_path: Get_master_public_key: 0Network_Namespace: 
1 row in set, 1 warning (0.00 sec)
主2从2

主2msql 作为主服务器

从2mysql作为从服务器

查看master2状态

mysql> show master status;
+---------------+----------+--------------+--------------------------+-------------------+
| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB         | Executed_Gtid_Set |
+---------------+----------+--------------+--------------------------+-------------------+
| binlog.000002 |     1654 | mydb2        | mysql,information_schema |                   |
+---------------+----------+--------------+--------------------------+-------------------+
1 row in set (0.00 sec)

修改slave2 配置主master2从关系

mysql> change master to master_host='master2',master_user='slave_sync_user',master_password='123321zk',master_log_file='binlog.000002',master_log_pos=1654;
Query OK, 0 rows affected, 8 warnings (0.51 sec)

启动slave2

mysql> start slave;
Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> show slave status\G;
*************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: master2Master_User: slave_sync_userMaster_Port: 3306Connect_Retry: 60Master_Log_File: binlog.000002Read_Master_Log_Pos: 1654Relay_Log_File: mysql-relay.000002Relay_Log_Pos: 321Relay_Master_Log_File: binlog.000002Slave_IO_Running: YesSlave_SQL_Running: YesReplicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0Last_Error: Skip_Counter: 0Exec_Master_Log_Pos: 1654Relay_Log_Space: 526Until_Condition: NoneUntil_Log_File: Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: NoLast_IO_Errno: 0Last_IO_Error: Last_SQL_Errno: 0Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 3Master_UUID: d5b21ed3-68fd-11ee-b692-000c29dadb21Master_Info_File: mysql.slave_master_infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Slave has read all relay log; waiting for more updatesMaster_Retry_Count: 86400Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: Master_public_key_path: Get_master_public_key: 0Network_Namespace: 
1 row in set, 1 warning (0.01 sec)
主1主2

修改master2 从master1

mysql> change master to master_host='master1',master_user='repl_user',master_password='123321zk',master_log_file='binlog.000003',master_log_pos=1198;
Query OK, 0 rows affected, 8 warnings (0.73 sec)mysql> start slave;
Query OK, 0 rows affected, 1 warning (0.02 sec)mysql> show slave status\G;
*************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: master1Master_User: repl_userMaster_Port: 3306Connect_Retry: 60Master_Log_File: binlog.000003Read_Master_Log_Pos: 1198Relay_Log_File: localhost-relay-bin.000002Relay_Log_Pos: 321Relay_Master_Log_File: binlog.000003Slave_IO_Running: YesSlave_SQL_Running: YesReplicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0Last_Error: Skip_Counter: 0Exec_Master_Log_Pos: 1198Relay_Log_Space: 534Until_Condition: NoneUntil_Log_File: Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: NoLast_IO_Errno: 0Last_IO_Error: Last_SQL_Errno: 0Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 1Master_UUID: d4996f86-68fd-11ee-ae55-000c29980ceaMaster_Info_File: mysql.slave_master_infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Slave has read all relay log; waiting for more updatesMaster_Retry_Count: 86400Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: Master_public_key_path: Get_master_public_key: 0Network_Namespace: 
1 row in set, 1 warning (0.00 sec)
主2主1

修改master1 从master2

master2查看

mysql> show master status;
+---------------+----------+--------------+--------------------------+-------------------+
| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB         | Executed_Gtid_Set |
+---------------+----------+--------------+--------------------------+-------------------+
| binlog.000002 |     1654 | mydb2        | mysql,information_schema |                   |
+---------------+----------+--------------+--------------------------+-------------------+
1 row in set (0.00 sec)

修改master1 从master2

mysql> change master to master_host='master2',master_user='repl_user',master_password='123321zk',master_log_file='binlog.000002',master_log_pos=1654;
Query OK, 0 rows affected, 8 warnings (0.12 sec)mysql> start slave;
Query OK, 0 rows affected, 1 warning (0.01 sec)mysql> show slave status\G;
*************************** 1. row ***************************Slave_IO_State: Waiting for master to send eventMaster_Host: master2Master_User: repl_userMaster_Port: 3306Connect_Retry: 60Master_Log_File: binlog.000002Read_Master_Log_Pos: 1654Relay_Log_File: localhost-relay-bin.000002Relay_Log_Pos: 321Relay_Master_Log_File: binlog.000002Slave_IO_Running: YesSlave_SQL_Running: YesReplicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: Last_Errno: 0Last_Error: Skip_Counter: 0Exec_Master_Log_Pos: 1654Relay_Log_Space: 534Until_Condition: NoneUntil_Log_File: Until_Log_Pos: 0Master_SSL_Allowed: NoMaster_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: NoLast_IO_Errno: 0Last_IO_Error: Last_SQL_Errno: 0Last_SQL_Error: Replicate_Ignore_Server_Ids: Master_Server_Id: 3Master_UUID: d5b21ed3-68fd-11ee-b692-000c29dadb21Master_Info_File: mysql.slave_master_infoSQL_Delay: 0SQL_Remaining_Delay: NULLSlave_SQL_Running_State: Slave has read all relay log; waiting for more updatesMaster_Retry_Count: 86400Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0Replicate_Rewrite_DB: Channel_Name: Master_TLS_Version: Master_public_key_path: Get_master_public_key: 0Network_Namespace: 
1 row in set, 1 warning (0.00 sec)

在master1上创建数据库

CREATE DATABASE mydb2;
CREATE TABLE mydb2.books (
id INT PRIMARY KEY auto_increment,
name VARCHAR ( 50 ));
INSERT INTO mydb2.books ( NAME )
VALUES
( 'test mysql' );

查看其余数据库是否同步

全部同步成功

在这里插入图片描述

解决问题参考链接

主从同步报错Last_IO_Error: error connecting to master ‘use@192.XXXX‘ - retry-time: 60 retries: 86400解决办法。-CSDN博客

MySQL主从复制报错:Got fatal error 1236 from master when reading data from-CSDN博客

解决mysql8.0主从配置,从库连接报错:Authentication plugin ‘caching_sha2_password‘ reported error_authentication plugin’caching-CSDN博客

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

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

相关文章

Linux命令--mkdir创建目录的方法

原文网址&#xff1a;Linux命令--mkdir创建目录的方法_IT利刃出鞘的博客-CSDN博客 简介 本文介绍Linux创建目录命令--mkdir的用法。 格式 mkdir [选项] 目录… -m, –mode模式&#xff0c;设定权限<模式> (类似 chmod)&#xff0c;而不是 rwxrwxrwx 减 umask-p, --p…

按键开发环境搭建

雷电模拟器 创建虚拟机 2.设置root权限 打开按键精灵连接虚拟机 开启悬浮 mumu模拟器操作 查找端口方法 adb connect 127.0.0.1:16416 设置-应用-所有应用-按键精灵-开启悬浮 步骤二&#xff1a;开启root 处理未root&#xff1a;中途如果有如下未root的情况&#x…

基于SSM的网吧计费管理系统(有报告)。Javaee项目,ssm项目。

演示视频&#xff1a; 基于SSM的网吧计费管理系统&#xff08;有报告&#xff09;。Javaee项目&#xff0c;ssm项目。 项目介绍&#xff1a; 采用M&#xff08;model&#xff09;V&#xff08;view&#xff09;C&#xff08;controller&#xff09;三层体系结构&#xff0c;通…

Monarch Mixer:一种性能比Transformer更强的网络架构

六年前&#xff0c;谷歌团队在arXiv上发表了革命性的论文《Attention is all you need》。作为一种优势的机器学习网络架构&#xff0c;Transformer技术迅速席卷全球。Transformer一直是现代基础模型背后的主力架构&#xff0c;并且在不同的应用程序中取得了令人印象深刻的成功…

OCS2工具箱

实时系统优化控制工具箱 参考视频&#xff1a;ETH 最优控制/MPC 实时求解器 OCS2 使用入门 参考文档&#xff1a;OCS2 求解器入门 选择OCS2 OCS2 是一个 MPC 实时求解器 (SLQ/iLQR)&#xff0c;依赖 Pinocchio 构建机器人动力学模型&#xff0c;采用 RViz 或者 RaiSim 验证 (…

[LeetCode] 2.两数相加

一、题目描述 给你两个 非空 的链表&#xff0c;表示两个非负的整数。它们每位数字都是按照 逆序 的方式存储的&#xff0c;并且每个节点只能存储 一位 数字。 请你将两个数相加&#xff0c;并以相同形式返回一个表示和的链表。 你可以假设除了数字 0 之外&#xff0c;这两个…

【前端笔记】ant-design-vue 3.x使用modal.method()自定义content内容小记

在一次编写业务代码时&#xff0c;碰到了一种既想要Modal.success样式&#xff0c;有想要定制其content内容的情况。 大部分情况下&#xff0c;使用Modal.method()这种方式时&#xff0c;可能content内容固定都是字符串&#xff0c;那如果想要做更高级的交互怎么办&#xff1f…

1.计算机系统概述

目录 一. 计算机的发展 二. 计算机硬件的基本组成 三. 各个硬件的工作原理 &#xff08;1&#xff09;主存储器 &#xff08;2&#xff09;运算器 &#xff08;3&#xff09;控制器 &#xff08;4&#xff09;一个例子 四. 计算机系统的层次结构 五. 计算机的性能指标…

【Mysql】Mysql中表连接的原理

连接简介 在实际工作中&#xff0c;我们需要查询的数据很可能不是放在一张表中&#xff0c;而是需要同时从多张表中获取。下面我们以简单的两张表为例来进行说明。 连接的本质 为方便测试说明&#xff0c;&#xff0c;先创建两个简单的表并给它们填充一点数据&#xff1a; …

SpringBoot项目从resources目录读取文件

SpringBoot 从 resources 读取文件 使用 Spring 给我们提供的工具类来进行读取 File file org.springframework.util.ResourceUtils.getFile("classpath:人物模板.docx");可能读取失败&#xff0c;出现如下错误&#xff1a; java.io.FileNotFoundException: clas…

C语言实现九九乘法表

学习C语言后&#xff0c;我们会发现打印九九乘法表是很简单的&#xff0c;话不多说&#xff0c;我们上代码&#xff01; 目录 1.函数代码 2.运行结果 1.函数代码 #define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> int main() {int i 1;int j 1;int n 0;//行数in…

Instant-NGP论文笔记

文章目录 论文笔记 论文笔记 instant-ngp的nerf模型与vanilla nerf的模型架构相同。 instant-ngp的nerf模型包含两个MLP&#xff0c;第一个MLP就两个全连接&#xff0c;输入维度是32&#xff08;16层分辨率x2&#xff09;&#xff0c;输出是16&#xff08;用于预测密度&#x…

【LeetCode每日一题合集】2023.9.18-2023.9.24(⭐拓扑排序⭐设计数据结构:LRU缓存实现 LinkedHashMap⭐)

文章目录 337. 打家劫舍 III&#xff08;树形DP&#xff09;2560. 打家劫舍 IV&#xff08;二分查找动态规划&#xff09;LCP 06. 拿硬币&#xff08;简单贪心模拟&#xff09;2603. 收集树中金币⭐思路——拓扑排序删边 2591. 将钱分给最多的儿童&#xff08;分类讨论&#xf…

记一次pdjs时安装glob出现,npm ERR! code ETARGET和npm ERR! code ELIFECYCLE

如往常一样&#xff0c;我使用pdjs来编译proto文件&#xff0c;但出现了以下报错&#xff1a; 大致就是pdjs的util在尝试执行npm install glob^7.2.1 escodegen^1.13.0时出错了 尝试手动执行安装&#xff0c;escodegen被正确安装&#xff0c;但glob^7.2.1出错 npm ERR! code E…

Redis那些事儿(三)

文章目录 1. 前言2. 常用api介绍3. 需求假设&#xff08;获取离我最近的停车场&#xff09;4. 代码示例 1. 前言 接着上一篇Redis那些事儿&#xff08;二&#xff09; &#xff0c;这一篇主要介绍Redis基于Geo数据结构实现的地理服务&#xff0c;它提供了一种方便的方式来存储和…

库房管理软件采购申请流程代码实现解析

300rmb掏了个javavue2的小系统&#xff0c;学习代码&#xff0c;调整下申请流程。 原有的入库流程是&#xff0c;库管&#xff08;admin&#xff09;提出采购申请给采购员&#xff08;caigou&#xff09;&#xff0c;采购员采购入库时点击入库完成采购入库流程。 想弄清后端代…

非关系型数据库Redis的安装【Linux】及常用命令

前言 Redis&#xff08;Remote Dictionary Server&#xff09;是一种开源的内存数据库管理系统&#xff0c;它以键值存储方式来存储数据&#xff0c;并且支持多种数据结构&#xff0c;如字符串、哈希、列表、集合、有序集合等。Redis最初由Salvatore Sanfilippo开发&#xff0c…

数据分析实战 | 关联规则分析——购物车分析

目录 一、数据及分析对象 二、目的及分析任务 三、方法及工具 四、数据读入 五、数据理解 六、数据预处理 七、生成频繁项集 八、计算关联度 九、可视化 一、数据及分析对象 数据集链接&#xff1a;Online Retail.xlsx 该数据集记录了2010年12月01日至2011年12月09日…

性能优于BERT的FLAIR:一篇文章入门Flair模型

文章目录 What is FLAIR&#xff1f;FLAIR ModelContextual String Embedding for Sequence Labelingexample FLAIR Application AreaSentiment AnalysisNamed Entity RecognitionText Classification FLAIR一、什么是FLAIR&#xff1f;二、FLAIR Library的优势是什么&#xff…

突破性技术!开源多模态模型—MiniGPT-5

多模态生成一直是OpenAI、微软、百度等科技巨头的重要研究领域&#xff0c;但如何实现连贯的文本和相关图像是一个棘手的难题。 为了突破技术瓶颈&#xff0c;加州大学圣克鲁斯分校研发了MiniGPT-5模型&#xff0c;并提出了全新技术概念“Generative Vokens "&#xff0c…