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

news2024/11/26 8:16:48

修改 /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.sock

log-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 - GPL

Copyright (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.sock

log-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 - GPL

Copyright (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 event
                  Master_Host: master1
                  Master_User: rep
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: localhost-bin.000002
          Read_Master_Log_Pos: 448
               Relay_Log_File: localhost-relay-bin.000002
                Relay_Log_Pos: 328
        Relay_Master_Log_File: localhost-bin.000002
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 0
                   Last_Error: 
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 448
              Relay_Log_Space: 541
              Until_Condition: None
               Until_Log_File: 
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_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: No
                Last_IO_Errno: 0
                Last_IO_Error: 
               Last_SQL_Errno: 0
               Last_SQL_Error: 
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 1
                  Master_UUID: d4996f86-68fd-11ee-ae55-000c29980cea
             Master_Info_File: mysql.slave_master_info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
           Master_Retry_Count: 86400
                  Master_Bind: 
      Last_IO_Error_Timestamp: 
     Last_SQL_Error_Timestamp: 
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
           Retrieved_Gtid_Set: 
            Executed_Gtid_Set: 
                Auto_Position: 0
         Replicate_Rewrite_DB: 
                 Channel_Name: 
           Master_TLS_Version: 
       Master_public_key_path: 
        Get_master_public_key: 0
            Network_Namespace: 
1 row in set, 1 warning (0.00 sec)

ERROR: 
No query specified

mysql> 

双主双从

修改master1的配置文件

[root@localhost ~]# vim /etc/my.cnf

[mysqld]

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

log-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.sock

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

log-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.sock

log-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.sock

log-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 event
                  Master_Host: master1
                  Master_User: slave_sync_user
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: binlog.000003
          Read_Master_Log_Pos: 1198
               Relay_Log_File: mysql-relay.000002
                Relay_Log_Pos: 321
        Relay_Master_Log_File: binlog.000003
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 0
                   Last_Error: 
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 1198
              Relay_Log_Space: 526
              Until_Condition: None
               Until_Log_File: 
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_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: No
                Last_IO_Errno: 0
                Last_IO_Error: 
               Last_SQL_Errno: 0
               Last_SQL_Error: 
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 1
                  Master_UUID: d4996f86-68fd-11ee-ae55-000c29980cea
             Master_Info_File: mysql.slave_master_info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
           Master_Retry_Count: 86400
                  Master_Bind: 
      Last_IO_Error_Timestamp: 
     Last_SQL_Error_Timestamp: 
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
           Retrieved_Gtid_Set: 
            Executed_Gtid_Set: 
                Auto_Position: 0
         Replicate_Rewrite_DB: 
                 Channel_Name: 
           Master_TLS_Version: 
       Master_public_key_path: 
        Get_master_public_key: 0
            Network_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 event
                  Master_Host: master2
                  Master_User: slave_sync_user
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: binlog.000002
          Read_Master_Log_Pos: 1654
               Relay_Log_File: mysql-relay.000002
                Relay_Log_Pos: 321
        Relay_Master_Log_File: binlog.000002
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 0
                   Last_Error: 
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 1654
              Relay_Log_Space: 526
              Until_Condition: None
               Until_Log_File: 
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_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: No
                Last_IO_Errno: 0
                Last_IO_Error: 
               Last_SQL_Errno: 0
               Last_SQL_Error: 
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 3
                  Master_UUID: d5b21ed3-68fd-11ee-b692-000c29dadb21
             Master_Info_File: mysql.slave_master_info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
           Master_Retry_Count: 86400
                  Master_Bind: 
      Last_IO_Error_Timestamp: 
     Last_SQL_Error_Timestamp: 
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
           Retrieved_Gtid_Set: 
            Executed_Gtid_Set: 
                Auto_Position: 0
         Replicate_Rewrite_DB: 
                 Channel_Name: 
           Master_TLS_Version: 
       Master_public_key_path: 
        Get_master_public_key: 0
            Network_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 event
                  Master_Host: master1
                  Master_User: repl_user
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: binlog.000003
          Read_Master_Log_Pos: 1198
               Relay_Log_File: localhost-relay-bin.000002
                Relay_Log_Pos: 321
        Relay_Master_Log_File: binlog.000003
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 0
                   Last_Error: 
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 1198
              Relay_Log_Space: 534
              Until_Condition: None
               Until_Log_File: 
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_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: No
                Last_IO_Errno: 0
                Last_IO_Error: 
               Last_SQL_Errno: 0
               Last_SQL_Error: 
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 1
                  Master_UUID: d4996f86-68fd-11ee-ae55-000c29980cea
             Master_Info_File: mysql.slave_master_info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
           Master_Retry_Count: 86400
                  Master_Bind: 
      Last_IO_Error_Timestamp: 
     Last_SQL_Error_Timestamp: 
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
           Retrieved_Gtid_Set: 
            Executed_Gtid_Set: 
                Auto_Position: 0
         Replicate_Rewrite_DB: 
                 Channel_Name: 
           Master_TLS_Version: 
       Master_public_key_path: 
        Get_master_public_key: 0
            Network_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 event
                  Master_Host: master2
                  Master_User: repl_user
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: binlog.000002
          Read_Master_Log_Pos: 1654
               Relay_Log_File: localhost-relay-bin.000002
                Relay_Log_Pos: 321
        Relay_Master_Log_File: binlog.000002
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 0
                   Last_Error: 
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 1654
              Relay_Log_Space: 534
              Until_Condition: None
               Until_Log_File: 
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_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: No
                Last_IO_Errno: 0
                Last_IO_Error: 
               Last_SQL_Errno: 0
               Last_SQL_Error: 
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 3
                  Master_UUID: d5b21ed3-68fd-11ee-b692-000c29dadb21
             Master_Info_File: mysql.slave_master_info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
           Master_Retry_Count: 86400
                  Master_Bind: 
      Last_IO_Error_Timestamp: 
     Last_SQL_Error_Timestamp: 
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
           Retrieved_Gtid_Set: 
            Executed_Gtid_Set: 
                Auto_Position: 0
         Replicate_Rewrite_DB: 
                 Channel_Name: 
           Master_TLS_Version: 
       Master_public_key_path: 
        Get_master_public_key: 0
            Network_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.coloradmin.cn/o/1169585.html

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

相关文章

Opencascad(C++)-创建自定义坐标系

文章目录 1、前言2、在Opencascad中显示小的坐标系3、在Opencascad中创建自定义的坐标系 1、前言 在Opencascad开发时,在view中可以显示小的坐标系,但是有时我们需要在建模时创建基准坐标系,当然可以作为工件坐标系也可以作为基准坐标系。本…

2023面试知识点三

1、强软弱虚引用 强引用 当内存不足的时候,JVM开始垃圾回收,对于强引用的对象,就算是出现了OOM也不会对该对象进行回收,打死也不回收~! 强引用是我们最常见的普通对象引用,只要还有一个强引用指向一个对象…

基于单片机的衣物消毒清洗机系统设计

收藏和点赞,您的关注是我创作的动力 文章目录 概要 一、系统总体设计2.2 功能分析2.3 系统框架设计 二、硬件电路设计3.1 电源模块的设计 三、 软件设计4.1 系统整体流程4.4 软件整体流程实物图 四、 结论五、 文章目录 概要 基于单片机的衣物消毒清洗机可以应用在…

CSGO饰品价格暴跌的原因分析

CSGO饰品暴跌3个月,盘点6大原因 今天我们来聊一下CSGO饰品市场的情况。大部分装备从3月份开始就一直持续走低,到现在已经是7月份了,还有部分饰品呈阴跌趋势。整个市场沉寂一片,还有些悲观主义者天天在吆喝:市场崩盘了&…

Leetcode刷题详解——全排列

1. 题目链接:46. 全排列 2. 题目描述: 给定一个不含重复数字的数组 nums ,返回其 所有可能的全排列 。你可以 按任意顺序 返回答案。 示例 1: 输入:nums [1,2,3] 输出:[[1,2,3],[1,3,2],[2,1,3],[2,3,1],…

PHP中文转拼音实现

pinyin.php 床前明月光&#xff0c;疑是地上霜。 举头望明月&#xff0c;低头思故乡 <?php /*** PHP 汉字转拼音 [包含20902个基本汉字5059生僻字]* author 楼教主(cik520qq.com)* version v1.2* note 请开启 mb_string 扩展*/var_dump(pinyin(床前明月光&#xff0c;疑是…

tomcat搭建以及优化

tomcat是一个开源的web应用服务器&#xff0c;区别去nginx&#xff0c;nginx主要处理静态页面&#xff0c;那么动态请求&#xff08;连接数据库&#xff0c;动态页面&#xff09;并不是nginx处理的长项&#xff0c;动态的请求会交给tomcat进行处理。 nginx……转发动态请求………

MySQL的基础(二)

文章目录 函数&#xff1a;字符串函数数值函数日期函数流程函数 约束id的自动增长&#xff1a;不允许name为NULL值&#xff0c;但不要是字符串的null就行唯一约束实现同样效果的 外键约束语法&#xff08;1)创建的时候就添加(2)已经存在表结构&#xff08;3&#xff09;删除外键…

毕业设计-课程设计-基于python+django+vue开发的外卖点餐网站

文章目录 源码下载地址项目介绍项目功能界面预览项目备注毕设定制&#xff0c;咨询 源码下载地址 点击下载源码 项目介绍 该系统是基于pythondjango开发的外卖点餐系统。适用场景&#xff1a;大学生、课程作业、毕业设计。学习过程中&#xff0c;如遇问题可以在github给作者…

【C++】类和对象(中)之拷贝构造与运算符、操作符重载

&#x1f440;樊梓慕&#xff1a;个人主页 &#x1f3a5;个人专栏&#xff1a;《C语言》《数据结构》《蓝桥杯试题》《LeetCode刷题笔记》《实训项目》《C》 &#x1f31d;每一个不曾起舞的日子&#xff0c;都是对生命的辜负 前言 我们继续学习默认成员函数&#xff0c;本篇文…

C++适配器

文章目录 引言栈和队列 priority_queue仿函数迭代器区间 引言 栈的特性是先进后出&#xff0c;队列的特性是先进先出&#xff0c;然而双向队列同时具有栈和队列的特性&#xff0c;所以我们可以通过双向队列来适配出栈和队列。 先看库里面 栈和队列 stack和queue模板参数里面都…

使用vscode开发uniapp项目常用的辅助插件,提升开发效率

为什么不使用hbuilder开发呢&#xff1f;因为hbuilder对ts和vue3语法支持并不友好&#xff0c;而且代码提示不智能&#xff0c;也不能使用最近很流行的coplit和CodeGeex智能提示&#xff0c;所以就换掉hbulider&#xff0c;使用我们熟悉的vscode开发吧。 第一个&#xff1a;un…

WPF布局控件之DockPanel布局

前言&#xff1a;博主文章仅用于学习、研究和交流目的&#xff0c;不足和错误之处在所难免&#xff0c;希望大家能够批评指出&#xff0c;博主核实后马上更改。 概述&#xff1a; DockPanel 位置子控件基于子 Dock 属性&#xff0c;你有 4 个选项停靠&#xff0c;左 (默认) &…

coalesce函数(SQL )

用途&#xff1a; 将控制替换成其他值&#xff1b;返回第一个非空值 表达式 COALESCE是一个函数&#xff0c; (expression_1, expression_2, …,expression_n)依次参考各参数表达式&#xff0c;遇到非null值即停止并返回该值。如果所有的表达式都是空值&#xff0c;最终将返…

0xGame Web 2023

0xGame Web 2023 [Week 1] signin 这题直接看源码就行&#xff0c;easy [Week 1] baby_php OST /?aQNKCDZO&b240610708 HTTP/1.1 Host: 120.27.148.152:50014 Content-Length: 11 Pragma: no-cache Cache-Control: no-cache Upgrade-Insecure-Requests: 1 Origin: htt…

C++二分查找算法的应用:长度递增组的最大数目

本文涉及的基础知识点 二分查找 题目 给你一个下标从 0 开始、长度为 n 的数组 usageLimits 。 你的任务是使用从 0 到 n - 1 的数字创建若干组&#xff0c;并确保每个数字 i 在 所有组 中使用的次数总共不超过 usageLimits[i] 次。此外&#xff0c;还必须满足以下条件&…

升级 MacOS 系统后,playCover 内游戏打不开了如何解决

我们有些小伙伴在升级了 macOS 系统后大概率会遇到之前能够正常使用的 playCover 突然游戏打不开了&#xff0c;最近 mac 刚刚正式推出了 MacOS 14.1 ,导致很多用户打开游戏会闪退&#xff0c;我们其实只需要更新一下 playCover 就可以解决 playCover 正式版更新会比较慢所以我…

PyQt界面开发(全)

文章目录 前言一、PyQt 简介二、PyQt 与 Qt 的蒙娜丽莎三、PyQt 布局管理器3.1、简介3.2、项目实战3.2.0、添加伸缩项 layout.addStretch&#xff1a;控制布局中组件之间的间距。3.2.1、垂直布局管理器 QVBoxLayout&#xff1a;控件按照从上到下的顺序排列3.2.2、水平布局管理器…

firefox浏览器添加自定义搜索引擎方法

firefox浏览器添加自定义搜索引擎方法 1.在地址栏添加搜索引擎2.Mycroft Project 搜索引擎附加组件3.通过扩展插件添加自定义搜索引擎 Firefox这货居然不支持直接网址%s的搜索引擎定义方式&#xff0c;以下是添加方法。 firefox国际版119.0 1.在地址栏添加搜索引擎 &#xff…

Android:怎么学习才能更好的进大厂呢?

怎么学习才能更好的进大厂呢&#xff1f; 很多朋友都在问这个问题。 其实没有什么特别的技巧&#xff0c;就是依靠自己的毅力和决心。一天做不到&#xff0c;就一个月&#xff1b;一个月做不到&#xff0c;就一年。只要有决心&#xff0c;无论学历或资历如何&#xff0c;都不是…