Linxu服务器文件双向同步 rsync+sersync 详细讲解

文章目录

  • Linxu服务器文件双向同步 rsync+sersync
    • 基础信息
  • 安装
    • rsync
      • 安装
      • 配置
      • 根据配置文件创建相应的目录、文件、防火墙规则
        • 创建需要同步的目录
        • 创建同步用户
        • 防火墙
      • 启动rsyncd服务
      • 测试
      • 异常处理
    • sersync
      • 安装
      • sersync配置
        • test21配置
        • test22配置
      • sersync启动
        • test21启动
        • test22启动
      • 测试
        • 新增文件
        • 修改内容
        • 删除文件

Linxu服务器文件双向同步 rsync+sersync

基础信息

系统:Centos7.8

  • 服务器信息
服务器IP
test2110.8.10.21
test2210.8.10.22
  • 软件版本信息
软件包版本
rsync
sersync

Rsync安装包下载地址:https://github.com/WayneD/rsync/releases

sersync下载地址:https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/sersync/sersync2.5.4_64bit_binary_stable_final.tar.gz

安装

rsync

安装

查看是否已经安装

rpm -qa | grep rsync

安装

yum -y install rsync

配置

  • 修改test21服务器文件/etc/rsyncd.conf
# /etc/rsyncd: configuration file for rsync daemon mode# See rsyncd.conf man page for more options.# configuration example:uid = root      # 指定运行rsync daemon的用户
gid = root      # 指定运行rsync daemon的组
use chroot = no
address = 10.8.10.21 # 指定监听地址
port = 873      # 默认监听端口
max connections = 0     #最大连接数,0为无限制
pid file = /var/run/rsyncd.pid  # 指定pid文件
log file = /var/log/rsyncd.log # 指定日志文件
exclude = lost+found/   # 指定不同步的目录
ignore errors
#transfer logging = yes
#timeout = 900
#ignore nonreadable = yes
#dont compress   = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2# [ftp]
#        path = /home/ftp
#        comment = ftp export area
[update]        # update模块
path = /root/updatedir  # update模块需要同步目录
comment = test rsync + sersync  # update模块的简要说明
read only = no  # 是否只读
list = no       # 当用户查询该服务器上的可用模块时,是否列出该模块
auth users = rsync_daemon        # 同步文件使用到的虚拟用户
secrets file = /etc/rsync_update.passwd # 指定该虚拟用户对应的密码文件,该文件权限为(400)
hosts allow = 10.8.10.22     # 指定可以连接该模块的主机(x.x.x.x x.x.x.x/x)
  • 修改test22服务器文件/etc/rsyncd.conf
# /etc/rsyncd: configuration file for rsync daemon mode# See rsyncd.conf man page for more options.# configuration example:uid = root      # 指定运行rsync daemon的用户
gid = root      # 指定运行rsync daemon的组
use chroot = no
address = 10.8.10.22 # 指定监听地址
port = 873      # 默认监听端口
max connections = 0     #最大连接数,0为无限制
pid file = /var/run/rsyncd.pid  # 指定pid文件
log file = /var/log/rsyncd.log # 指定日志文件
exclude = lost+found/   # 指定不同步的目录
ignore errors
#transfer logging = yes
#timeout = 900
#ignore nonreadable = yes
#dont compress   = *.gz *.tgz *.zip *.z *.Z *.rpm *.deb *.bz2# [ftp]
#        path = /home/ftp
#        comment = ftp export area
[update]        # update模块
path = /root/updatedir  # update模块需要同步目录
comment = test rsync + sersync  # update模块的简要说明
read only = no  # 是否只读
list = no       # 当用户查询该服务器上的可用模块时,是否列出该模块
auth users = rsync_daemon        # 同步文件使用到的虚拟用户
secrets file = /etc/rsync_update.passwd # 指定该虚拟用户对应的密码文件,该文件权限为(400)
hosts allow = 10.8.10.21     # 指定可以连接该模块的主机(x.x.x.x x.x.x.x/x)

根据配置文件创建相应的目录、文件、防火墙规则

创建需要同步的目录

在两个服务器上分别创建需要同步的目录

[root@test21 ~]# mkdir /root/updatedir
[root@test22 ~]# mkdir /root/updatedir

创建同步用户

创建虚拟用户rsync_daemon使用的密码文件/etc/rsync_update.passwd

该文件的权限必须为400

[root@test21 ~]# echo "rsync_daemon:123456789" > /etc/rsync_update.passwd
[root@test21 updatedir]# chmod 400 /etc/rsync_update.passwd
[root@test22 ~]# echo "rsync_daemon:123456789" > /etc/rsync_update.passwd
[root@test22 updatedir]# chmod 400 /etc/rsync_update.passwd

防火墙

这里我是关闭了防火墙,如果防火墙开启,防火墙规则要将873端口加入

启动rsyncd服务

[root@test21 ~]# systemctl start rsyncd
[root@test22 ~]# systemctl start rsyncd
  • 查看端口
[root@test21 /]# ss -antuple | grep 873
tcp    LISTEN     0      5      10.8.10.21:873                   *:*                   users:(("rsync",pid=14221,fd=3)) ino:72483 sk:ffff8800b7d75d00 <->[root@test22 ~]# ss -antuple | grep 873
tcp    LISTEN     0      5      10.8.10.22:873                   *:*                   users:(("rsync",pid=1735,fd=3)) ino:29740 sk:ffff880226eb87c0 <->

测试

  • test21test22同步
[root@test21 updatedir]# ls
[root@test21 updatedir]# touch file{1..5}
[root@test21 updatedir]# rsync -av /root/updatedir/ rsync_daemon@10.8.10.22::update
Password: 
sending incremental file list
./
file1
file2
file3
file4
file5sent 314 bytes  received 114 bytes  171.20 bytes/sec
total size is 0  speedup is 0.00

test22服务器查看

[root@test22 updatedir]# ls
file1  file2  file3  file4  file5
  • test22test21同步
# 创建file6 - file10 空文件
[root@test22 updatedir]# touch file{6..10}
# 文件同步
[root@test22 updatedir]# rsync -av /root/updatedir/ rsync_daemon@10.8.10.21::update
Password: 
sending incremental file list
./
file10
file6
file7
file8
file9sent 388 bytes  received 114 bytes  111.56 bytes/sec
total size is 0  speedup is 0.00

test21服务器查看

[root@test21 updatedir]# ls
file1  file10  file2  file3  file4  file5  file6  file7  file8  file9

rsync数据同步成功,我们可以设置linxu定时任务crontab每隔一段时间自动双向同步文件。

异常处理

  • 提示权限不足

test22发送到test21可以正常发送,test21发送到test22无法发送

[root@test21 updatedir]# rsync -av /root/updatedir/ rsync_daemon@10.8.10.22::update
Password: 
sending incremental file list
rsync: failed to set times on "." (in update): Permission denied (13)
./
file1
file2
file3
file4
file5
rsync: mkstemp ".file1.PRynLL" (in update) failed: Permission denied (13)
rsync: mkstemp ".file2.L3Zgd2" (in update) failed: Permission denied (13)
rsync: mkstemp ".file3.t4KaFi" (in update) failed: Permission denied (13)
rsync: mkstemp ".file4.PZF46y" (in update) failed: Permission denied (13)
rsync: mkstemp ".file5.NOJYyP" (in update) failed: Permission denied (13)

报错后查看网上各种资料描述,说是目录权限改为755等,试了之后都不行

随后又增加了一台服务器做测试,发现新增的也不行

[root@test22 etc]# rsync -av /root/updatedir/ root@10.8.10.20::update
Password: 
sending incremental file list
rsync: failed to set times on "." (in update): Permission denied (13)
rsync: recv_generator: failed to stat "123" (in update): Permission denied (13)
./sent 59 bytes  received 173 bytes  51.56 bytes/sec
total size is 0  speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1179) [sender=3.1.2]

后来在stackoverflow发现有大佬提示说selinux问题导致,我们查看服务器配置

参考文献:https://stackoverflow.com/questions/11039559/rsync-mkstemp-failed-permission-denied-13

[root@test21 etc]# getenforce 
Permissive
[root@test20 updatedir]# getenforce
Enforcing
[root@test22 etc]# getenforce
Enforcing

发现的确21和22,20配置不同

修改22,20配置

[root@test20 updatedir]# setenforce 0
[root@test20 updatedir]# getenforce
Permissive[root@test22 etc]# setenforce 0
[root@test22 etc]# getenforce
Permissive

setenforce 0为临时修改,永久修改vim /etc/sysconfig/selinux

SELINUX=enforcing
修改为
SELINUX=disable 或者 SELINUX=permissive

再次执行发现可以同步成功

[root@test22 etc]# rsync -av /root/updatedir/ root@10.8.10.20::update
Password: 
sending incremental file list
./
123sent 102 bytes  received 38 bytes  40.00 bytes/sec
total size is 0  speedup is 0.00[root@test22 etc]# rsync -av /root/updatedir/ root@10.8.10.20::update
Password: 
sending incremental file list
./
123sent 102 bytes  received 38 bytes  40.00 bytes/sec
total size is 0  speedup is 0.00

sersync

上面安装完成rsync,我们只能通过定时任务触发文件同步,sersync可以对文件的变更进行实时监听,并触发rsync对变更的文件进行实时同步。

安装

下载:[点击下载]

将文件放在两台服务器中,并解压

[root@test22 sersync]# ll
总用量 712
-rw-------. 1 root root 727290 1110 13:11 sersync2.5.4_64bit_binary_stable_final.tar.gz
[root@test22 sersync]# pwd
/opt/sersync
[root@test22 sersync]# tar -zxvf sersync2.5.4_64bit_binary_stable_final.tar.gz 
GNU-Linux-x86/
GNU-Linux-x86/sersync2
GNU-Linux-x86/confxml.xml
[root@test22 sersync]# ls GNU-Linux-x86/
confxml.xml  sersync2[root@test21 sersync]# ll
总用量 712
-rw-------. 1 root root 727290 1110 13:11 sersync2.5.4_64bit_binary_stable_final.tar.gz
[root@test21 sersync]# pwd
/opt/sersync
[root@test21 sersync]# tar -zxvf sersync2.5.4_64bit_binary_stable_final.tar.gz 
GNU-Linux-x86/
GNU-Linux-x86/sersync2
GNU-Linux-x86/confxml.xml
[root@test21 sersync]# ls GNU-Linux-x86/
confxml.xml  sersync2

sersync配置

test21配置

内容过多只显示了修改的位置,其他都是默认的

  1. <remote ip="10.8.10.22" name="update"/>

  2. <auth start="true" users="rsync_daemon" passwordfile="/etc/rsync.pas"/>

[root@test21 GNU-Linux-x86]# vim confxml.xml
...
<sersync><localpath watch="/opt/updatedir"><remote ip="10.8.10.22" name="update"/><!--<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="rsync_daemon" passwordfile="/etc/rsync.pas"/><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>
...
  • watch 指定了监控的文件目录
  • remote ip 指定远程rsync服务监听的ip,
  • name 指定了远程rsync服务开启的模块
  • start=“true” 说明远程rsync服务开启了用户密码验证
  • users 指定了远程rsync服务用户密码验证指定的虚拟用户
  • passwordfile 指定了连接远程rsync服务虚拟用户的密码文件,权限需为400,用户自己手动创建

创建密码文件

[root@test21 GNU-Linux-x86]# echo 123456789 > /etc/rsync.pas
[root@test21 GNU-Linux-x86]# chmod 400 /etc/rsync.pas

test22配置

[root@test22 GNU-Linux-x86]# vim confxml.xml
...
<sersync><localpath watch="/opt/updatedir"><remote ip="10.8.10.21" name="update"/><!--<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="rsync_daemon" passwordfile="/etc/rsync.pas"/><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>
...

创建密码文件

[root@test22 GNU-Linux-x86]# echo 123456789 > /etc/rsync.pas
[root@test22 GNU-Linux-x86]# chmod 400 /etc/rsync.pas

sersync启动

test21启动

[root@test21 updatedir]# /opt/sersync/GNU-Linux-x86/sersync2 -d -r -o /opt/sersync/GNU-Linux-x86/confxml.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: -d 	run as a daemon
option: -r 	rsync all the local files to the remote servers before the sersync work
option: -o 	config xml name:  /opt/sersync/GNU-Linux-x86/confxml.xml
daemon thread num: 10
parse xml config file
host ip : localhost	host port: 8008
daemon start,sersync run behind the console 
use rsync password-file :
user is	rsync_daemon
passwordfile is 	/etc/rsync.pas
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/updatedir && rsync -artuz -R --delete ./ rsync_daemon@10.8.10.22::update --password-file=/etc/rsync.pas >/dev/null 2>&1 
run the sersync: 
watch path is: /root/updatedir
  • -d 以后台daemon的方式运行
  • -r 第一次启动时,使用rsync将本地文件全部同步至远程服务器。
  • -o 加载配置文件

test22启动

[root@test22 updatedir]# /opt/sersync/GNU-Linux-x86/sersync2 -d -r -o /opt/sersync/GNU-Linux-x86/confxml.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: -d 	run as a daemon
option: -r 	rsync all the local files to the remote servers before the sersync work
option: -o 	config xml name:  /opt/sersync/GNU-Linux-x86/confxml.xml
daemon thread num: 10
parse xml config file
host ip : localhost	host port: 8008
daemon start,sersync run behind the console 
use rsync password-file :
user is	rsync_daemon
passwordfile is 	/etc/rsync.pas
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/updatedir && rsync -artuz -R --delete ./ rsync_daemon@10.8.10.21::tongbu1 --password-file=/etc/rsync.pas >/dev/null 2>&1 
run the sersync: 
watch path is: /root/updatedir

测试

新增文件

test21上传一个文件,在test22查看也同时存在

[root@test21 updatedir]# ll
总用量 4
-rw-------. 1 root root 253 1110 11:12 1.sh[root@test22 updatedir]# ll
总用量 4
-rw-------. 1 root root 253 1110 11:12 1.sh

修改内容

修改test22

[root@test22 updatedir]# ll
总用量 4
-rw-------. 1 root root 253 1110 11:12 1.sh
[root@test22 updatedir]# echo 1 > 1.sh 
[root@test22 updatedir]# ll
总用量 4
-rw-------. 1 root root 2 1110 13:59 1.sh
[root@test22 updatedir]# cat 1.sh 
1

查看test21发现修改的内容同步成功

[root@test21 updatedir]# cat 1.sh 
1

删除文件

删除test21文件

[root@test21 updatedir]# rm 1.sh 
rm:是否删除普通文件 "1.sh"?y
[root@test21 updatedir]# ll
总用量 0

test22 查看发现文件也同步删除

[root@test22 updatedir]# ll
总用量 0

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

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

相关文章

resize和reverse的区别

首先&#xff0c;两个函数的功能是有区别的&#xff1a; reserve是容器预留空间&#xff0c;但并不真正创建元素对象&#xff0c;在创建对象之前&#xff0c;不能引用容器内的元素&#xff0c;因此当加入新的元素时&#xff0c;需要用push_back()/insert()函数。 resize是…

数据结构实验之二叉树五:层序遍历

题目描述 已知一个按先序输入的字符序列&#xff0c;如abd,,eg,,,cf,,,(其中,表示空结点)。请建立二叉树并求二叉树的层次遍历序列。 输入 输入数据有多行&#xff0c;第一行是一个整数t (t<1000)&#xff0c;代表有t行测试数据。每行是一个长度小于50个字符的字符串。输出 …

java中字符编码详解

字符编码的发展历程: 阶段1: 计算机只认识数字,我们在计算机里一切数据都是以数字来表示,因为英文符号有限, 所以规定使用的字节的最高位是0.每一个字节都是以0~127之间的数字来表示,比如A对应65,a对应97. 这就是美国标准信息交换码-ASCII. 阶段2: 随着计算机在全球的普及…

Elasticsearch Pipeline 详解

文章目录Ingest Node简介 Ingest Node简介 Pipeline、ProcessorsPipeline 定义简介 Simulate Pipeline API访问 Pipeline 中的内容Processors 类型详解Append ProcessorConvert ProcessorDate ProcessorDate Index Name ProcessorFail ProcessorForeach ProcessorGrok Processo…

java中的包装流和缓冲流概述

处理流/包装流(相对于节点流更高级)装饰设计模式/包装模式: 1:隐藏了底层的节点流的差异,并对外提供了更方便的输入/输出功能,让我们只关心高级流的操作. 2:使用处理流包装了节点流,程序直接操作处理流,让节点流与底层的设备做IO操作. 3:只需要关闭处理流即可. 包装流如何区…

数据结构实验之二叉树七:叶子问题

题目描述 已知一个按先序输入的字符序列&#xff0c;如abd,,eg,,,cf,,,(其中,表示空结点)。请建立该二叉树并按从上到下从左到右的顺序输出该二叉树的所有叶子结点。 输入 输入数据有多行&#xff0c;每一行是一个长度小于50个字符的字符串。输出 按从上到下从左到右的顺序输出…

vi/vim 光标移动命令

移动光标 上:k nk:向上移动n行 9999k或gg可以移到第一行 G移到最后一行 下:j nj:向下移动n行 左:h nh:向左移动n列 右:l nl:向右移动n列 w&#xff1a;光标以单词向前移动 nw&#xff1a;光标向前移动n个单词 光标到单词的第一个字母上 b&#xff1a;与w相反 e: 光标以单词向前…

CentOS离线安装httpd服务

文章目录需求背景安装需求背景 需要在无网络环境下安装httpd服务 安装 提示&#xff1a;直接下载httpd离线安装包无法安装成功&#xff0c;需要安装相对应的依赖 需要下载的依赖如下&#xff1a; apr-1.4.8-5.el7.x86_64.rpm apr-util-1.5.2-6.el7.x86_64.rpm apr-util-lda…

转换流和内存流

转换流:把字节流转成字符流: InputStreamReader:把字节输入流转成字符输入流. OutputStreamWriter:把字节输出流转成字符输出流. 为什么有字节转字符流,没有字符转字节流. 字节流可以操作一切文件(纯文本文件/二进制文件).字符流是用来操作中文纯文本使用的,本身是对字节流的…

windows配置gvim高效率编程(cc++)带自动补全代码

对vim的配置足以处理一般的比赛获其他编程项目要求&#xff0c;如自动缩进&#xff0c;自动补全等等。先上几张截图&#xff0c;看看效果&#xff1a; 可以看见vim简洁高效的界面和不错的缩进功能。 debug功能 一、安装gvim 下载资源并安装 百度云下载网址http://pan.baid…

数据结构实验之二叉树四:还原二叉树

题目描述 给定一棵二叉树的先序遍历序列和中序遍历序列&#xff0c;要求计算该二叉树的高度。 输入 输入数据有多组&#xff0c;每组数据第一行输入1个正整数N(1 < N < 50)为树中结点总数&#xff0c;随后2行先后给出先序和中序遍历序列&#xff0c;均是长度为N的不包含重…

Flink 1.12 CDH 6.3 集成

之前记录的&#xff1a;Flink 1.9 CDH 6.3 集成 有些下载链接可能被官方关闭了&#xff0c;这里介绍1.12版本集成&#xff0c;并把安装包下载地址换为百度网盘链接 下载安装包 链接: https://pan.baidu.com/s/112fiaaMAMMXMsyiTDh3qjg 提取码: ar5f 安装包内容 FLINK-1.12…

合并流

合并流/顺序流(SequenceInputStream): 就是把多个输入流,合并成一个流对象.

gvim常用的配置及插件 -windows

gvim常用的配置及插件 接触vim也已经有一年多了&#xff0c;期间也用过一段时间的SourceInsight&#xff0c;SourceInsight是Windows下一款不错的查看代码的软件。利用它可以迅速的了解一个大型程序的结构。后来在Linux下进行了一段时间的程序开发&#xff0c;就回到vim上了,经…

数据结构实验之求二叉树后序遍历和层次遍历

题目描述 已知一棵二叉树的前序遍历和中序遍历&#xff0c;求二叉树的后序遍历。输入 输入数据有多组&#xff0c;第一行是一个整数t (t<1000)&#xff0c;代表有t组测试数据。每组包括两个长度小于50 的字符串&#xff0c;第一个字符串表示二叉树的先序遍历序列&#xff0c…

CDH 6 安装服务哈希验证失败 解决方法

当安装cdh 6&#xff0c;使用本地搭建的parcel时&#xff0c;出现了哈希验证失败的问题&#xff1a; 查看了parcel的sha值&#xff0c;与官网的一致&#xff0c;没有问题&#xff1a; #parcel sha值 [rootlocalhost bigdata]# sha1sum CDH-6.0.0-1.cdh6.0.0.p0.537114-el7.pa…

Arrays.sort()用来自定义排序的使用

compareTo方法 public int compareTo(String anotherString)按字典顺序比较两个字符串。该比较基于字符串中各个字符的 Unicode 值。按字典顺序将此 String 对象表示的字符序列与参数字符串所表示的字符序列进行比较。如果按字典顺序此 String 对象位于参数字符串之前&#xf…

gvim配置

手把手教你把Vim改装成一个IDE编程环境(图文) By:吴垠Date:2007-09-07Version:0.5Email:lazy.fox.wu#gmail.comHomepage:http://blog.csdn.net/wooinCopyright:该文章版权由吴垠和他可爱的老婆小包子所有。可在非商业目的下任意传播和复制。对于商业目的下对本文的任何行为需…

双向队列

题目描述 想想双向链表……双向队列的定义差不多&#xff0c;也就是说一个队列的队尾同时也是队首&#xff1b;两头都可以做出队&#xff0c;入队的操作。 现在给你一系列的操作&#xff0c;请输出最后队列的状态&#xff1b; 命令格式&#xff1a; LIN X X表示一个整数&#…

Dubbo调用时报错Invalid token Forbid invoke remote service interface

dubbo开启token服务后&#xff0c;使用集群容错策略为FailoverClusterInvoker&#xff0c;当出现服务调用失败进行转移&#xff0c;重试其它服务器时&#xff0c;会出现token invalid错误&#xff0c;provider会拒绝服务调用。 原因&#xff1a; 消费端&#xff1a; 1、com.…