当前位置: 首页 > news >正文

rsync结合inotify实现文件实时同步

rsync

1.复制工具

  • 本地复制 远程复制
    cp dd

  • 跨主机传递文件
    rz sz ftp scp rsync nfs samba drdb

2.rsync作用

实现文件的备份,可以是当前主机,也可以是远程主机;可以完全备份,也可以是增量备份

2.1功能

类似于cp的复制功能
将本地主机的一个文件复制到另一个位置下
将本地主机的文件推送到远程主机;也可以从远程主机拉取到本地

2.2使用模式

  • shell模式:就是本地复制功能
  • 远程shell模式:可以利用ssh来实现数据的加密传输到远程主机
  • 服务器模式:rsync工作在守护进程模式下
  • 列表:ls 显示内容不做操作

备注:确保各个主机时间一致ntpdate

实现文件的时间同步
rsync+inotify
rsync+sersync

rsync:只负责传递文件到远程主机
inotify sersync:将发生改变的文件找出来

2.2.1模式1:local

Local: rsync [OPTION…] SRC… [DEST]

选项:
-v 输出详细过程信息
-a 使用归档模式,如果复制目录必须使用此选项
-z 压缩方式传输
-p复制文件过程,保持文件属性不变
-e “ssh [-p22]”指定所使用的传输通道 -r 递归复制,先复制目录,然后复制子目录

复制的是目录

[LAPTOP-MBCTH7PD]rsync -vz /etc/init.d tmp/
skipping directory init.dsent 8 bytes  received 12 bytes  40.00 bytes/sec
total size is 0  speedup is 0.00

-需要添加参数a

[LAPTOP-MBCTH7PD]rsync -avz /etc/init.d tmp/
sending incremental file list
init.d/
init.d/ftp -> /bin/SCRDAE~1
init.d/http -> /bin/SCRDAE~1
init.d/nfs -> /bin/SCRDAE~1
init.d/ssh -> /bin/SCRDAE~1
init.d/telnet -> /bin/SCRDAE~1
init.d/tftp -> /bin/SCRDAE~1
init.d/vnc -> /bin/SCRDAE~1sent 251 bytes  received 37 bytes  576.00 bytes/sec
total size is 91  speedup is 0.32
2.2.2模式2:Access via remote shell:

Pull: rsync [OPTION…] [USER@]HOST:SRC… [DEST]

Push: rsync [OPTION…] SRC… [USER@]HOST:DEST

 ~/Desktop/tmp
[LAPTOP-MBCTH7PD]touch {1..10}.txt
[LAPTOP-MBCTH7PD]rsync -avz -e "ssh -p22" ./tmp/* root@10.4.7.6:/root/test/
stty: standard input: Inappropriate ioctl for device
X11 forwarding request failed on channel 0
sending incremental file list
1.txt
10.txt
2.txt
3.txt
4.txt
5.txt
6.txt
7.txt
8.txt
9.txtsent 500 bytes  received 208 bytes  83.29 bytes/sec
total size is 4  speedup is 0.01

说明:md5sum在传递文件时候,会首先对比源和目的下的文件的特征码,只有特征码不同的时候,才会进行传递;rsync加ssh密钥认证方式,目的使用免密登录;先配置ssh,然后分发密钥

2.2.3模式3:守护进程模式

准备:关闭selinux;关闭防火墙;同步服务器时间

修改配置文件,让工作在守护进程模式

rsyncd.conf基本构成
全局参数
[模块1]
模块参数
[模块2]
模块参数全局参数:
pid file:指定rsync进程的pid文件的路径和名称
lock file:指定rsync进程的所在文件路径和名称
log file:rsync的日志文件路径和名称
uid:指定rsync进程以什么用户身份运行,必须是系统用户
gid:组用户模块参数:可以先写在全局部分
path:指定备份目录路径
use chroot :是否将用户锁定在家目录中
max connections:指定可以进行同时连接的用户最大数量
read only:只读
write only:只写
list:true|false列表  设置用户可以显示的所有模块名称
auth users:指定访问模块需要使用的用户名,这里指的是虚拟用户
secrets file:虚拟用户名与密码的数据库文件
hosts allow:指定可以访问模块或者rsync服务端的ip地址
hosts deny:黑名单 补充:两个参数都没有,所有用户访问,只有allow,只允许白名单访问,白名单优先级高级黑名单
timeout:指定空闲超时时间
pid file=/var/lock/rsync.pid
lock file=/var/lock/rsync.lock
log file=/var/log/rsync.log[web]
path=/tmp/web
use chroot=no
write only=yes[nfs]
path=/tmp/web
user chroot=no

3.实例

3.1配置服务器端

3.1.1 创建配置文件
[root@harbor etc]# vi /ect/rsyncd.conf
uid = rsync
gid = rsync
use chroot = no
max connection = 100
timeout = 100
pid file = /var/lock/rsync.pid
lock file = /var/lock/rsync.lock
log file =  /var/log/rsync.log[mod1]
path = /rsync/web1
read only = false
hosts allow = 10.4.0.0/8
auth users = vuser1
fake super = yes
secrets file = /rsync/rsync.passwd
list = false[mod2]
path = /rsync/web2
read only = false
hosts allow = 10.4.0.0/8
auth users = vuser2
fake super = yes
secrets file = /rsync/rsync.passwd
list = false
3.1.2.创建目录
[root@harbor ~]# mkdir -pv /rsync/web{1,2}
mkdir: 已创建目录 "/rsync/web1"
mkdir: 已创建目录 "/rsync/web2"
#修改属组
chown rsync:rsync /rsync/web{1,2}
3.1.3.创建用户,运行rsync的系统用户
[root@harbor ~]# grep rsync /etc/passwd
[root@harbor ~]# groupadd -r rsync
[root@harbor ~]# useradd -r -s /sbin/nologin -g rsync rsync

在这里插入图片描述

3.1.4.启动rsync
[root@harbor ~]# rsync --daemon
[root@harbor ~]#
[root@harbor ~]#
[root@harbor ~]# rsync --daemon
failed to create pid file /var/lock/rsync.pid: File exists
# 引用其他配置文件 --config=/path/to/confile
3.1.5.检查rsync端口,默认是873
[root@harbor ~]# ss -lnt|grep 873
LISTEN     0      5            *:873                      *:*
LISTEN     0      5         [::]:873                   [::]:*
[root@harbor ~]# netstat -ntlp|grep 873
tcp        0      0 0.0.0.0:873             0.0.0.0:*               LISTEN      84330/rsync
tcp6       0      0 :::873                  :::*                    LISTEN      84330/rsync
[root@harbor ~]# lsof -i :873
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
rsync   84330 root    3u  IPv4 496039      0t0  TCP *:rsync (LISTEN)
rsync   84330 root    5u  IPv6 496040      0t0  TCP *:rsync (LISTEN)
3.1.6.创建虚拟文件用户
[root@harbor ~]# cd /rsync/
[root@harbor rsync]# touch rsync.passwd
[root@harbor rsync]# chmod 600 rsync.passwd #权限600
[root@harbor rsync]# vi rsync.passwd
vuser1:123456
vuser2:123456

3.2配置客户端

使用格式
rsync [options] [user@]host::moduleName /path/
rsync [options] /path/ [user@]host::moduleName

每次传输需要输入密码

3.2.1.创建密码文件
echo "123456">/etc/rsync.passwd
# 修改所属组
chmod 600 /etc/rsync.passwd
3.2.2.使用rsync来传递数据到服务器的端模块mod1中
rsync -avz /root/test/ vuser1@10.4.7.9::mod1 --password-file=/etc/rsync.passwd

注:–password-file=/etc/rsync.passwd 指定密码文件地址,不需要手动输入密码

报错:rsync: chgrp “.new.txt.FMIDJB” (in mod1) failed: Operation not permitted (1)

[root@hdss7-6 test]# rsync -avz /root/test/ vuser1@10.4.7.9::mod1 --password-file=/etc/rsync.passwd
sending incremental file list
rsync: chgrp "." (in mod1) failed: Operation not permitted (1)
./
new.txt
old.txt
txt.patch
rsync: chgrp ".new.txt.FMIDJB" (in mod1) failed: Operation not permitted (1)
rsync: chgrp ".old.txt.Al48gT" (in mod1) failed: Operation not permitted (1)
rsync: chgrp ".txt.patch.v8rIOa" (in mod1) failed: Operation not permitted (1)sent 349 bytes  received 414 bytes  305.20 bytes/sec
total size is 207  speedup is 0.27
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]

在这里插入图片描述

解决办法:fake super=yes 用于允许非root用户,在备份目录创建文件

[root@hdss7-6 test]# rsync -avz /root/test/ vuser1@10.4.7.9::mod1 --password-file=/etc/rsync.passwd
sending incremental file list
./
new.txt
old.txt
txt.patchsent 379 bytes  received 132 bytes  146.00 bytes/sec
total size is 207  speedup is 0.41

或者解决办法

经排查是由于-a参数导致的,因为-a是归档模式传输,并保持所有文件属性,等价于-rtopgDl(还没有具体深入研究),可以使用下面这个命令替代rsync -rltDvz /opt/ rsync_backup@10.0.0.41::backup

4 总结

4.1服务器端的配置

1.创建配置文件
2.创建密码文件,修改权限为600
3.创建系统用户
4.创建模块对应的目录,修改目录的属主属组为系统用户
5.启动daemon模式

4.2客户端配置:

1.创建虚拟用户的密码文件,权限为600
2.向模块传输文件或者从目录拉取文件

如果出现错误:
1.检查日志
2.检查selinux、iptables是否启动
3.检查虚拟用户的目录权限所有组是否正确,以及secrets密码是600

5.重启服务

[root@harbor rsync]# ps -ef|grep rsync
root      84330      1  0 11:22 ?        00:00:00 rsync --daemon
root      85446  81838  0 11:37 pts/1    00:00:00 grep --color=auto rsync
[root@harbor rsync]# kill -9 84330
[root@harbor rsync]# rsync --daemon
[root@harbor rsync]# failed to create pid file /var/lock/rsync.pid: File exists
[root@harbor rsync]# rm -rf /var/lock/rsync.pid
[root@harbor rsync]# rsync --daemon
[root@harbor rsync]# lsof -i :873
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
rsync   85521 root    3u  IPv4 502792      0t0  TCP *:rsync (LISTEN)
rsync   85521 root    5u  IPv6 502793      0t0  TCP *:rsync (LISTEN)

服务脚本存放位置
CentOS 7及以上版本
系统服务 :存放在 /usr/lib/systemd/system/ 目录下。

用户服务 :存放在 /usr/lib/systemd/user/ 目录下。

CentOS 6
服务脚本通常放在 /etc/init.d/ 目录下。

编写rsync脚本/usr/lib/systemd/system/rsyncd.service

[Unit]
Description=fast remote file copy program daemon
ConditionPathExists=/etc/rsyncd.conf[Service]
EnvironmentFile=/etc/sysconfig/rsyncd
ExecStart=/usr/bin/rsync --daemon --no-detach "$OPTIONS"[Install]
WantedBy=multi-user.target
~

6.执行操作

6.1 10.4.7.6客户端

[root@hdss7-6 ~]# rsync -avz /root/test vuser1@10.4.7.9::mod1
Password:
sending incremental file list
test/
test/10.txt
test/new.txt
test/old.txt
test/txt.patchsent 490 bytes  received 104 bytes  108.00 bytes/sec
total size is 203  speedup is 0.34

6.2 10.4.7.9服务端

[root@harbor web1]# pwd
/rsync/web1
[root@harbor web1]# ls
test
rsync -avz /root/test vuser1@10.4.7.9::mod1 
会将整个test目录传递rsync -avz /root/test/ vuser1@10.4.7.9::mod1
传递目录下面的文件

–delete 让客户端与服务器端的文件完全一致
–exclude 在进行文件传送的时候,排除指定的文件

7. rsync客户端排除指定文件方式

7. 1方式一:排除一个文件–exclude=file

[root@hdss7-6 test]# rsync -avz /root/test/ --exclude=3.txt vuser1@10.4.7.9::mod1
Password:
sending incremental file list
./
1.txt
10.txt
2.txt
4.txt
5.txt
6.txt
7.txt
8.txt
9.txt
new.txt
old.txt
txt.patchsent 887 bytes  received 255 bytes  175.69 bytes/sec
total size is 203  speedup is 0.18

7. 2方式二:排除多个个文件–exclude={file,file2,file3}

[root@hdss7-6 test]# touch {12,13,14}.txt
[root@hdss7-6 test]# ls
10.txt  12.txt  13.txt  14.txt  1.txt  2.txt  3.txt  4.txt  5.txt  6.txt  7.txt  8.txt  9.txt  new.txt  old.txt  txt.patch
[root@hdss7-6 test]# rsync -avz /root/test/ --exclude={3.txt,13.txt,14.txt} vuser1@10.4.7.9::mod1
Password:
sending incremental file list
./
12.txtsent 331 bytes  received 46 bytes  68.55 bytes/sec
total size is 203  speedup is 0.54

7. 3 方式三:通配符的效果

[root@hdss7-6 test]# touch {a,b,c}.txt
[root@hdss7-6 test]# touch {a,b,c}.conf
[root@hdss7-6 test]# rsync -avz /root/test/ --exclude=*.txt vuser1@10.4.7.9::mod1
Password:
sending incremental file list
./
a.conf
b.conf
c.confsent 242 bytes  received 84 bytes  59.27 bytes/sec
total size is 143  speedup is 0.44

7. 4服务端配置

man rsyncd.conf配置文件

 excludeThis parameter takes a space-separated list of daemon exclude patterns.  As with the client --exclude option, patterns can be qualified with "- " or "+ "to explicitly indicate exclude/include.  Only one "exclude" parameter can apply to a given module.  See the "filter" parameter for a description  of  howexcluded files affect the daemon.

修改rsyncd.conf模块的参数exclude,列表以空格分开

exclude =a.txt b.txt c.txt

8.完全同步原理

在文件的传输过程中
–delete 使目标目录内容和源保持目录一致,删除不同的文件
1.测试客户端

[root@hdss7-6 test]# rsync -avz --delete /root/test/ vuser1@10.4.7.9::mod1 --password-file=/etc/rsync.passwd
sending incremental file list
deleting test/txt.patch
deleting test/old.txt
deleting test/new.txt
deleting test/10.txt
deleting test/
deleting txt.patch
deleting old.txt
deleting new.txt
deleting c.conf
deleting b.conf
deleting a.conf
deleting 9.txt
deleting 8.txt
deleting 7.txt
deleting 6.txt
deleting 5.txt
deleting 4.txt
deleting 2.txt
deleting 12.txt
deleting 10.txt
deleting 1.txt
./sent 50 bytes  received 254 bytes  121.60 bytes/sec
total size is 0  speedup is 0.00

拉取文件

[root@hdss7-6 test]# rsync -avz --delete vuser1@10.4.7.9::mod1 /root/test/ --password-file=/etc/rsync.passwd
receiving incremental file list
./
deleting 3.txt
1.txt
2.txtsent 69 bytes  received 171 bytes  96.00 bytes/sec
total size is 0  speedup is 0.00
[root@hdss7-6 test]# ls
1.txt  2.txt

inotify

1.功能

  • 可以监控指定目录下的文件,
  • 当文件发生了更改,则会触发事件,输出触发事件的文件信息
  • 监控事件
    创建
    删除
    修改
    移动

rsync+inotify实现文件实时同步

2.二进制方式安装intoify

2.1 下载安装包

$ wget https://codeload.github.com/rvoicilas/inotify-tools/zip/master 

2.2 编译安装

$ tar zxvf inotify-tools-*.*.tar.gz   
$ cd inotify-tools-*.*  
$ ./configure --prefix=/usr/local/inotify  
$ make && make install  

2.3 查看安装路径

[root@hdss7-6 test]# find /usr/local/ -name "inotify*"
/usr/local/inotify
/usr/local/inotify/share/doc/inotify-tools
/usr/local/inotify/share/man/man1/inotifywait.1
/usr/local/inotify/share/man/man1/inotifywatch.1
/usr/local/inotify/include/inotifytools
/usr/local/inotify/include/inotifytools/inotifytools.h
/usr/local/inotify/include/inotifytools/inotify-nosys.h
/usr/local/inotify/include/inotifytools/inotify.h
/usr/local/inotify/bin/inotifywait
/usr/local/inotify/bin/inotifywatch

2.4 创建软链接

[root@hdss7-6 bin]# ln -s  /usr/local/inotify/bin/inotifywait /usr/bin/inotifywait
[root@hdss7-6 bin]# ln -s  /usr/local/inotify/bin/inotifywatch /usr/bin/inotifywatch

3. inotifywait

inotify安装在客户端
inotifywait :真正实现文件监控程序
inotifywatch:数据统计

inotifywait:

3.1 参数选项

-r 递归,对目录中的子目录中的文件做监控
-q :仅仅打印少量信息打印监控事件
-m 一直处于监控状态 前端运行
-d 以守护进程方式运行 后台运行
-o file:将监控事件输出到文件
-s :将错误信息输出系统日志
—excludei:忽略文件的大小写
-e :指定要监控的事件
access:访问
modify:编辑事件
attrib:修改文件属性 修改文件元数据
close_write:
close_nowrite:
close: 无论以什么方式打开文件
move_to:移除
move:移动
create:创建
delete:删除
–timefmt :指定发生记录的事件的时间点格式
日期格式man date可以查看

  FORMAT controls the output.  Interpreted sequences are:%%     a literal %%a     locale's abbreviated weekday name (e.g., Sun)%A     locale's full weekday name (e.g., Sunday)%b     locale's abbreviated month name (e.g., Jan)%B     locale's full month name (e.g., January)%c     locale's date and time (e.g., Thu Mar  3 23:05:25 2005)%C     century; like %Y, except omit last two digits (e.g., 20)%d     day of month (e.g., 01)%D     date; same as %m/%d/%y%e     day of month, space padded; same as %_d%F     full date; same as %Y-%m-%d%g     last two digits of year of ISO week number (see %G)%G     year of ISO week number (see %V); normally useful only with %V%h     same as %b%H     hour (00..23)%I     hour (01..12)%j     day of year (001..366)%k     hour, space padded ( 0..23); same as %_H%l     hour, space padded ( 1..12); same as %_I%m     month (01..12)%M     minute (00..59)%n     a newline%N     nanoseconds (000000000..999999999)%p     locale's equivalent of either AM or PM; blank if not known%P     like %p, but lower case%r     locale's 12-hour clock time (e.g., 11:11:04 PM)%R     24-hour hour and minute; same as %H:%M%s     seconds since 1970-01-01 00:00:00 UTC%S     second (00..60)%t     a tab%T     time; same as %H:%M:%S%u     day of week (1..7); 1 is Monday%U     week number of year, with Sunday as first day of week (00..53)%V     ISO week number, with Monday as first day of week (01..53)%w     day of week (0..6); 0 is Sunday%W     week number of year, with Monday as first day of week (00..53)%x     locale's date representation (e.g., 12/31/99)%X     locale's time representation (e.g., 23:13:48)%y     last two digits of year (00..99)%Y     year%z     +hhmm numeric time zone (e.g., -0400)%:z    +hh:mm numeric time zone (e.g., -04:00)%::z   +hh:mm:ss numeric time zone (e.g., -04:00:00)%:::z  numeric time zone with : to necessary precision (e.g., -04, +05:30)%Z     alphabetic time zone abbreviation (e.g., EDT)

–format :指定当发生事件以后输出的信息,以及输出的个数
%f:记录发生事件的文件名
%w:记录事件发生的文件所在目录的绝对路径
%e: 记录发生时间的名称 如果多个事件,用空格分割
%xe:记录发生时间的名称 如果多个事件,用x分割
%T: 输出发生事件的事件

3.2 实列

10.4.7.6 inotify

[root@hdss7-6 test]# mkdir {a,b,c}
[root@hdss7-6 test]# mkdir {a1,b1,c1}
[root@hdss7-6 test]# mkdir {a11,b11,c11}
[root@hdss7-6 test]# rm -rf a11
[root@hdss7-6 test]# touch a.txt

监控前端运行 打印少量信息,递归监控子目录

[root@hdss7-6 src]# ./inotifywait  -mrq --timefmt "%F%T" --format '%T %w%f' -e create,delete,modify /root/test
2025-01-1410:34:20 /root/test/a
2025-01-1410:34:20 /root/test/b
2025-01-1410:34:20 /root/test/c
^C
[root@hdss7-6 src]# ./inotifywait  -mrq --timefmt "%F%T" --format '%T %w%f%e' -e create,delete,modify /root/test
2025-01-1410:35:23 /root/test/a1CREATE,ISDIR
2025-01-1410:35:23 /root/test/b1CREATE,ISDIR
2025-01-1410:35:23 /root/test/c1CREATE,ISDIR
^C
[root@hdss7-6 src]# ./inotifywait  -mrq --timefmt "%F%T" --format '%T %w%f %e' -e create,delete,modify /root/test
2025-01-1410:35:53 /root/test/a11 CREATE,ISDIR
2025-01-1410:35:53 /root/test/b11 CREATE,ISDIR
2025-01-1410:35:53 /root/test/c11 CREATE,ISDIR
2025-01-1410:36:20 /root/test/a11 DELETE,ISDIR
2025-01-1410:36:38 /root/test/a.txt CREATE

3.3 创建脚本,将监控变化的文件传递给10.4.7.9服务器

vi rsync_inotify.sh

#!/bin/bash
prog="inotifywait"
events="create,delete,modify,attrib"
iopt="-mrq"lpath="/root/test/"rhost="10.4.7.6"
vuser1="vuser1"
secfile="/etc/rsync.passwd"
ropt="-az --delete"
modName="mod1"$prog $iopt --format "%w%f" -e $event $lpath |while read line
doecho $linersync $ropt $line $vuser1@10.4.7.9::$modName --password-file=$secfile
done

sersync

1.功能简介

rsync+sersync
sersync(也称为rsync inotify)是一个基于rsync和inotify的文件同步工具。它可以在文件发生更改时实时同步文件或目录。

2.安装sersync

10.4.7.6

2.1 下载文件

[root@hdss7-6 ~]# wget https://down.whsir.com/downloads/sersync2.5.4_64bit_binary_stable_final.tar.gz
--2025-01-15 15:51:34--  https://down.whsir.com/downloads/sersync2.5.4_64bit_binary_stable_final.tar.gz
正在解析主机 down.whsir.com (down.whsir.com)... 111.180.191.24
正在连接 down.whsir.com (down.whsir.com)|111.180.191.24|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:727290 (710K) [application/octet-stream]
正在保存至: “sersync2.5.4_64bit_binary_stable_final.tar.gz”100%[==================================================================================================================================>] 727,290     4.16MB/s 用时 0.2s2025-01-15 15:51:34 (4.16 MB/s) - 已保存 “sersync2.5.4_64bit_binary_stable_final.tar.gz” [727290/727290])

2.2 解压文件

[root@hdss7-6 ~]# tar xvf sersync2.5.4_64bit_binary_stable_final.tar.gz -C /root/
GNU-Linux-x86/
GNU-Linux-x86/sersync2
GNU-Linux-x86/confxml.xml

2.3. 创建目录,复制配置文件,移动bin文件

[root@hdss7-6 ~]# mv GNU-Linux-x86 sersync
[root@hdss7-6 ~]# cd sersync
[root@hdss7-6 sersync]# ls
confxml.xml  sersync2
[root@hdss7-6 sersync]# mkdir bin conf logs
[root@hdss7-6 sersync]# cp confxml.xml ./conf/confxml1.xml
[root@hdss7-6 sersync]# mv sersync2 ./bin/sersync
[root@hdss7-6 sersync]# ls
bin  conf  confxml.xml  logs

2.4. 配置文件

1.设置监控事件类型
2.设置rsync服务端的ip,模块名称,本地监控的目录
3.设置传输文件的时候需要身份认证信息相关信息
4.设置传输失败信息记录的文件位置

<?xml version="1.0" encoding="ISO-8859-1"?>
<head version="2.5"><host hostip="localhost" port="8008"></host><debug start="false"/><fileSystem xfs="false"/><filter start="false"><exclude expression="(.*)\.svn"></exclude><exclude expression="(.*)\.gz"></exclude><exclude expression="^info/*"></exclude><exclude expression="^static/*"></exclude></filter><inotify><delete start="true"/><createFolder start="true"/><createFile start="true"/><closeWrite start="false"/><moveFrom start="false"/><moveTo start="false"/><attrib start="true"/><modify start="true"/></inotify><sersync><!--设置rsync服务端的ip,模块名称,本地监控的目录--><localpath watch="/root/test/"><remote ip="10.4.7.9" name="mod1"/><!--<remote ip="192.168.8.39" name="tongbu"/>--><!--<remote ip="192.168.8.40" name="tongbu"/>--></localpath><!--设置传输文件的时候需要身份认证信息相关信息--><rsync><commonParams params="-artuz"/><auth start="true" users="vuser1" passwordfile="/etc/rsync.passwd"/><userDefinedPort start="false" port="874"/><!-- port=874 --><timeout start="false" time="100"/><!-- timeout=100 --><ssh start="false"/></rsync<!--设置传输失败信息记录的文件位置--><failLog path="/tmp/rsync_fail_log.sh" timeToExecute="60"/><!--default every 60mins execute once--><crontab start="false" schedule="600"><!--600mins--><crontabfilter start="false"><exclude expression="*.php"></exclude><exclude expression="info/*"></exclude></crontabfilter></crontab><plugin start="false" name="command"/></sersync><plugin name="command"><param prefix="/bin/sh" suffix="" ignoreError="true"/>	<!--prefix /opt/tongbu/mmm.sh suffix--><filter start="false"><include expression="(.*)\.php"/><include expression="(.*)\.sh"/></filter></plugin><plugin name="socket"><localpath watch="/opt/tongbu"><deshost ip="192.168.138.20" port="8009"/></localpath></plugin><plugin name="refreshCDN"><localpath watch="/data0/htdocs/cms.xoyo.com/site/"><cdninfo domainname="ccms.chinacache.com" port="80" username="xxxx" passwd="xxxx"/><sendurl base="http://pic.xoyo.com/cms"/><regexurl regex="false" match="cms.xoyo.com/site([/a-zA-Z0-9]*).xoyo.com/images"/></localpath></plugin>
</head>

2.5. 配置环境变量

 echo "export PATH=$PATH:/root/sersync/bin/">/etc/profile.d/sersync.sh#配置生效source /etc/profile

2.6. 测试sersync

[root@hdss7-6 sersync]# sersync -h
set the system param
execute:echo 50000000 > /proc/sys/fs/inotify/max_user_watches
execute:echo 327679 > /proc/sys/fs/inotify/max_queued_events
parse the command param
_______________________________________________________
参数-d:启用守护进程模式
参数-r:在监控前,将监控目录与远程主机用rsync命令推送一遍
c参数-n: 指定开启守护线程的数量,默认为10个
参数-o:指定配置文件,默认使用confxml.xml文件
参数-m:单独启用其他模块,使用 -m refreshCDN 开启刷新CDN模块
参数-m:单独启用其他模块,使用 -m socket 开启socket模块
参数-m:单独启用其他模块,使用 -m http 开启http模块
不加-m参数,则默认执行同步程序

2.7. 执行监控命令

#测试同步,没问题执行监控
rsync -artuz -R --delete ./   --include="5.txt" --exclude=*  vuser1@10.4.7.9::mod1 --password-file=/etc/rsync.passwd
#修改权限
[root@hdss7-6 test]# chmod 600 /etc/rsync.passwd
[root@hdss7-6 test]# sersync -rdo /root/sersync/conf/confxml1.xml
set the system param
execute:echo 50000000 > /proc/sys/fs/inotify/max_user_watches
execute:echo 327679 > /proc/sys/fs/inotify/max_queued_events
parse the command param
option: -r      rsync all the local files to the remote servers before the sersync work
option: -d      run as a daemon
option: -o      config xml name:  /root/sersync/conf/confxml1.xml
daemon thread num: 10
parse xml config file
host ip : localhost     host port: 8008
will ignore the inotify createFile event
daemon start,sersync run behind the console
use rsync password-file :
user is vuser1
passwordfile is         /etc/rsync.passwd
config xml parse success
please set /etc/rsyncd.conf max connections=0 Manually
sersync working thread 12  = 1(primary thread) + 1(fail retry thread) + 10(daemon sub threads)
Max threads numbers is: 22 = 12(Thread pool nums) + 10(Sub threads)
please according your cpu ,use -n param to adjust the cpu rate
------------------------------------------
rsync the directory recursivly to the remote servers once
working please wait...
execute command: cd /root/test && rsync -artuz -R --delete ./ vuser1@10.4.7.9::mod1 --password-file=/etc/rsync.passwd >/dev/null 2>&1
[root@hdss7-6 test]# run the sersync:
watch path is: /root/test
#查看进程
[root@hdss7-6 /]# ps -aux|grep sersync
root      16438  0.0  0.0  92324   704 ?        Ssl  16:17   0:00 sersync -rdo /root/sersync/conf/confxml1.xml
root      16486  0.0  0.0 112824   976 pts/0    S+   16:18   0:00 grep --color=auto sersync

2.8. 测试文件

[root@hdss7-6 test]# touch {1,2,3}.txt
[root@hdss7-6 test]# rm -rf {1,2,3}.txt

2.9.在10.4.7.9观察

在这里插入图片描述
在这里插入图片描述

2.10 脚本(后面未测)

#!/bin/bash
flist="/root/test"
path="/tmp/"
backdir="/backup"
dabao='/bak'
serfile="/etc/rsync.passwd"
ipaddr=$(ip addr|sed -n '9p'|egrep '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'|sed -nr 's#^.*inet (.*) brd(.*)$#\1#gp'|sed -rn 's#^(.*)/24#\1#gp')
cp -aL $flist $backdir$bak
[ -d $backdir/$ipaddr ] || mkdir -p $backdir/$ipaddr
cd $backdir
tar -cf $ipaddr`date +%F%T`.tar.gz $bakfind $backdir -mtime +7 -exec rm -rf {} \;
rsync -az -delete $backdir/ vuser1@10.4.7.9::mod1 --password-file=$serfile
[root@harbor bak]# ip addr|sed -n '9p'|egrep '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'|sed -nr 's#^.*inet (.*) brd(.*)$#\1#gp'|sed -rn 's#^(.*)/24#\1#gp'
10.4.7.9

md5验证

[root@harbor bak]# ls
2025-01-16.tar.gz  cron  html  iptables  log  rc.local
[root@harbor bak]# md5sum 2025-01-16.tar.gz
c996fc13e7c80842dc42f3a2148d960c  2025-01-16.tar.gz
[root@harbor bak]# md5sum 2025-01-16.tar.gz >checksum.log
[root@harbor bak]# export LANG=en_US.UTF-8
[root@harbor bak]# md5sum -c checksum.log
2025-01-16.tar.gz: OK
[root@harbor bak]# md5sum /etc/passwd >1.log
[root@harbor bak]# md5sum -c 1.log
/etc/passwd: OK
[root@harbor bak]# find /etc/ -name *.conf |xargs md5sum >2.log
[root@harbor bak]# cat 2.log |less

安装邮件服务

 yum -y install mailx

vi /etc/mail.rc

set bsdcompat
set from="Tracy-5-Cui@163.com"
set smtp=smtp.126.com 
set smtp-auth-user=Tracy-5-Cui@163.com #登录邮箱
set smtp-auth-password=zx1234 #授权码
set smtp-auth=login  #认证方式
echo "this is test for mail"|mail -s "hi qq mail" 1509492514@qq.com

相关文章:

rsync结合inotify实现文件实时同步

rsync 1.复制工具 本地复制 远程复制 cp dd 跨主机传递文件 rz sz ftp scp rsync nfs samba drdb 2.rsync作用 实现文件的备份&#xff0c;可以是当前主机&#xff0c;也可以是远程主机&#xff1b;可以完全备份&#xff0c;也可以是增量备份 2.1功能 类似于cp的复制功能…...

浅谈 PID 控制算法

PID 控制算法概念 在我们的生活中可能大家都没有听说过 PID 控制算法&#xff0c;但它可以说是无处不在&#xff0c;小到空调的温度控制、无人机的精准悬停、机器人运作系统&#xff0c;大到飞机和火箭的飞行姿态控制都有 PID 的身影。 PID 控制算法&#xff0c;即比例 - 积分…...

react中hooks之useId用法总结以及与useRef用法区别

React useId Hook 使用指南 概述 useId 是 React 18 引入的新 Hook&#xff0c;用于生成唯一的 ID&#xff0c;主要用于可访问性&#xff08;accessibility&#xff09;属性。它在服务端和客户端渲染时都能保持一致性。 useId vs useRef useId: 生成稳定的唯一标识符&#…...

Spring Boot AOP实现动态数据脱敏

依赖&配置 <!-- Spring Boot AOP起步依赖 --> <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-aop</artifactId> </dependency>/*** Author: 说淑人* Date: 2025/1/18 23:03* Desc…...

AutoGen入门——快速实现多角色、多用户、多智能体对话系统

1.前言 如https://github.com/microsoft/autogen所述&#xff0c;autogen是一多智能体的框架&#xff0c;属于微软旗下的产品。 依靠AutoGen我们可以快速构建出一个多智能体应用&#xff0c;以满足我们各种业务场景。 本文将以几个示例场景&#xff0c;使用AutoGen快速构建出…...

.NET Framework

.NET Framework 是微软推出的一个软件开发平台&#xff0c;主要用于构建和运行 Windows 应用程序。它是 .NET 生态系统的早期版本&#xff0c;专注于 Windows 平台&#xff0c;并提供了丰富的类库和运行时环境。 注意事项 跨平台限制&#xff1a;.NET Framework 主要适用于 W…...

算法中的移动窗帘——C++滑动窗口算法详解

1. 滑动窗口简介 滑动窗口是一种在算法中常用的技巧&#xff0c;主要用来处理具有连续性的子数组或子序列问题。通过滑动窗口&#xff0c;可以在一维数组或字符串上维护一个固定或可变长度的窗口&#xff0c;逐步移动窗口&#xff0c;避免重复计算&#xff0c;从而提升效率。常…...

DuckDB:Golang操作DuckDB实战案例

DuckDB是一个嵌入式SQL数据库引擎。它与众所周知的SQLite非常相似&#xff0c;但它是为olap风格的工作负载设计的。DuckDB支持各种数据类型和SQL特性。凭借其在以内存为中心的环境中处理高速分析的能力&#xff0c;它迅速受到数据科学家和分析师的欢迎。在这篇博文中&#xff0…...

C++通过输入3D相机像素点集{u、v、z}和机械手世界坐标点集{X、Y、Z}求得变换矩阵RT(眼在手外)

👑主页:吾名招财 👓简介:工科学硕,研究方向机器视觉,爱好较广泛… ​💫签名:面朝大海,春暖花开! C++通过输入3D相机像素点集{u、v、z}和机械手世界坐标点集{X、Y、Z}求得变换矩阵RT(眼在手外) 引言原理简介点集数据(含像素坐标、世界坐标及求解后的变换矩阵)配…...

手机怎么远程操控电脑?

远程看看是一款免费使用的远程控制软件&#xff0c;兼容 Windows、iOS 和 Android 系统&#xff0c;用户可以通过电脑或移动设备轻松远程控制电脑。不仅如此&#xff0c;远程看看还提供了文件传输、在线聊天和隐私屏等实用功能。如果您需要在远程操作时隐藏被控电脑的操作界面&…...

【Golang/gRPC/Nacos】在golang中将gRPC和Nacos结合使用

Nacos与gRPC 前言 关于这部分&#xff0c;前段时间我在看文档以及视频教程的时候&#xff0c;怎么都想不明白&#xff0c;到底为什么要用gRPC是什么&#xff0c;他在项目中应该充当什么样的角色&#xff1f;Nacos又是如何和他结合的&#xff1f; 于是我就决定去看看一些小项…...

数据库-多表关系

项目开发中&#xff0c;在进行数据库表结构设计时&#xff0c;会根据业务需求及业务模块之间的关系&#xff0c;分析并设计表结构。由于业务之间相互关联&#xff0c;所以各个表结构之间也存在着各种联系。 多表关系&#xff1a; 一对多(多对一) 一对一 多对多 多表关系 一对…...

回归算法、聚类算法、决策树、随机森林、神经网络

这也太全了&#xff01;回归算法、聚类算法、决策树、随机森林、神经网络、贝叶斯算法、支持向量机等十大机器学习算法一口气学完&#xff01;_哔哩哔哩_bilibili 【线性回归、代价函数、损失函数】动画讲解_哔哩哔哩_bilibili 14分钟详解所有机器学习算法&#xff1a;…...

RabbitMQ1-消息队列

目录 MQ的相关概念 什么是MQ 为什么要用MQ MQ的分类 MQ的选择 RabbitMQ RabbitMQ的概念 四大核心概念 RabbitMQ的核心部分 各个名词介绍 MQ的相关概念 什么是MQ MQ(message queue)&#xff0c;从字面意思上看&#xff0c;本质是个队列&#xff0c;FIFO 先入先出&am…...

第17章:Python TDD回顾与总结货币类开发

写在前面 这本书是我们老板推荐过的&#xff0c;我在《价值心法》的推荐书单里也看到了它。用了一段时间 Cursor 软件后&#xff0c;我突然思考&#xff0c;对于测试开发工程师来说&#xff0c;什么才更有价值呢&#xff1f;如何让 AI 工具更好地辅助自己写代码&#xff0c;或许…...

7、数组知识点汇总

一、 数组基本概念 程序算法数据结构 算法&#xff1a;解决程序的流程步骤数据结构&#xff1a;将数据按照某种特定的结构来存储设计良好的数据结构会导致良好的算法。ArrayList、LinkedList 数组是最简单的数据结构。 1、数组&#xff1a; 数组&#xff1a;存放同一种类型…...

蓝桥杯c/c++需要掌握的基础语法总结

1、#include<bits/stdc.h> 万能头文件 2、using namespace std&#xff1b; 3、输出 cout<<""<<end1; (换行) printf(""); 4、int x3&#xff1b;整数 double d3.14&#xff1b;小数 char ch’A‘;字符 char s[]"Hell…...

学习第七十四行

qt调用信号与槽机制&#xff1a; MOC查找头文件中的signal与slots&#xff0c;标记出信号槽。将信号槽信息储存到类静态变量staticMetaObject中&#xff0c;并按照声明的顺序进行存放&#xff0c;建立索引。connect链接&#xff0c;将信号槽的索引信息放到一个双向链表中&…...

《罗宾逊-旅途VR》Build2108907官方学习版

《罗宾逊-旅途VR》官方版 https://pan.xunlei.com/s/VODiY5gn_fNxKREdVRdwVboCA1?pwdsh3f# 从第一人称的角度进行探索&#xff0c;玩家将遇到一系列恐龙和生物&#xff0c;这些恐龙和生物会对它们在泰森三世生态系统中的存在做出反应。强调与周围环境的互动&#xff0c;鼓励玩…...

详解共享WiFi小程序怎么弄!

在数字化时代&#xff0c;共享WiFi项目​正逐渐成为公共场所的新标配&#xff0c;它不仅为用户提供了便捷的上网方式&#xff0c;还为商家带来了额外的收入来源。那么共享wifi怎么弄&#xff0c;如何搭建并运营一个成功的共享WiFi项目呢&#xff1f; 共享WiFi项目通过在公共场所…...

Glide加载gif遇到的几个坑

Glide本身支持gif格式的动画加载&#xff0c;但是大多数情况下我们用Glide都是去加载一些静态图片&#xff0c;加载gif动态图的需求不是很多&#xff0c;因此这次使用Glide加载gif就遇到了一些令人匪夷所思的问题 问题一&#xff1a;加载gif图片会有明显的卡顿 通常情况下我们…...

mybatis(19/134)

大致了解了一下工具类&#xff0c;自己手敲了一边&#xff0c;java的封装还是真的省去了很多麻烦&#xff0c;封装成一个工具类就可以不用写很多重复的步骤&#xff0c;一个工厂对应一个数据库一个environment就好了。 mybatis中调用sql中的delete占位符里面需要有字符&#xf…...

部分“古董机”编程读取文件时出现文件损坏的简易处理办法(简单粗暴) - 随笔

在部分老旧计算机&#xff08;通常被戏称为“古董机”&#xff09;上编程&#xff0c;读取文件时可能会遇到文件损坏的问题。这通常是由于硬件性能限制或操作系统的文件处理机制导致的。本文将介绍几种简易的处理办法&#xff0c;以解决或绕过这一问题。 方法1. 调整磁盘关闭时…...

StarRocks 3.4 发布--AI 场景新支点,Lakehouse 能力再升级

自 StarRocks 3.0 起&#xff0c;社区明确了以 Lakehouse 为核心的发展方向。Lakehouse 的价值在于融合数据湖与数据仓库的优势&#xff0c;能有效应对大数据量增长带来的存储成本压力&#xff0c;做到 single source of truth 的同时继续拥有极速的查询性能&#xff0c;同时也…...

强化学习入门--基本概念

强化学习基本概念 grid-world example 这个指的是一个小机器人&#xff08;agent&#xff09;在一个网格区域&#xff08;存在边界&#xff09;&#xff0c;网格中存在需要躲避的格子和目标格子&#xff0c;我们的目的就是找到到达目标格子的最短路径 state 表示智能体相对…...

Oracle 创建并使用外部表

目录 一. 什么是外部表二. 创建外部表所在的文件夹对象三. 授予访问外部表文件夹的权限3.1 DBA用户授予普通用户访问外部表文件夹的权限3.2 授予Win10上的Oracle用户访问桌面文件夹的权限 四. 普通用户创建外部表五. 查询六. 删除 一. 什么是外部表 在 Oracle 数据库中&#x…...

深度学习python基础(第三节) 函数、列表

本节主要介绍函数、列表的基本语法格式。 函数 与c语言的函数差不多&#xff0c;就是语法基本格式不同。 name "loveyou" length len(name) print("字符串的长度为&#xff1a;%d" % length) # 自定义函数 def countstr(data):count 0for i in da…...

基于Python的多元医疗知识图谱构建与应用研究(上)

一、引言 1.1 研究背景与意义 在当今数智化时代,医疗数据呈爆发式增长,如何高效管理和利用这些数据,成为提升医疗服务质量的关键。传统医疗数据管理方式存在数据孤岛、信息整合困难等问题,难以满足现代医疗对精准诊断和个性化治疗的需求。知识图谱作为一种知识表示和管理…...

Spring Boot 快速创建项目

目录 一. 创建项目 ​编辑 二. 项目目录 三. 运行项目 (1) 启动项目 (2) 输出HelloWorld 一. 创建项目 我们以idea专业版为例创建Spring项目: 步骤: (1) File --> New --> Project (2) 配置项目基本信息 (3) 依赖: 需要什么就勾选什么. 我们这里就只勾选一个Spri…...

MySQL预编译语句过多告警排查

业务背景 在使用Spring Cloud Alibaba搭建的微服务架构中&#xff0c;项目采用ShardingSphere进行分库分表&#xff0c;MyBatis-Plus作为持久层。线上环境突发大量预编译语句过多的数据库告警&#xff0c;导致系统性能下降。 排查过程 1. 初步排查&#xff1a;联系云数据库厂…...

在centos上编译安装opensips【初级-默认安装】

环境&#xff1a;centos9 last opensips3.2 dnf update -y dnf install -y gcc make git automake libtool pcre-devel libxml2-devel \libcurl-devel postgresql-devel \bzip2-devel zlib-devel ncurses-devel libuuid-devel \libpcap-devel # 有报错的直接删除cd /usr/lo…...

偏序关系.

一、偏序&#xff08;半序&#xff09;关系 偏序关系 自反反对称传递性 二、全序&#xff08;线序、链&#xff09;关系 三、偏序集中的重要元素 1. 极大元与极小元 极大元找所在集合的一个或几个最高点&#xff1b; 极小元找所在集合的一个或几个最低点。 2. 最大元与最小…...

Node.js接收文件分片数据并进行合并处理

前言&#xff1a;上一篇文章讲了如何进行文件的分片&#xff1a;Vue3使用多线程处理文件分片任务&#xff0c;那么本篇文章主要看一下后端怎么接收前端上传来的分片并进行合并处理。 目录&#xff1a; 一、文件结构二、主要依赖1. express2. multer3. fs (文件系统模块)4. pat…...

设计模式概述 - 设计模式的重要性

引言 设计模式是软件工程中用于解决常见设计问题的经典解决方案。它们提供了一种标准化的方式来组织和设计代码&#xff0c;使得代码更易于理解、维护和扩展。在C编程中&#xff0c;设计模式尤为重要&#xff0c;因为它们可以帮助开发者应对复杂的系统设计&#xff0c;提高代码…...

OSI5GWIFI自组网协议层次对比

目录 5G网络5G与其他协议栈各层映射 5G网络 物理层 (PHY) 是 5G 基站协议架构的最底层&#xff0c;负责将数字数据转换为适合无线传输的信号&#xff0c;并将接收到的无线信号转换为数字数据。实现数据的编码、调制、多天线处理、资源映射等操作。涉及使用新的频段&#xff08…...

网络安全(渗透)

目录 名词解释 2、相互关系 3. 安全影响 名词解释 1、poc、exp、payload与shellcode POC&#xff08;Proof of Concept&#xff09;&#xff1a; 是一种概念验证代码或演示程序&#xff0c;用于证明漏洞的存在。 主要目的是通过简单的代码或操作向安全研究人员、开发人员…...

Whisper-GPT:混合表征音频大语言模型

Whisper-GPT:混合表征音频大语言模型 当下,利用从神经压缩算法(例如#Encodec#​)派生的离散音频标记的生成式音频、语音以及音乐模型数量激增。然而,这种方法的主要缺陷之一在于对上下文长度的处理。如果必须考虑所有不同频率的音频内容才能进行下一个标记预测,那么高保…...

科技重塑未来:前沿技术趋势、跨领域融合与社会影响深度洞察

目录 科技重塑未来&#xff1a;前沿技术趋势、跨领域融合与社会影响深度洞察引言一、前沿技术趋势洞察与分析1. 人工智能与自动化1.1 趋势分析1.2 挑战分析 2. 区块链技术2.1 趋势分析2.2 挑战分析 3. 量子计算3.1 趋势分析3.2 挑战分析 二、跨领域技术融合与创新实践1. AI与大…...

深度学习:大模型Decoding+MindSpore NLP分布式推理详解

大模型推理流程 1. 用户输入提示词&#xff08;Prompt&#xff09; 假设用户输入为&#xff1a;“从前&#xff0c;有一只小猫&#xff0c;它喜欢……” 我们的目标是让模型生成一段完整的故事。 2. 模型处理用户输入 2.1 分词&#xff1a;输入提示被分词为模型可以理解的…...

GESP6级语法知识(二):动态规划算法(二)

最小路径和; //最小路径和 #include<iostream> using namespace std; const int N100; int dp[N][N],value[N][N]; int n,m; int main() {cin>>n>>m;for(int i1;i<n;i) //录入初始数字矩阵 for(int j1;j<m;j)cin>>value[i][j];for(int i1;i…...

数据结构与算法之递归: LeetCode 79. 单词搜索 (Ts 版)

单词搜索 https://leetcode.cn/problems/word-search/description/ 描述 给定一个 m x n 二维字符网格 board 和一个字符串单词 word 。如果 word 存在于网格中&#xff0c;返回 true &#xff1b;否则&#xff0c;返回 false 单词必须按照字母顺序&#xff0c;通过相邻的单…...

智能系统的感知和决策

智能系统在感知和决策过程中具备的关键能力表现在智能感知/自主判定上&#xff0c;下面可以从感知的本质、自主判断的含义及其在智能系统中的作用进行深入分析。 1、智能感知&#xff1a;信息获取与理解 智能感知是指智能系统通过传感器或其他数据采集手段获取环境中的信息&…...

多线程之旅:线程安全问题

之前说到了多线程的创建和一些属性等等&#xff0c;接下来&#xff0c;就来讲讲多线程安全问题。 小编引入这段代码讲解下&#xff1a; public class Demo13 {public static int count0;public static void main(String[] args) throws InterruptedException {Thread t1new…...

用java配合redis 在springboot上实现令牌桶算法

令牌桶算法配合 Redis 在 Java 中的应用令牌桶算法是一种常用的限流算法&#xff0c;适用于控制请求的频率&#xff0c;防止系统过载。结合 Redis 使用可以实现高效的分布式限流。 一.、引入依赖首先&#xff0c;需要在 pom.xml 文件中引入 spring-boot-starter-data-re…...

科学计算库NumPy

NumPy是高性能科学计算和数据分析的基础包。 认识NumPy数据对象 n维数组对象ndarray(array) 数组是编程语言中重要且复杂的数据结构&#xff0c;它是由相同类型元素按照一定的顺序排列的集合。ndarray具有矢量算术能力和复杂的广播能力。 - 维度又称为维数&#xff0c;在数学…...

【大数据】机器学习----------强化学习机器学习阶段尾声

一、强化学习的基本概念 注&#xff1a; 圈图与折线图引用知乎博主斜杠青年 1. 任务与奖赏 任务&#xff1a;强化学习的目标是让智能体&#xff08;agent&#xff09;在一个环境&#xff08;environment&#xff09;中采取一系列行动&#xff08;actions&#xff09;以完成一个…...

Unicode不可见字符

场景复现 在访问 https://dotnet.microsoft.com/zh-cn/apps/aspnet地址时 突然出现 https://dotnet.microsoft.com/zh-cn/apps/aspnet%E2%80%8C%E2%80%8C 但是正常来看&#xff0c;这个地址后面是没有%E2%80%8C%E2%80%8C的&#xff0c;粘贴到idea里发现了url地址后面还拼接了2…...

w172二手车交易系统的设计与实现

&#x1f64a;作者简介&#xff1a;多年一线开发工作经验&#xff0c;原创团队&#xff0c;分享技术代码帮助学生学习&#xff0c;独立完成自己的网站项目。 代码可以查看文章末尾⬇️联系方式获取&#xff0c;记得注明来意哦~&#x1f339;赠送计算机毕业设计600个选题excel文…...

TRELLIS微软的图生3D

TRELLIS 教程目录&#xff1a; Youtube&#xff1a;https://www.youtube.com/watch?vJqFHZ-dRMhI 官网地址&#xff1a;https://trellis3d.github.io/ GitHub&#xff1a;https://github.com/Microsoft/TRELLIS 部署目录&#xff1a; 克隆项目 git clone --recurse-submodul…...

【力扣:新动计划,编程入门 —— 题解 ①】

向前看&#xff0c;总会有新的故事值得期盼 —— 25.1.21 2235. 两整数相加 给你两个整数 num1 和 num2&#xff0c;返回这两个整数的和。 示例 1&#xff1a; 输入&#xff1a;num1 12, num2 5 输出&#xff1a;17 解释&#xff1a;num1 是 12&#xff0c;num2 是 5 &#x…...