redis集群部署 (通过redis工具快速部署,手动部署)

目录

一、快速部署集群

1、 进入集群目录,创建集群

2、 查看正常启动

二、部署集群 

 1、分配集群节点         

 2、验证集群可用性

 3、停止redis进程

三、手动部署集群

1、配置redis.conf配置文件

2、启动redis集群

3、手动创建redis集群

4、验证

四、集群操作指令 

#-c 自动跳转对应的槽位

#把俩个key放道同一个槽位,使用打印标签的方式{里面的内容随便,写什么都可以}

#查看集群信息(可以查看对应的集群里面的keys有多少)

#检查集群状态

#查看redis集群槽位分布 


-----------------------------跳过安装过程---------------------------------------

一、快速部署集群

       1、 进入集群目录,创建集群

[root@localhost ~]# cd /usr/local/redis-6.2.12/utils/create-cluster
[root@localhost create-cluster]# ./create-cluster start
Starting 30001
Starting 30002
Starting 30003
Starting 30004
Starting 30005
Starting 30006

2、 查看正常启动

[root@localhost create-cluster]# netstat -pltun
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:30001           0.0.0.0:*               LISTEN      1644/../../src//red
tcp        0      0 0.0.0.0:30002           0.0.0.0:*               LISTEN      1646/../../src//red
tcp        0      0 0.0.0.0:30003           0.0.0.0:*               LISTEN      1648/../../src//red
tcp        0      0 0.0.0.0:30004           0.0.0.0:*               LISTEN      1656/../../src//red
tcp        0      0 0.0.0.0:30005           0.0.0.0:*               LISTEN      1661/../../src//red
tcp        0      0 0.0.0.0:30006           0.0.0.0:*               LISTEN      1666/../../src//red
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1086/sshd
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1359/master
tcp        0      0 0.0.0.0:40001           0.0.0.0:*               LISTEN      1644/../../src//red
tcp        0      0 0.0.0.0:40002           0.0.0.0:*               LISTEN      1646/../../src//red
tcp        0      0 0.0.0.0:40003           0.0.0.0:*               LISTEN      1648/../../src//red
tcp        0      0 0.0.0.0:40004           0.0.0.0:*               LISTEN      1656/../../src//red
tcp        0      0 0.0.0.0:40005           0.0.0.0:*               LISTEN      1661/../../src//red
tcp        0      0 0.0.0.0:40006           0.0.0.0:*               LISTEN      1666/../../src//red
tcp6       0      0 :::30001                :::*                    LISTEN      1644/../../src//red
tcp6       0      0 :::30002                :::*                    LISTEN      1646/../../src//red
tcp6       0      0 :::30003                :::*                    LISTEN      1648/../../src//red
tcp6       0      0 :::30004                :::*                    LISTEN      1656/../../src//red
tcp6       0      0 :::30005                :::*                    LISTEN      1661/../../src//red
tcp6       0      0 :::30006                :::*                    LISTEN      1666/../../src//red
tcp6       0      0 :::22                   :::*                    LISTEN      1086/sshd
tcp6       0      0 ::1:25                  :::*                    LISTEN      1359/master
tcp6       0      0 :::40001                :::*                    LISTEN      1644/../../src//red
tcp6       0      0 :::40002                :::*                    LISTEN      1646/../../src//red
tcp6       0      0 :::40003                :::*                    LISTEN      1648/../../src//red
tcp6       0      0 :::40004                :::*                    LISTEN      1656/../../src//red
tcp6       0      0 :::40005                :::*                    LISTEN      1661/../../src//red
tcp6       0      0 :::40006                :::*                    LISTEN      1666/../../src//red
udp        0      0 0.0.0.0:68              0.0.0.0:*                           902/dhclient
[root@localhost create-cluster]# ps -ef|grep redis
root       1644      1  0 00:00 ?        00:00:00 ../../src//redis-server *:30001 [cluster]
root       1646      1  0 00:00 ?        00:00:00 ../../src//redis-server *:30002 [cluster]
root       1648      1  0 00:00 ?        00:00:00 ../../src//redis-server *:30003 [cluster]
root       1656      1  0 00:00 ?        00:00:00 ../../src//redis-server *:30004 [cluster]
root       1661      1  0 00:00 ?        00:00:00 ../../src//redis-server *:30005 [cluster]
root       1666      1  0 00:00 ?        00:00:00 ../../src//redis-server *:30006 [cluster]
root       1675   1608  0 00:00 pts/0    00:00:00 grep --color=auto redis

二、部署集群 

       1、分配集群节点         

[root@localhost create-cluster]# ll
total 8
-rwxrwxr-x. 1 root root 2787 Apr 17  2023 create-cluster
-rw-rw-r--. 1 root root 1437 Apr 17  2023 README
[root@localhost create-cluster]# ./create-cluster create
>>> Performing hash slots allocation on 6 nodes...
Master[0] -> Slots 0 - 5460
Master[1] -> Slots 5461 - 10922
Master[2] -> Slots 10923 - 16383
Adding replica 127.0.0.1:30005 to 127.0.0.1:30001
Adding replica 127.0.0.1:30006 to 127.0.0.1:30002
Adding replica 127.0.0.1:30004 to 127.0.0.1:30003
>>> Trying to optimize slaves allocation for anti-affinity
[WARNING] Some slaves are in the same host as their master
M: f8ec4c4889fb9a8c83e3b732bdd4df4ae529970c 127.0.0.1:30001slots:[0-5460] (5461 slots) master
M: 7c602a2fa09e149f4afa678da9deb4ba7a623b7a 127.0.0.1:30002slots:[5461-10922] (5462 slots) master
M: a8c24cf5fdc40cb32ea8a8122fb6f553bfb1343f 127.0.0.1:30003slots:[10923-16383] (5461 slots) master
S: 361ee2234efa8527ba9d255b29dcebb60a5a2f35 127.0.0.1:30004replicates f8ec4c4889fb9a8c83e3b732bdd4df4ae529970c
S: 7f307cd20409072ea9aa7c297fab6fa8be008a72 127.0.0.1:30005replicates 7c602a2fa09e149f4afa678da9deb4ba7a623b7a
S: 9083610ae287234adfb957adfa0d7d3e9f9a5e42 127.0.0.1:30006replicates a8c24cf5fdc40cb32ea8a8122fb6f553bfb1343f
Can I set the above configuration? (type 'yes' to accept): yes
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join
.
>>> Performing Cluster Check (using node 127.0.0.1:30001)
M: f8ec4c4889fb9a8c83e3b732bdd4df4ae529970c 127.0.0.1:30001slots:[0-5460] (5461 slots) master1 additional replica(s)
S: 361ee2234efa8527ba9d255b29dcebb60a5a2f35 127.0.0.1:30004slots: (0 slots) slavereplicates f8ec4c4889fb9a8c83e3b732bdd4df4ae529970c
S: 7f307cd20409072ea9aa7c297fab6fa8be008a72 127.0.0.1:30005slots: (0 slots) slavereplicates 7c602a2fa09e149f4afa678da9deb4ba7a623b7a
M: 7c602a2fa09e149f4afa678da9deb4ba7a623b7a 127.0.0.1:30002slots:[5461-10922] (5462 slots) master1 additional replica(s)
S: 9083610ae287234adfb957adfa0d7d3e9f9a5e42 127.0.0.1:30006slots: (0 slots) slavereplicates a8c24cf5fdc40cb32ea8a8122fb6f553bfb1343f
M: a8c24cf5fdc40cb32ea8a8122fb6f553bfb1343f 127.0.0.1:30003slots:[10923-16383] (5461 slots) master1 additional replica(s)
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
[root@localhost create-cluster]#

 2、验证集群可用性

[root@localhost create-cluster]# redis-cli -p 30001
127.0.0.1:30001> set name vV
(error) MOVED 5798 127.0.0.1:30002   #这里提示应该在5798 槽位放入键值对,但是你30001的不包含
127.0.0.1:30001> exit
[root@localhost create-cluster]# redis-cli -p 30001 -c   #加参数 -c 可以自行跳转对应的redis
127.0.0.1:30001> set name vV
-> Redirected to slot [5798] located at 127.0.0.1:30002
OK
127.0.0.1:30002> get name
"vV"
127.0.0.1:30002>

[root@localhost create-cluster]# ps -aux|grep reids
root       1727  0.0  0.0 112812   968 pts/0    S+   00:13   0:00 grep --color=auto reids
[root@localhost create-cluster]# ps -aux|grep redis
root       1644  0.1  0.0 146232  3252 ?        Ssl  00:00   0:01 ../../src//redis-server *:30001 [cluster]
root       1646  0.1  0.0 146140  3156 ?        Ssl  00:00   0:01 ../../src//redis-server *:30002 [cluster]
root       1648  0.1  0.0 146240  3252 ?        Ssl  00:00   0:01 ../../src//redis-server *:30003 [cluster]
root       1656  0.1  0.0 146136  3112 ?        Ssl  00:00   0:01 ../../src//redis-server *:30004 [cluster]
root       1661  0.1  0.0 146136  3124 ?        Ssl  00:00   0:01 ../../src//redis-server *:30005 [cluster]
root       1666  0.1  0.0 146136  3104 ?        Ssl  00:00   0:01 ../../src//redis-server *:30006 [cluster]
root       1729  0.0  0.0 112812   972 pts/0    S+   00:13   0:00 grep --color=auto redis
[root@localhost create-cluster]# pkill -9 redis
[root@localhost create-cluster]#
[root@localhost create-cluster]# ps -aux|grep redis
root       1732  0.0  0.0 112812   968 pts/0    S+   00:13   0:00 grep --color=auto redis

3、停止redis进程

[root@localhost create-cluster]# ps -aux|grep reids
root       1727  0.0  0.0 112812   968 pts/0    S+   00:13   0:00 grep --color=auto reids
[root@localhost create-cluster]# ps -aux|grep redis
root       1644  0.1  0.0 146232  3252 ?        Ssl  00:00   0:01 ../../src//redis-server *:30001 [cluster]
root       1646  0.1  0.0 146140  3156 ?        Ssl  00:00   0:01 ../../src//redis-server *:30002 [cluster]
root       1648  0.1  0.0 146240  3252 ?        Ssl  00:00   0:01 ../../src//redis-server *:30003 [cluster]
root       1656  0.1  0.0 146136  3112 ?        Ssl  00:00   0:01 ../../src//redis-server *:30004 [cluster]
root       1661  0.1  0.0 146136  3124 ?        Ssl  00:00   0:01 ../../src//redis-server *:30005 [cluster]
root       1666  0.1  0.0 146136  3104 ?        Ssl  00:00   0:01 ../../src//redis-server *:30006 [cluster]
root       1729  0.0  0.0 112812   972 pts/0    S+   00:13   0:00 grep --color=auto redis
[root@localhost create-cluster]# pkill -9 redis
[root@localhost create-cluster]#
[root@localhost create-cluster]# ps -aux|grep redis
root       1732  0.0  0.0 112812   968 pts/0    S+   00:13   0:00 grep --color=auto redis

三、手动部署集群

1、配置redis.conf配置文件

[root@localhost redis]# cd /usr/local/redis/
[root@localhost redis]# mkdir cluster#创建6个redis.config文件
[root@localhost cluster]# vim redis-cluster-6379.conf
[root@localhost cluster]# vim redis-cluster-6380.conf
[root@localhost cluster]# vim redis-cluster-6381.conf
[root@localhost cluster]# vim redis-cluster-6382.conf
[root@localhost cluster]# vim redis-cluster-6383.conf
[root@localhost cluster]# vim redis-cluster-6382.conf
[root@localhost cluster]# vim redis-cluster-6384.conf
#里面内容如下,记得根据不同的配置文件修改文件里面的内容root@localhost cluster]# cat redis-cluster-6379.conf
# 数据存储目录
# 指定 Redis 数据文件和配置文件的存储位置
dir "/usr/local/redis/cluster/db/6379"# 启用集群模式
# 启用 Redis 集群功能,使该实例作为集群的一部分工作
cluster-enabled yes# 集群配置文件
# 指定 Redis 集群的配置文件名,Redis 在运行时将存储集群状态
cluster-config-file 6379.conf# 端口号
# 指定 Redis 实例监听的端口号
port 6379# 守护进程模式
# 使 Redis 以守护进程方式运行,即在后台运行
daemonize yes# 绑定 IP 地址
# 指定 Redis 监听的 IP 地址,0.0.0.0 表示监听所有网络接口
bind 0.0.0.0# 密码保护
# 设置访问 Redis 实例所需的密码
#requirepass your_password_here# 日志文件
# 指定 Redis 日志文件的存储位置
logfile "/usr/local/redis/cluster/logs/6379.log"# 日志级别
# 指定日志记录的级别,可以是 debug、verbose、notice、warning
loglevel info#创建目录
[root@localhost cluster]# mkdir db
[root@localhost cluster]# cd db/
[root@localhost db]# mkdir {6379,6380,6381,6382,6383,6384}
[root@localhost db]# ll
total 0
drwxr-xr-x. 2 root root 6 Jul  9 00:26 6379
drwxr-xr-x. 2 root root 6 Jul  9 00:26 6380
drwxr-xr-x. 2 root root 6 Jul  9 00:26 6381
drwxr-xr-x. 2 root root 6 Jul  9 00:26 6382
drwxr-xr-x. 2 root root 6 Jul  9 00:26 6383
drwxr-xr-x. 2 root root 6 Jul  9 00:26 6384

2、启动redis集群

[root@localhost cluster]# ../../redis/bin/redis-server redis-cluster-6379.conf
[root@localhost cluster]# ../../redis/bin/redis-server redis-cluster-6380.conf

[root@localhost cluster]# ../../redis/bin/redis-server redis-cluster-6381.conf

[root@localhost cluster]# ../../redis/bin/redis-server redis-cluster-6382.conf
[root@localhost cluster]# ../../redis/bin/redis-server redis-cluster-6383.conf
[root@localhost cluster]# ../../redis/bin/redis-server redis-cluster-6384.conf

[root@localhost cluster]# ps -ef|grep redis

root       1847      1  0 00:32 ?        00:00:00 ../../redis/bin/redis-server *:6379 [cluster]
root       1852      1  0 00:32 ?        00:00:00 ../../redis/bin/redis-server *:6380 [cluster]
root       1825      1  0 00:32 ?        00:00:00 ../../redis/bin/redis-server *:6381 [cluster]
root       1832      1  0 00:32 ?        00:00:00 ../../redis/bin/redis-server *:8382 [cluster]
root       1837      1  0 00:32 ?        00:00:00 ../../redis/bin/redis-server *:6383 [cluster]
root       1842      1  0 00:32 ?        00:00:00 ../../redis/bin/redis-server *:6384 [cluster]
 

 3、手动创建redis集群

[root@localhost cluster]# redis-cli --cluster create 127.0.0.1:6379 127.0.0.1:6380 127.0.0.1:6381 127.0.0.1:6382 127.0.0.1:6383 127.0.0.1:6384
>>> Performing hash slots allocation on 6 nodes...
Master[0] -> Slots 0 - 2730
Master[1] -> Slots 2731 - 5460
Master[2] -> Slots 5461 - 8191
Master[3] -> Slots 8192 - 10922
Master[4] -> Slots 10923 - 13652
Master[5] -> Slots 13653 - 16383
M: 04f33b8ebfe689b5841ec5bf2e42a7583d4320ef 127.0.0.1:6379slots:[0-2730] (2731 slots) master
M: 7976cdeba2788063b916bccaac71d06a89ff63c4 127.0.0.1:6380slots:[2731-5460] (2730 slots) master
M: 268a39068026beef18fb5d88410c0d9f72779d4f 127.0.0.1:6381slots:[5461-8191] (2731 slots) master
M: 39d35937546e37d31d350d8b8357a1405a6336c7 127.0.0.1:6382slots:[8192-10922] (2731 slots) master
M: d4302a52d4d67f4834fd9933e0a6286b0d1803aa 127.0.0.1:6383slots:[10923-13652] (2730 slots) master
M: a28ebb8ef8fa184b9b6c2dc080fc7a458b12e228 127.0.0.1:6384slots:[13653-16383] (2731 slots) master
Can I set the above configuration? (type 'yes' to accept): yes
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join
......
>>> Performing Cluster Check (using node 127.0.0.1:6379)
M: 04f33b8ebfe689b5841ec5bf2e42a7583d4320ef 127.0.0.1:6379slots:[0-2730] (2731 slots) master
M: 39d35937546e37d31d350d8b8357a1405a6336c7 127.0.0.1:6382slots:[8192-10922] (2731 slots) master
M: 7976cdeba2788063b916bccaac71d06a89ff63c4 127.0.0.1:6380slots:[2731-5460] (2730 slots) master
M: 268a39068026beef18fb5d88410c0d9f72779d4f 127.0.0.1:6381slots:[5461-8191] (2731 slots) master
M: d4302a52d4d67f4834fd9933e0a6286b0d1803aa 127.0.0.1:6383slots:[10923-13652] (2730 slots) master
M: a28ebb8ef8fa184b9b6c2dc080fc7a458b12e228 127.0.0.1:6384slots:[13653-16383] (2731 slots) master
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
[root@localhost cluster]#

4、验证

[root@localhost cluster]# redis-cli  -p 6379 -c
127.0.0.1:6379> set name vV
-> Redirected to slot [5798] located at 127.0.0.1:6381
OK
127.0.0.1:6381> get name
"vV"
127.0.0.1:6381>
127.0.0.1:6381>

四、集群操作指令 

#-c 自动跳转对应的槽位

 redis-cli  -p 6379 -c

127.0.0.1:6379> set name vV
-> Redirected to slot [5798] located at 127.0.0.1:6381
OK
127.0.0.1:6381> get name
"vV"

#把俩个key放道同一个槽位,使用打印标签的方式{里面的内容随便,写什么都可以}

127.0.0.1:6383> set a 123
-> Redirected to slot [15495] located at 127.0.0.1:6384
OK
127.0.0.1:6384> set b 456
-> Redirected to slot [3300] located at 127.0.0.1:6380
OK
127.0.0.1:6380> set {user}a 123
-> Redirected to slot [5474] located at 127.0.0.1:6381
OK
127.0.0.1:6381> set {user}b 123
OK
127.0.0.1:6381> set {user}c 123
OK
127.0.0.1:6381>

#查看集群信息(可以查看对应的集群里面的keys有多少)

[root@localhost cluster]# redis-cli --cluster info  127.0.0.1 6379
127.0.0.1:6379 (04f33b8e...) -> 0 keys | 2731 slots | 0 slaves.
127.0.0.1:6382 (39d35937...) -> 0 keys | 2731 slots | 0 slaves.
127.0.0.1:6380 (7976cdeb...) -> 1 keys | 2730 slots | 0 slaves.
127.0.0.1:6381 (268a3906...) -> 6 keys | 2731 slots | 0 slaves.
127.0.0.1:6383 (d4302a52...) -> 1 keys | 2730 slots | 0 slaves.
127.0.0.1:6384 (a28ebb8e...) -> 3 keys | 2731 slots | 0 slaves.
[OK] 11 keys in 6 masters.
0.00 keys per slot on average.
[root@localhost cluster]#

#检查集群状态

[root@localhost cluster]# redis-cli --cluster check 127.0.0.1 6379
127.0.0.1:6379 (04f33b8e...) -> 0 keys | 2731 slots | 0 slaves.
127.0.0.1:6382 (39d35937...) -> 0 keys | 2731 slots | 0 slaves.
127.0.0.1:6380 (7976cdeb...) -> 1 keys | 2730 slots | 0 slaves.
127.0.0.1:6381 (268a3906...) -> 6 keys | 2731 slots | 0 slaves.
127.0.0.1:6383 (d4302a52...) -> 1 keys | 2730 slots | 0 slaves.
127.0.0.1:6384 (a28ebb8e...) -> 3 keys | 2731 slots | 0 slaves.
[OK] 11 keys in 6 masters.
0.00 keys per slot on average.
>>> Performing Cluster Check (using node 127.0.0.1:6379)
M: 04f33b8ebfe689b5841ec5bf2e42a7583d4320ef 127.0.0.1:6379slots:[0-2730] (2731 slots) master
M: 39d35937546e37d31d350d8b8357a1405a6336c7 127.0.0.1:6382slots:[8192-10922] (2731 slots) master
M: 7976cdeba2788063b916bccaac71d06a89ff63c4 127.0.0.1:6380slots:[2731-5460] (2730 slots) master
M: 268a39068026beef18fb5d88410c0d9f72779d4f 127.0.0.1:6381slots:[5461-8191] (2731 slots) master
M: d4302a52d4d67f4834fd9933e0a6286b0d1803aa 127.0.0.1:6383slots:[10923-13652] (2730 slots) master
M: a28ebb8ef8fa184b9b6c2dc080fc7a458b12e228 127.0.0.1:6384slots:[13653-16383] (2731 slots) master
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
[root@localhost cluster]#

#查看redis集群槽位分布 


127.0.0.1:6379> cluster slots
1) 1) (integer) 02) (integer) 27303) 1) "127.0.0.1"2) (integer) 63793) "04f33b8ebfe689b5841ec5bf2e42a7583d4320ef"
2) 1) (integer) 27312) (integer) 54603) 1) "127.0.0.1"2) (integer) 63803) "7976cdeba2788063b916bccaac71d06a89ff63c4"
3) 1) (integer) 54612) (integer) 81913) 1) "127.0.0.1"2) (integer) 63813) "268a39068026beef18fb5d88410c0d9f72779d4f"
4) 1) (integer) 81922) (integer) 109223) 1) "127.0.0.1"2) (integer) 63823) "39d35937546e37d31d350d8b8357a1405a6336c7"
5) 1) (integer) 109232) (integer) 136523) 1) "127.0.0.1"2) (integer) 63833) "d4302a52d4d67f4834fd9933e0a6286b0d1803aa"
6) 1) (integer) 136532) (integer) 163833) 1) "127.0.0.1"2) (integer) 63843) "a28ebb8ef8fa184b9b6c2dc080fc7a458b12e228"
127.0.0.1:6379>

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

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

相关文章

mysql异常数据损坏处理,报错:Operating system error number 2 in a file operation

一、问题描述 某次一线反应,某主库表全部丢失,查看为空,登陆主机查看mysqld.log后报错:Operating system error number 2 in a file operation数据目录OS重装后修改过,但只是指向方式不同,目录还是同一目录…

【绿色版】Mysql下载、安装、配置与使用(保姆级教程)

大家都知道,Mysql安装版的卸载过程非常繁琐,而且卸载不干净会出现许多问题,很容易让大家陷入重装系统的窘境。基于此,博主今天给大家分享绿色版Mysql的安装、配置与使用。 目录 一、Mysql安装、配置与使用 1、下载解压 2、创建…

vue对axios进行请求响应封装

一、原因 像是在一些业务逻辑上,比如需要在请求之前展示loading效果,或者在登录的时候判断身份信息(token)等信息有没有过期,再者根据服务器响应回来的code码进行相应的提示信息。等等在请求之前,之后做的一…

ABAP注释快捷键修改(留着备用)

ABAP注释快捷键修改(留着备用) 在使用ABAP编辑器的时候,原有的添加代码注释和取消代码注释的快捷键未生效,这时我们可以考虑对注释快捷键进行修改 在事务码SE38(ABAP编辑器)屏幕右下角,点击【Options选项】图标 在【键盘】|【命令】输入栏中…

DWM 相关实现代码 [自用]

1. DWM 缩略图和模糊隐藏实现半透明 #include <windows.h> #include <dwmapi.h> #include <string> #pragma comment(lib, "dwmapi.lib")// 检查 UWP 窗口是否可见 bool IsUWPWindowVisible(HWND hwnd) {DWORD cloaked 0;DwmGetWindowAttribute(…

【c语言】玩转文件操作

&#x1f31f;&#x1f31f;作者主页&#xff1a;ephemerals__ &#x1f31f;&#x1f31f;所属专栏&#xff1a;C语言 目录 引言 一、文件的打开和关闭 1.流 2.标准流 3.文本文件和二进制文件 4.控制文件打开与关闭的函数 二、文件的顺序读写 三、文件的随机读写 1…

深入理解OAuth 2.0:原理、流程与实践

一、什么是OAuth 2.0 1. 什么是OAuth 2.0 OAuth 2.0 是一套关于授权的行业标准协议。 OAuth 2.0 允许用户授权第三方应用访问他们在另一个服务提供方上的数据&#xff0c;而无需分享他们的凭据&#xff08;如用户名、密码&#xff09;。 2. OAuth 2.0 应用场景 OAuth 2.0的…

非参数检测6——优缺点

优点&#xff1a; 参量检测的特点在于以似然比处理器为基础&#xff0c;并建立在假定干扰或噪声的统计特性已知的基础上。但实际上&#xff0c;干扰环境往往十分复杂&#xff0c;包括自然和人为因素&#xff0c;且常常随时改变。这使我们很难确定噪声的统计特性。因此人们提出…

服务器U盘安装Centos 7时提示Warning:/dev/root does not exist

这是没有找到正确的镜像路径导致的&#xff0c;我们可以在命令行输入ls /dev看一下有哪些盘符 像图中红色圈起来的就是我插入U盘的盘符&#xff0c;大家的输几盘可能做了多个逻辑盘&#xff0c;这种情况下就可以先将U盘拔掉再ls /dev看一下和刚才相比少了那两个盘符&#xff0c…

在Spring Boot中实现多线程任务调度

在Spring Boot中实现多线程任务调度 大家好&#xff0c;我是微赚淘客系统3.0的小编&#xff0c;也是冬天不穿秋裤&#xff0c;天冷也要风度的程序猿&#xff01; 1. Spring Boot中的任务调度 Spring Boot通过集成Spring框架的Task Execution和Scheduling支持&#xff0c;提供…

Double 4 VR仿真情景实训教学系统在法律专业课堂上的应用

随着科技的飞速发展&#xff0c;VR技术逐渐渗透到各个领域&#xff0c;为教育行业带来了革命性的变化。 VR技术以其独特的沉浸式体验&#xff0c;为法律课堂带来了前所未有的学习体验。通过Double 4 VR仿真情景实训教学系统&#xff0c;学生可以身临其境地进入虚拟的仿真情景中…

vue前端面试

一 .v-if和v-show的区别 v-if 和 v-show 是 Vue.js 中两个常用的条件渲染指令&#xff0c;它们都可以根据条件决定是否渲染某个元素。但是它们之间存在一些区别。 语法&#xff1a;v-if 和 v-show 的语法相同&#xff0c;都接收一个布尔值作为参数。 <div v-if"show…

权力之望怎么下载客户端 权力之望一键下载

《权力之望》是一款由NX3 Games开发、Smilegate发行的多人在线动作MMORPG游戏。这款游戏最大的特点是高度的自由度和丰富的角色定制选项。我们在游戏中不仅可以自由更换武器&#xff0c;而且游戏还提供了54种能力和60多种职业选择&#xff0c;让我们可以根据自己的游戏风格和喜…

继 承

为什么要有继承&#xff0c;继承的作用&#xff1f; 继承(inheritance)机制&#xff1a;是面向对象程序设计使代码可以复用的最重要的手段&#xff0c;它允许程序员在保持原有类特性的基础上进行扩展&#xff0c;增加新功能&#xff0c;这样产生新的类&#xff0c;称派生类。 …

【人工智能】—基于成都市各区(市)县租房价格预测建模研究

引言 随着城市化进程的加速&#xff0c;人口流动日益频繁&#xff0c;租房市场作为城市生活的重要组成部分&#xff0c;其价格波动对居民生活质量和城市经济发展具有显著影响。成都市&#xff0c;作为中国西部地区的经济、文化、交通和科技中心&#xff0c;近年来吸引了大量人…

为什么独立站需要高质量的GPB外链?

独立站需要高质量的GPB外链&#xff0c;主要是因为它们能显著提升网站的可信度和可见性。高质量的外链相当于得到其他权威网站的认可和推荐&#xff0c;这会让搜索引擎认为你的内容有价值&#xff0c;从而提升你的搜索排名。试想一下&#xff0c;当其他有影响力的网站愿意链接到…

非阻塞式 I/O 模型 【NIO】补充内容

NIO是一种同步非阻塞IO, 基于Reactor模型来实现的。其实相当于就是一个线程处理大量的客户端的请求&#xff0c;通过一个线程轮询大量的channel&#xff0c;每次就获取一批有事件的channel&#xff0c;然后对每个请求启动一个线程处理即可。这里的核心就是非阻塞&#xff0c;就…

请求接口在控制台报cors跨域问题

我的问题是&#xff1a;BASE_URL没有和本地IP设置一致 刚开始&#xff1a;&#xff08;这个不是我本地电脑的地址&#xff09; 所以我要把&#xff1a;这个地址改为我本地电脑的ip&#xff08;http://192.168.2.50:8087&#xff09; BASE_URL: http://localhost:8087/api/ 或…

单位电脑文档怎么加密?哪种方法最有效?

单位电脑文档的加密是保障信息安全的重要措施之一&#xff0c;它可以防止未经授权的访问和数据泄露。 选择最佳的加密方法取决于您的具体需求&#xff0c;包括文档的敏感程度、加密的便捷性、成本、以及是否需要跨平台兼容性。下面是几种常见的加密方法及其优缺点&#xff0c;…

【SpringBoot3】结合 gRpc 实现远程服务调用

一、gRPC概念介绍 gRPC&#xff08;Google Remote Procedure Call&#xff0c;Google远程过程调用&#xff09;是一个现代开源高性能远程过程调用(RPC)框架&#xff0c;可以在任何环境中运行。它由Google开发&#xff0c;旨在帮助开发人员更轻松地构建分布式应用&#xff0c;特…