Redhat 7.9上配置达梦数据库的DM 数据守护(DM Data Watch)

news2024/11/23 21:51:46

Redhat 7.9上配置达梦数据库的DM 数据守护(DM Data Watch)

一 基础环境

在这里插入图片描述

端口说明:
在这里插入图片描述

注:
主库已经安装软件,及创建数据库实例。并已开启归档模式。
[dmdba@test1 tool]$ disql sysdba/Dameng123

服务器[LOCALHOST:5236]:处于普通打开状态
登录使用时间 : 6.060(ms)
disql V8
SQL>
SQL> select NAME,TYPE,VALUE,SYS_VALUE,FILE_VALUE from v$parameter where name=‘BAK_PATH’;

行号 NAME TYPE VALUE SYS_VALUE FILE_VALUE


1 BAK_PATH READ ONLY /dm8/backup /dm8/backup /dm8/backup

已用时间: 9.332(毫秒). 执行号:501.
SQL> select * from v$arch_status;

行号 ARCH_TYPE ARCH_DEST ARCH_STATUS ARCH_SRC


1 LOCAL /dm8/arch VALID DMSVR01

已用时间: 0.523(毫秒). 执行号:502.

备库已经安装软件。

监视器已经安装软件。

二 配置

2.1 配置主库

2.1.1主库进行脱机备份

–备份

[dmdba@test1 ~]$ DmServiceDMSVR01 stop
Stopping DmServiceDMSVR01:                                 [ OK ]
[dmdba@test1 ~]$ 
[dmdba@test1 ~]$ dmrman
dmrman V8
RMAN> backup database '/dm8/data/DM01/dm.ini' full;
backup database '/dm8/data/DM01/dm.ini' full;
file dm.key not found, use default license!
Database mode = 0, oguid = 0
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[42939], file_lsn[42939]
Processing backupset /dm8/backup/DB_DM01_FULL_20240727_084148_248563
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:02][Remaining:00:00:00]                                 
backup successfully!
time used: 00:00:03.209

–传输到备库

[dmdba@test1 ~]$ cd /dm8/backup/DB_DM01_FULL_20240727_084148_248563/
[dmdba@test1 DB_DM01_FULL_20240727_084148_248563]$ scp DB_DM01_FULL_20240727_084148_248563.* dmdba@192.168.10.100:/dm8/backup/
The authenticity of host '192.168.10.100 (192.168.10.100)' can't be established.
ECDSA key fingerprint is SHA256:pGiJgBHeambwotli/1YC55UrX8l05NxVtpuIXfSbxKg.
ECDSA key fingerprint is MD5:4a:ac:c3:4c:b2:c0:f1:2f:10:08:3b:bc:46:72:22:08.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.10.100' (ECDSA) to the list of known hosts.
dmdba@192.168.10.100's password: 
DB_DM01_FULL_20240727_084148_248563.bak                                                                                    100% 9070KB  54.4MB/s   00:00    
DB_DM01_FULL_20240727_084148_248563.meta                                                                                   100%  102KB  25.7MB/s   00:00    
[dmdba@test1 DB_DM01_FULL_20240727_084148_248563]$
2.1.2 配置主库dm.ini 文件
修改 dm.ini 文件如下:
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1
2.1.3 配置主库dmarch.ini 文件
修改 dmarch.ini 文件如下:
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = DMSVR02
[ARCHIVE_LOCAL1]
        ARCH_TYPE            = LOCAL
        ARCH_DEST            = /dm8/arch
        ARCH_FILE_SIZE       = 64
        ARCH_SPACE_LIMIT     = 0
        ARCH_FLUSH_BUF_SIZE  = 0
        ARCH_HANG_FLAG       = 1
2.1.4 配置主库dmmal.ini 文件
修改 dmmal.ini 文件如下:
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST1]
MAL_INST_NAME = DMSVR01
MAL_HOST = 192.168.10.99
MAL_PORT = 55101
MAL_INST_HOST = 192.168.10.99
MAL_INST_PORT = 5236
MAL_DW_PORT = 65101
MAL_INST_DW_PORT = 45101
[MAL_INST2]
MAL_INST_NAME = DMSVR02
MAL_HOST = 192.168.10.100
MAL_PORT = 55121
MAL_INST_HOST = 192.168.10.100
MAL_INST_PORT = 5236
MAL_DW_PORT = 65121
MAL_INST_DW_PORT = 45121
2.1.5 配置主库dmwatcher.ini 文件
修改 dmwatcher.ini 文件如下:
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 8888
INST_INI = /dm8/data/DM01/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0
2.1.6主库起到mount状态,并修改配置

–起到mount状态

[dmdba@test1 ~]$ /dm8/bin/DmServiceDMSVR01 start mount
Starting DmServiceDMSVR01:                                 [ OK ]

–修改主库配置

[dmdba@test1 bin]$ ./disql sysdba/Dameng123

服务器[LOCALHOST:5236]:处于普通配置状态
登录使用时间 : 5.588(ms)
disql V8
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
DMSQL 过程已成功完成
已用时间: 9.082(毫秒). 执行号:1.
SQL> sp_set_oguid(8888);
DMSQL 过程已成功完成
已用时间: 1.999(毫秒). 执行号:2.
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
DMSQL 过程已成功完成
已用时间: 52.111(毫秒). 执行号:3.
SQL> alter database primary;
操作已执行
已用时间: 6.878(毫秒). 执行号:0.

2.2 配置备库

2.2.1 初始化备机数据库
[dmdba@test2 backup]$ cd /dm8/bin
[dmdba@test2 bin]$ ./dminit db_name=DM01 instance_name=DMSVR02 PATH=/dm8/data
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2025-01-15
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL

 log file path: /dm8/data/DM01/DM0101.log


 log file path: /dm8/data/DM01/DM0102.log

write to dir [/dm8/data/DM01].
create dm database success. 2024-07-27 01:00:02
2.2.2 恢复数据库
[dmdba@test2 bin]$ ./dmrman
dmrman V8
RMAN> restore database '/dm8/data/DM01/dm.ini' from backupset '/dm8/backup';
restore database '/dm8/data/DM01/dm.ini' from backupset '/dm8/backup';
file dm.key not found, use default license!
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:02][Remaining:00:00:00]                                 
restore successfully.
time used: 00:00:02.827
RMAN> recover database '/dm8/data/DM01/dm.ini' from backupset '/dm8/backup';
recover database '/dm8/data/DM01/dm.ini' from backupset '/dm8/backup';
Database mode = 2, oguid = 0
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[42939], file_lsn[42939]
recover successfully!
time used: 693.791(ms)
RMAN> recover database '/dm8/data/DM01/dm.ini' update db_magic;
recover database '/dm8/data/DM01/dm.ini' update db_magic;
Database mode = 2, oguid = 0
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[42939], file_lsn[42939]
recover successfully!
time used: 00:00:01.061
2.2.3 配置备库dm.ini 文件
修改 dm.ini 文件如下:
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1
2.2.4 配置备库dmarch.ini 文件
修改 dmarch.ini 文件如下:
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = DMSVR01
[ARCHIVE_LOCAL1]
        ARCH_TYPE            = LOCAL
        ARCH_DEST            = /dm8/arch
        ARCH_FILE_SIZE       = 64
        ARCH_SPACE_LIMIT     = 0
        ARCH_FLUSH_BUF_SIZE  = 0
        ARCH_HANG_FLAG       = 1
2.2.5 配置备库dmmal.ini 文件
修改 dmmal.ini 文件如下:
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST1]
MAL_INST_NAME = DMSVR01
MAL_HOST = 192.168.10.99
MAL_PORT = 55101
MAL_INST_HOST = 192.168.10.99
MAL_INST_PORT = 5236
MAL_DW_PORT = 65101
MAL_INST_DW_PORT = 45101
[MAL_INST2]
MAL_INST_NAME = DMSVR02
MAL_HOST = 192.168.10.100
MAL_PORT = 55121
MAL_INST_HOST = 192.168.10.100
MAL_INST_PORT = 5236
MAL_DW_PORT = 65121
MAL_INST_DW_PORT = 45121
2.2.6 配置备库dmwatcher.ini 文件
修改 dmwatcher.ini 文件如下:
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 8888
INST_INI = /dm8/data/DM01/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0
2.2.7 备库起到mount状态,并修改配置

–起到mount状态

[dmdba@test2 bin]$ cd /dm8/bin
[dmdba@test2 bin]$ ./dmserver /dm8/data/DM01/dm.ini mount
file dm.key not found, use default license!
version info: develop
DM Database Server 64 V8 03134284132-20240115-215128-20081 startup...
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
Database mode = 0, oguid = 0
License will expire on 2025-01-15
file lsn: 42939
ndct db load finished, code:0
ndct second level fill fast pool finished
ndct third level fill fast pool finished
ndct second level fill fast pool finished
ndct third level fill fast pool finished
ndct fill fast pool finished
nsvr_startup end.
uthr_pipe_create, create pipe[read:20, write:21]
uthr_pipe_create, create pipe[read:22, write:23]
uthr_pipe_create, create pipe[read:24, write:25]
uthr_pipe_create, create pipe[read:26, write:27]
uthr_pipe_create, create pipe[read:28, write:29]
uthr_pipe_create, create pipe[read:30, write:31]
uthr_pipe_create, create pipe[read:32, write:33]
uthr_pipe_create, create pipe[read:34, write:35]
uthr_pipe_create, create pipe[read:36, write:37]
uthr_pipe_create, create pipe[read:38, write:39]
uthr_pipe_create, create pipe[read:40, write:41]
uthr_pipe_create, create pipe[read:42, write:43]
uthr_pipe_create, create pipe[read:44, write:45]
uthr_pipe_create, create pipe[read:46, write:47]
uthr_pipe_create, create pipe[read:48, write:49]
uthr_pipe_create, create pipe[read:50, write:51]
aud sys init success.
aud rt sys init success.
systables desc init success.
ndct_db_load_info finished, code:0.
SYSTEM IS READY.

–修改备库配置

--新开一个窗口
[dmdba@test2 bin]$ ./disql sysdba/Dameng123

服务器[LOCALHOST:5236]:处于普通配置状态
登录使用时间 : 3.686(ms)
disql V8
SQL> sp_set_oguid(8888);
DMSQL 过程已成功完成
已用时间: 2.868(毫秒). 执行号:1.
SQL> alter database standby;
操作已执行
已用时间: 4.740(毫秒). 执行号:0.
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
DMSQL 过程已成功完成
已用时间: 9.072(毫秒). 执行号:2.

2.3 启动主库和备库上的守护进程

–主库执行

[dmdba@test1 ~]$ cd /dm8/bin
[dmdba@test1 bin]$ ./dmwatcher /dm8/data/DM01/dmwatcher.ini
DMWATCHER[4.0] V8
DMWATCHER[4.0] IS READY

–备库执行

[dmdba@test2 bin]$ cd /dm8/bin
[dmdba@test2 bin]$ ./dmwatcher /dm8/data/DM01/dmwatcher.ini
DMWATCHER[4.0] V8
DMWATCHER[4.0] IS READY

2.4 配置监视器

2.4.1 配置 dmmonitor.ini

–创建目录

[dmdba@monitor dm8]$ mkdir -p  data/log 
--修改 dmmonitor.ini 文件如下:
MON_DW_CONFIRM = 1
MON_LOG_PATH = /dm8/data/log
MON_LOG_INTERVAL = 60
MON_LOG_FILE_SIZE = 32
MON_LOG_SPACE_LIMIT = 0
[GRP1]
MON_INST_OGUID = 8888
MON_DW_IP = 192.168.10.99:65101
MON_DW_IP = 192.168.10.100:65121
2.4.2 登录监视器
[dmdba@monitor data]$ cd /dm8/bin
[dmdba@monitor bin]$ ./dmmonitor /dm8/data/dmmonitor.ini
[monitor]         2024-07-27 09:22:54: DMMONITOR[4.0] V8
[monitor]         2024-07-27 09:22:54: DMMONITOR[4.0] IS READY.

[monitor]         2024-07-27 09:22:54: 
#-----------------------------------------------------------------------------------------------#
GET MONITOR CONNECT INFO FROM DMWATCHER(DMSVR02), THE FIRST LINE IS SELF INFO.

DW_CONN_TIME         MON_CONFIRM    MID            MON_IP                 MON_VERSION                                                     
2024-07-27 01:22:54  TRUE           1877133724     ::ffff:192.168.10.101  DMMONITOR[4.0] V8
                                              
#-----------------------------------------------------------------------------------------------#

[monitor]         2024-07-27 09:22:54: 收到守护进程(DMSVR02)消息
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN            
                  2024-07-27 01:22:54  OPEN           OK        DMSVR02          OPEN        STANDBY   NULL     4        43095           43095           

[monitor]         2024-07-27 09:22:54: 收到守护进程(DMSVR01)消息
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN            
                  2024-07-27 09:22:54  OPEN           OK        DMSVR01          OPEN        PRIMARY   VALID    4        43095           43095           

login
用户名:sysdba
密码:
[monitor]         2024-07-27 09:32:10: 登录监视器成功!   

Show 可以看到集群状态

show
2024-07-27 09:33:44 
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG  
GRP1             8888        TRUE            AUTO            FALSE     


<<DATABASE GLOBAL INFO:>>
DW_IP          MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.10.99  65101        2024-07-27 09:33:43  GLOBAL    VALID     OPEN           DMSVR01          OK        1     1     OPEN        PRIMARY   DSC_OPEN       REALTIME  VALID    

EP INFO:
INST_IP        INST_PORT  INST_OK   INAME            ISTATUS     IMODE     DSC_SEQNO  DSC_CTL_NODE RTYPE     RSTAT       FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG          
192.168.10.99  5236       OK        DMSVR01          OPEN        PRIMARY   0          0            REALTIME  VALID       4945            43095           4945            43095           NONE                  

<<DATABASE GLOBAL INFO:>>
DW_IP           MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.10.100  65121        2024-07-27 01:33:43  GLOBAL    VALID     OPEN           DMSVR02          OK        1     1     OPEN        STANDBY   DSC_OPEN       REALTIME  VALID    

EP INFO:
INST_IP         INST_PORT  INST_OK   INAME            ISTATUS     IMODE     DSC_SEQNO  DSC_CTL_NODE RTYPE     RSTAT       FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG          
192.168.10.100  5236       OK        DMSVR02          OPEN        STANDBY   0          0            REALTIME  VALID       4945            43095           4945            43095           NONE                  

DATABASE(DMSVR02) APPLY INFO FROM (DMSVR01), REDOS_PARALLEL_NUM (1), WAIT_APPLY[FALSE]:
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4945, 4945, 4945], (RLSN, SLSN, KLSN)[43095, 43095, 43095], N_TSK[0], TSK_MEM_USE[0] 
REDO_LSN_ARR: (43095)


#================================================================================#

在这里插入图片描述

2.5 注册数据守护集群的服务

2.5.1 主库注册dmwatcher服务
[root@test1 ~]# cd /dm8/script/root/
[root@test1 root]# ./dm_service_installer.sh -t dmwatcher -p DMSVR01 -watcher_ini /dm8/data/DM01/dmwatcher.ini
Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServiceDMSVR01.service to /usr/lib/systemd/system/DmWatcherServiceDMSVR01.service.
创建服务(DmWatcherServiceDMSVR01)完成
2.5.2 备库注册dmwatcher服务
[root@test2 ~]# cd /dm8/script/root/
[root@test2 root]# ./dm_service_installer.sh -t dmwatcher -p DMSVR02 -watcher_ini /dm8/data/DM01/dmwatcher.ini
Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServiceDMSVR02.service to /usr/lib/systemd/system/DmWatcherServiceDMSVR02.service.
创建服务(DmWatcherServiceDMSVR02)完成
2.5.3 注册备库的dmserver服务
[root@test2 root]# ./dm_service_installer.sh -t dmserver -dm_ini /dm8/data/DM01/dm.ini -p DMSVR02
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServiceDMSVR02.service to /usr/lib/systemd/system/DmServiceDMSVR02.service.
创建服务(DmServiceDMSVR02)完成
2.5.4 注册监视器的dmmonitor服务
[root@monitor ~]# cd /dm8/script/root/
[root@monitor root]# ./dm_service_installer.sh -t dmmonitor -p DMMONITOR -monitor_ini /dm8/data/dmmonitor.ini
Created symlink from /etc/systemd/system/multi-user.target.wants/DmMonitorServiceDMMONITOR.service to /usr/lib/systemd/system/DmMonitorServiceDMMONITOR.service.
创建服务(DmMonitorServiceDMMONITOR)完成

三 切换测试

3.1 主切备(将DMSVR01切换为备库)

3.1.1 主备同步测试
--主库插入数据
[dmdba@test1 bin]$ ./disql dmtest/Dameng123

服务器[LOCALHOST:5236]:处于主库打开状态
登录使用时间 : 2.721(ms)
disql V8
SQL> create table t1 (id int);
操作已执行
已用时间: 43.027(毫秒). 执行号:701.
SQL> insert into t1 values(1);
影响行数 1

已用时间: 0.856(毫秒). 执行号:702.
SQL> commit;
操作已执行
已用时间: 2.513(毫秒). 执行号:703.

--备库查询
[dmdba@test2 bin]$ ./disql dmtest/Dameng123

服务器[LOCALHOST:5236]:处于备库打开状态
登录使用时间 : 4.122(ms)
disql V8
SQL> select * from t1;

行号     ID         
---------- -----------
1          1

已用时间: 2.095(毫秒). 执行号:101.
3.1.2 switchover切换
switchover
[monitor]         2024-07-27 10:11:22: 开始切换实例DMSVR02
[monitor]         2024-07-27 10:11:22: 通知守护进程DMSVR01切换SWITCHOVER状态
[monitor]         2024-07-27 10:11:22: 守护进程(DMSVR01)状态切换 [OPEN-->SWITCHOVER]
[monitor]         2024-07-27 10:11:23: 切换守护进程DMSVR01为SWITCHOVER状态成功
[monitor]         2024-07-27 10:11:23: 通知守护进程DMSVR02切换SWITCHOVER状态
[monitor]         2024-07-27 10:11:23: 守护进程(DMSVR02)状态切换 [OPEN-->SWITCHOVER]
[monitor]         2024-07-27 10:11:23: 切换守护进程DMSVR02为SWITCHOVER状态成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR01开始执行SP_SET_GLOBAL_DW_STATUS(0, 6)语句
[monitor]         2024-07-27 10:11:23: 实例DMSVR01执行SP_SET_GLOBAL_DW_STATUS(0, 6)语句成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR02开始执行SP_SET_GLOBAL_DW_STATUS(0, 6)语句
[monitor]         2024-07-27 10:11:23: 实例DMSVR02执行SP_SET_GLOBAL_DW_STATUS(0, 6)语句成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR01开始执行ALTER DATABASE MOUNT语句
[monitor]         2024-07-27 10:11:23: 实例DMSVR01执行ALTER DATABASE MOUNT语句成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR02开始执行SP_APPLY_KEEP_PKG()语句
[monitor]         2024-07-27 10:11:23: 实例DMSVR02执行SP_APPLY_KEEP_PKG()语句成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR02开始执行ALTER DATABASE MOUNT语句
[monitor]         2024-07-27 10:11:23: 实例DMSVR02执行ALTER DATABASE MOUNT语句成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR01开始执行ALTER DATABASE STANDBY语句
[monitor]         2024-07-27 10:11:23: 实例DMSVR01执行ALTER DATABASE STANDBY语句成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR02开始执行ALTER DATABASE PRIMARY语句
[monitor]         2024-07-27 10:11:23: 实例DMSVR02执行ALTER DATABASE PRIMARY语句成功
[monitor]         2024-07-27 10:11:23: 通知实例DMSVR02修改所有归档状态无效
[monitor]         2024-07-27 10:11:23: 修改所有实例归档为无效状态成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR01开始执行ALTER DATABASE OPEN FORCE语句
[monitor]         2024-07-27 10:11:23: 实例DMSVR01执行ALTER DATABASE OPEN FORCE语句成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR02开始执行ALTER DATABASE OPEN FORCE语句
[monitor]         2024-07-27 10:11:23: 实例DMSVR02执行ALTER DATABASE OPEN FORCE语句成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR01开始执行SP_SET_GLOBAL_DW_STATUS(6, 0)语句
[monitor]         2024-07-27 10:11:23: 实例DMSVR01执行SP_SET_GLOBAL_DW_STATUS(6, 0)语句成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR02开始执行SP_SET_GLOBAL_DW_STATUS(6, 0)语句
[monitor]         2024-07-27 10:11:23: 实例DMSVR02执行SP_SET_GLOBAL_DW_STATUS(6, 0)语句成功
[monitor]         2024-07-27 10:11:23: 通知守护进程DMSVR01切换OPEN状态
[monitor]         2024-07-27 10:11:23: 守护进程(DMSVR01)状态切换 [SWITCHOVER-->OPEN]
[monitor]         2024-07-27 10:11:23: 切换守护进程DMSVR01为OPEN状态成功
[monitor]         2024-07-27 10:11:23: 通知守护进程DMSVR02切换OPEN状态
[monitor]         2024-07-27 10:11:23: 守护进程(DMSVR02)状态切换 [SWITCHOVER-->OPEN]
[monitor]         2024-07-27 10:11:23: 切换守护进程DMSVR02为OPEN状态成功
[monitor]         2024-07-27 10:11:23: 通知组(GRP1)的守护进程执行清理操作
[monitor]         2024-07-27 10:11:23: 清理守护进程(DMSVR01)请求成功
[monitor]         2024-07-27 10:11:23: 清理守护进程(DMSVR02)请求成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR02切换成功

2024-07-27 10:11:23 
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG  
GRP1             8888        TRUE            AUTO            FALSE     


<<DATABASE GLOBAL INFO:>>
DW_IP           MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.10.100  65121        2024-07-27 02:11:23  GLOBAL    VALID     OPEN           DMSVR02          OK        1     1     OPEN        PRIMARY   DSC_OPEN       REALTIME  VALID    

EP INFO:
INST_IP         INST_PORT  INST_OK   INAME            ISTATUS     IMODE     DSC_SEQNO  DSC_CTL_NODE RTYPE     RSTAT       FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG          
192.168.10.100  5236       OK        DMSVR02          OPEN        PRIMARY   0          0            REALTIME  VALID       4968            43219           4968            43393           NONE                  

<<DATABASE GLOBAL INFO:>>
DW_IP          MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.10.99  65101        2024-07-27 10:11:23  GLOBAL    VALID     OPEN           DMSVR01          OK        1     1     OPEN        STANDBY   DSC_OPEN       REALTIME  INVALID  

EP INFO:
INST_IP        INST_PORT  INST_OK   INAME            ISTATUS     IMODE     DSC_SEQNO  DSC_CTL_NODE RTYPE     RSTAT       FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG          
192.168.10.99  5236       OK        DMSVR01          OPEN        STANDBY   0          0            REALTIME  INVALID     4967            43218           4967            43218           NONE                  

DATABASE(DMSVR01) APPLY INFO FROM (DMSVR02), REDOS_PARALLEL_NUM (1), WAIT_APPLY[FALSE]:
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4967, 4967, 4967], (RLSN, SLSN, KLSN)[43218, 43218, 43218], N_TSK[0], TSK_MEM_USE[0] 
REDO_LSN_ARR: (43218)


#================================================================================#

[monitor]         2024-07-27 10:11:26: 守护进程(DMSVR02)状态切换 [OPEN-->RECOVERY]
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN            
                  2024-07-27 02:11:26  RECOVERY       OK        DMSVR02          OPEN        PRIMARY   VALID    5        43393           43393           

[monitor]         2024-07-27 10:11:29: 守护进程(DMSVR02)状态切换 [RECOVERY-->OPEN]
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN            
                  2024-07-27 02:11:30  OPEN           OK        DMSVR02          OPEN        PRIMARY   VALID    5        43393           43393

确认状态。当前DMSVR02已切换为主库

show
2024-07-27 10:12:36 
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG  
GRP1             8888        TRUE            AUTO            FALSE     


<<DATABASE GLOBAL INFO:>>
DW_IP           MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.10.100  65121        2024-07-27 02:12:36  GLOBAL    VALID     OPEN           DMSVR02          OK        1     1     OPEN        PRIMARY   DSC_OPEN       REALTIME  VALID    

EP INFO:
INST_IP         INST_PORT  INST_OK   INAME            ISTATUS     IMODE     DSC_SEQNO  DSC_CTL_NODE RTYPE     RSTAT       FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG          
192.168.10.100  5236       OK        DMSVR02          OPEN        PRIMARY   0          0            REALTIME  VALID       4970            43393           4970            43393           NONE                  

<<DATABASE GLOBAL INFO:>>
DW_IP          MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.10.99  65101        2024-07-27 10:12:35  GLOBAL    VALID     OPEN           DMSVR01          OK        1     1     OPEN        STANDBY   DSC_OPEN       REALTIME  VALID    

EP INFO:
INST_IP        INST_PORT  INST_OK   INAME            ISTATUS     IMODE     DSC_SEQNO  DSC_CTL_NODE RTYPE     RSTAT       FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG          
192.168.10.99  5236       OK        DMSVR01          OPEN        STANDBY   0          0            REALTIME  VALID       4970            43393           4970            43393           NONE                  

DATABASE(DMSVR01) APPLY INFO FROM (DMSVR02), REDOS_PARALLEL_NUM (1), WAIT_APPLY[FALSE]:
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4970, 4970, 4970], (RLSN, SLSN, KLSN)[43393, 43393, 43393], N_TSK[0], TSK_MEM_USE[0] 
REDO_LSN_ARR: (43393)


#================================================================================#

在这里插入图片描述

3.2 备切主(将DMSVR01切换为主库)

3.2.1主备同步测试
--主库插入数据
[dmdba@test2 bin]$ ./disql dmtest/Dameng123

服务器[LOCALHOST:5236]:处于主库打开状态
登录使用时间 : 3.486(ms)
disql V8
SQL> insert into t1 values(2);
影响行数 1

已用时间: 12.692(毫秒). 执行号:801.
SQL> commit;
操作已执行
已用时间: 2.173(毫秒). 执行号:802.

--备库查询
[dmdba@test1 bin]$ ./disql dmtest/Dameng123

服务器[LOCALHOST:5236]:处于备库打开状态
登录使用时间 : 2.643(ms)
disql V8
SQL> select * from t1;

行号     ID         
---------- -----------
1          1
2          2

已用时间: 0.573(毫秒). 执行号:801.
3.2.2 switchover切换
switchover
[monitor]         2024-07-27 10:17:14: 开始切换实例DMSVR01
[monitor]         2024-07-27 10:17:14: 通知守护进程DMSVR02切换SWITCHOVER状态
[monitor]         2024-07-27 10:17:14: 守护进程(DMSVR02)状态切换 [OPEN-->SWITCHOVER]
[monitor]         2024-07-27 10:17:14: 切换守护进程DMSVR02为SWITCHOVER状态成功
[monitor]         2024-07-27 10:17:14: 通知守护进程DMSVR01切换SWITCHOVER状态
[monitor]         2024-07-27 10:17:14: 守护进程(DMSVR01)状态切换 [OPEN-->SWITCHOVER]
[monitor]         2024-07-27 10:17:14: 切换守护进程DMSVR01为SWITCHOVER状态成功
[monitor]         2024-07-27 10:17:14: 实例DMSVR02开始执行SP_SET_GLOBAL_DW_STATUS(0, 6)语句
[monitor]         2024-07-27 10:17:14: 实例DMSVR02执行SP_SET_GLOBAL_DW_STATUS(0, 6)语句成功
[monitor]         2024-07-27 10:17:14: 实例DMSVR01开始执行SP_SET_GLOBAL_DW_STATUS(0, 6)语句
[monitor]         2024-07-27 10:17:14: 实例DMSVR01执行SP_SET_GLOBAL_DW_STATUS(0, 6)语句成功
[monitor]         2024-07-27 10:17:14: 实例DMSVR02开始执行ALTER DATABASE MOUNT语句
[monitor]         2024-07-27 10:17:14: 实例DMSVR02执行ALTER DATABASE MOUNT语句成功
[monitor]         2024-07-27 10:17:14: 实例DMSVR01开始执行SP_APPLY_KEEP_PKG()语句
[monitor]         2024-07-27 10:17:14: 实例DMSVR01执行SP_APPLY_KEEP_PKG()语句成功
[monitor]         2024-07-27 10:17:14: 实例DMSVR01开始执行ALTER DATABASE MOUNT语句
[monitor]         2024-07-27 10:17:15: 实例DMSVR01执行ALTER DATABASE MOUNT语句成功
[monitor]         2024-07-27 10:17:15: 实例DMSVR02开始执行ALTER DATABASE STANDBY语句
[monitor]         2024-07-27 10:17:15: 实例DMSVR02执行ALTER DATABASE STANDBY语句成功
[monitor]         2024-07-27 10:17:15: 实例DMSVR01开始执行ALTER DATABASE PRIMARY语句
[monitor]         2024-07-27 10:17:15: 实例DMSVR01执行ALTER DATABASE PRIMARY语句成功
[monitor]         2024-07-27 10:17:15: 通知实例DMSVR01修改所有归档状态无效
[monitor]         2024-07-27 10:17:15: 修改所有实例归档为无效状态成功
[monitor]         2024-07-27 10:17:15: 实例DMSVR02开始执行ALTER DATABASE OPEN FORCE语句
[monitor]         2024-07-27 10:17:15: 实例DMSVR02执行ALTER DATABASE OPEN FORCE语句成功
[monitor]         2024-07-27 10:17:15: 实例DMSVR01开始执行ALTER DATABASE OPEN FORCE语句
[monitor]         2024-07-27 10:17:15: 实例DMSVR01执行ALTER DATABASE OPEN FORCE语句成功
[monitor]         2024-07-27 10:17:15: 实例DMSVR02开始执行SP_SET_GLOBAL_DW_STATUS(6, 0)语句
[monitor]         2024-07-27 10:17:15: 实例DMSVR02执行SP_SET_GLOBAL_DW_STATUS(6, 0)语句成功
[monitor]         2024-07-27 10:17:15: 实例DMSVR01开始执行SP_SET_GLOBAL_DW_STATUS(6, 0)语句
[monitor]         2024-07-27 10:17:15: 实例DMSVR01执行SP_SET_GLOBAL_DW_STATUS(6, 0)语句成功
[monitor]         2024-07-27 10:17:15: 通知守护进程DMSVR02切换OPEN状态
[monitor]         2024-07-27 10:17:15: 守护进程(DMSVR02)状态切换 [SWITCHOVER-->OPEN]
[monitor]         2024-07-27 10:17:15: 切换守护进程DMSVR02为OPEN状态成功
[monitor]         2024-07-27 10:17:15: 通知守护进程DMSVR01切换OPEN状态
[monitor]         2024-07-27 10:17:15: 守护进程(DMSVR01)状态切换 [SWITCHOVER-->OPEN]
[monitor]         2024-07-27 10:17:15: 切换守护进程DMSVR01为OPEN状态成功
[monitor]         2024-07-27 10:17:15: 通知组(GRP1)的守护进程执行清理操作
[monitor]         2024-07-27 10:17:15: 清理守护进程(DMSVR01)请求成功
2024-07-27 10:17:15 
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG  
GRP1             8888        TRUE            AUTO            FALSE     


<<DATABASE GLOBAL INFO:>>
DW_IP          MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.10.99  65101        2024-07-27 10:17:15  GLOBAL    VALID     OPEN           DMSVR01          OK        1     1     OPEN        PRIMARY   DSC_OPEN       REALTIME  VALID    

[monitor]         2024-07-27 10:17:15: 清理守护进程(DMSVR02)请求成功
[monitor]         2024-07-27 10:17:15: 实例DMSVR01切换成功

EP INFO:
INST_IP        INST_PORT  INST_OK   INAME            ISTATUS     IMODE     DSC_SEQNO  DSC_CTL_NODE RTYPE     RSTAT       FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG          
192.168.10.99  5236       OK        DMSVR01          OPEN        PRIMARY   0          0            REALTIME  VALID       4976            43418           4976            43591           NONE                  

<<DATABASE GLOBAL INFO:>>
DW_IP           MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.10.100  65121        2024-07-27 02:17:15  GLOBAL    VALID     OPEN           DMSVR02          OK        1     1     OPEN        STANDBY   DSC_OPEN       REALTIME  INVALID  

EP INFO:
INST_IP         INST_PORT  INST_OK   INAME            ISTATUS     IMODE     DSC_SEQNO  DSC_CTL_NODE RTYPE     RSTAT       FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG          
192.168.10.100  5236       OK        DMSVR02          OPEN        STANDBY   0          0            REALTIME  INVALID     4975            43417           4975            43417           NONE                  

DATABASE(DMSVR02) APPLY INFO FROM (DMSVR01), REDOS_PARALLEL_NUM (1), WAIT_APPLY[FALSE]:
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4975, 4975, 4975], (RLSN, SLSN, KLSN)[43417, 43417, 43417], N_TSK[0], TSK_MEM_USE[0] 
REDO_LSN_ARR: (43417)


#================================================================================#

[monitor]         2024-07-27 10:17:18: 守护进程(DMSVR01)状态切换 [OPEN-->RECOVERY]
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN            
                  2024-07-27 10:17:18  RECOVERY       OK        DMSVR01          OPEN        PRIMARY   VALID    6        43591           43591           

[monitor]         2024-07-27 10:17:20: 守护进程(DMSVR01)状态切换 [RECOVERY-->OPEN]
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN            
                  2024-07-27 10:17:20  OPEN           OK        DMSVR01          OPEN        PRIMARY   VALID    6        43591           43591           

确认状态。当前DMSVR01已切换为主库

show
2024-07-27 10:18:07 
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG  
GRP1             8888        TRUE            AUTO            FALSE     


<<DATABASE GLOBAL INFO:>>
DW_IP          MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.10.99  65101        2024-07-27 10:18:06  GLOBAL    VALID     OPEN           DMSVR01          OK        1     1     OPEN        PRIMARY   DSC_OPEN       REALTIME  VALID    

EP INFO:
INST_IP        INST_PORT  INST_OK   INAME            ISTATUS     IMODE     DSC_SEQNO  DSC_CTL_NODE RTYPE     RSTAT       FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG          
192.168.10.99  5236       OK        DMSVR01          OPEN        PRIMARY   0          0            REALTIME  VALID       4977            43591           4977            43591           NONE                  

<<DATABASE GLOBAL INFO:>>
DW_IP           MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.10.100  65121        2024-07-27 02:18:07  GLOBAL    VALID     OPEN           DMSVR02          OK        1     1     OPEN        STANDBY   DSC_OPEN       REALTIME  VALID    

EP INFO:
INST_IP         INST_PORT  INST_OK   INAME            ISTATUS     IMODE     DSC_SEQNO  DSC_CTL_NODE RTYPE     RSTAT       FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG          
192.168.10.100  5236       OK        DMSVR02          OPEN        STANDBY   0          0            REALTIME  VALID       4977            43591           4977            43591           NONE                  

DATABASE(DMSVR02) APPLY INFO FROM (DMSVR01), REDOS_PARALLEL_NUM (1), WAIT_APPLY[FALSE]:
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4977, 4977, 4977], (RLSN, SLSN, KLSN)[43591, 43591, 43591], N_TSK[0], TSK_MEM_USE[0] 
REDO_LSN_ARR: (43591)


#================================================================================#

在这里插入图片描述

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

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

相关文章

Cuda入门

文章目录 下载使用NsightAPI__ldg 函数实现1. Sigmoid2. warpReduceSum 参考学习资料 下载使用Nsight https://developer.nvidia.com/nsight-systems/get-startedsudo ln -s /opt/nvidia/nsight-systems/2024.4.1/bin/nsys /bin/nsysnsys profile --statstrue addAPI __ldg …

kotlin协程-- 基础概念 ①|创建和使用

引言 首先先说一些相关概念 1.并发与并行 在操作系统中我们曾经学到过并发与并行 并发: 是同一个时刻只有一条指令在执行,其他指令没有再执行,但是由于CPU的时间片特别短,导致多个指令来回切换的时间间隔特别短,就好像是同一时间多条指令在执行。单核CPU与多核CPU都可以进…

渗透测试之漏洞 ms08-067 利用实验

实验背景 在安全服务项目中&#xff0c;需要对系统进行风险评估&#xff0c;其中风险评估的第一步:漏洞扫描即漏扫&#xff0c;在客户授权的前提下&#xff0c;对授权目标实施扫描并生成漏扫报告;在漏扫结束后&#xff0c;为了其准确性和完整性&#xff0c;还需对目标进行渗透…

FPGA FIFO IP核(3)- 仿真

仿真思路 如何在写入标志信号&#xff08;写入请求信号&#xff09;有效时将数据写入到FIFO中&#xff1f; 在调用模块代码中&#xff0c;pi_flag每四个时钟周期产生一个有效信号&#xff0c;即写请求信号。每次当pi_data检测到pi_flag信号有效时加1&#xff0c;从0~255循环变…

PDF怎么压缩?在线pdf压缩VS PDF压缩软件,谁更好用?10款工具详细多方位测评

PDF怎么压缩&#xff1f;PDF文件压缩可以使用本地文件压缩软件&#xff0c;也可以在网页上使用在线压缩工具一键压缩。 在日常工作和生活中&#xff0c;PDF文件因其跨平台性和良好的保持格式不变的能力而广受欢迎。然而&#xff0c;随着PDF文件内容的增加&#xff0c;文件大小也…

【JavaScript】详解Day.js:轻量级日期处理库的全面指南

文章目录 一、Day.js简介1. 什么是Day.js&#xff1f;2. 安装Day.js 二、Day.js的基本用法1. 创建日期对象2. 格式化日期3. 解析日期字符串4. 操作日期5. 比较日期 三、Day.js的高级功能1. 插件机制2. 国际化支持 四、实际应用案例1. 事件倒计时2. 日历应用 在JavaScript开发中…

如何免费实现网站HTTPS访问

在当今数字化的世界中&#xff0c;网络安全问题愈发凸显其重要性。对于网站而言&#xff0c;实现HTTPS访问已经成为提升用户信任度和保障数据安全的重要手段。然而&#xff0c;对于许多小型网站和个人博客来说&#xff0c;购买SSL证书可能是一笔不小的开销。下面将介绍如何免费…

基于微信小程序+SpringBoot+Vue的儿童预防接种预约系统(带1w+文档)

基于微信小程序SpringBootVue的儿童预防接种预约系统(带1w文档) 基于微信小程序SpringBootVue的儿童预防接种预约系统(带1w文档) 开发合适的儿童预防接种预约微信小程序&#xff0c;可以方便管理人员对儿童预防接种预约微信小程序的管理&#xff0c;提高信息管理工作效率及查询…

【数据结构】单链表带头双向循环链表的实现

一、链表的概念及结构 1.链表的概念 概念&#xff1a;链表是一种物理存储结构上非连续、非顺序的存储结构&#xff0c;数据元素的逻辑顺序是通过链表中的指针链接次序实现的 。 2.链表的结构 一般讲的链表包括数据域和指针域&#xff1a; 二、链表的种类 实际中链表的结构…

云HIS系统源码,业务云协同和数据云协同的数字化医院信息系统

云HIS是利用云计算、大数据、物联网、移动互联网等技术&#xff0c;打造的一个安全、便捷、共享、协同的医疗互联网云生态平台。核心功能是业务云协同和数据云协同。云HIS具有可扩展、易共享、易协同、低成本、体验号、更便捷、易维护的优势&#xff0c;重新定义了数字化医院信…

Intel(R) Wireless-AC 9462 WLAN已关闭开不起来的可能原因

最近给老电脑机械师T90重装系统&#xff0c;装好各种驱动之后&#xff0c;发现无线功能开不起来&#xff0c;WLAN已关闭不管怎么操作都开不起来 最后尝试把笔记本的无线网卡重新插了一下就正常了

freertos的学习cubemx版

HAL 库的freertos 1 实时 2 任务->线程 3 移植 CMSIS_V2 V1版本 NVIC配置全部是抢占优先级 第四组 抢占级别有 0-15 编码规则&#xff0c; 变量名 &#xff1a;类型前缀&#xff0c; c - char S - int16_t L - int32_t U - unsigned Uc - uint8_t Us - uint…

sheng的学习笔记-AI-公式-指数加权移动平均(EWMA)

AI目录&#xff1a;sheng的学习笔记-AI目录-CSDN博客 基础知识 指数加权移动平均&#xff08;Exponential Weighted Moving Average&#xff09;&#xff0c;是一种常用的序列处理方式 看例子&#xff0c;首先这是一年365天的温度散点图&#xff0c;以天数为横坐标&#xff0…

C++进阶(9)C++11

个人主页&#xff1a;仍有未知等待探索-CSDN博客 专题分栏&#xff1a;C 目录 一、统一列表初始化 二、变量类型推导 1、auto 2、decltype 3、typeid 三、左值/右值 1、左值引用/右值引用&#xff08;粗&#xff09; 2、右值 3、右值引用&#xff08;细&#xff09; 1…

135.分发糖果,遍历方向+candy选取的详解

力扣135分发糖果 题目思路代码 题目 https://leetcode.cn/problems/candy/description/ 老师想给孩子们分发糖果&#xff0c;有 N 个孩子站成了一条直线&#xff0c;老师会根据每个孩子的表现&#xff0c;预先给他们评分。 你需要按照以下要求&#xff0c;帮助老师给这些孩子…

【Python机器学习】朴素贝叶斯——使用Python进行文本分类

目录 准备文本&#xff1a;从文本中构建词向量 训练算法&#xff1a;从词向量计算概率 测试算法&#xff1a;根据现实情况修改分类器 准备数据&#xff1a;文档词袋模型 要从文本中获取特征&#xff0c;需要先拆分文本。这里的特征是来自文本的词条&#xff0c;一个词条是字…

大脑网络交互分析:公式与应用

大脑网络交互分析&#xff1a;公式与应用 核心概念与重要性 大脑网络交互分析是神经科学研究中的重要领域&#xff0c;它关注大脑不同区域之间的连接与交互方式。通过分析大脑网络&#xff0c;我们可以理解大脑如何处理和整合信息&#xff0c;进而揭示认知、情感和行为的神经…

java 集合框架-map(键值对集合)

一、Map接口 (键值对集合) 1.实现类 (1).线程不安全 HashMap 1.特点: ①无序 ②查找效率高&#xff1a;根据key&#xff0c;查找value 2.数据结构&#xff1a;数组&#xff08;哈希表&#xff09; 链表&#xff08;链地址法解决哈希表冲突&#xff09; 红黑树&#xff0…

UDP的报文结构及其注意事项

1. 概述 UDP&#xff08;User Datagram Protocol&#xff09;是一种无连接的传输层协议&#xff0c;它提供了一种简单的数据传输服务&#xff0c;不保证数据的可靠传输。在网络通信中&#xff0c;UDP通常用于一些对实时性要求较高、数据量较小、传输延迟较低的应用&#xff0c…