tar -zxvf redis-4.0.2.tar.gz
cd redis-4.0.2
make && make install
vi redis.conf
修改 daemonize yes
cd /usr/local/
mkdir redis_cluster
mkdir 7000 7001 7002
cp /data/software/redis-4.0.2/redis.conf ./redis_cluster/7000/
//拷贝到7001目录
cp /data/software/redis-4.0.2/redis.conf ./redis_cluster/7001/
//拷贝到7002目录
cp /data/software/redis-4.0.2/redis.conf ./redis_cluster/7002/
分别修改3个配置文件
daemonize yes //redis后台运行
pidfile /var/run/redis_7000.pid //pidfile文件对应7000,7002,7003
port 7000 //端口7000,7002,7003
cluster-enabled yes //开启集群 把注释#去掉
cluster-config-file nodes_7000.conf //集群的配置 配置文件首次启动自动生成 7000,7001,7002
cluster-node-timeout 5000 //请求超时 设置5秒够了
appendonly yes
启动6个节点
cd /usr/local
redis-server redis_cluster/7000/redis.conf
redis-server redis_cluster/7001/redis.conf
redis-server redis_cluster/7002/redis.conf
redis-server redis_cluster/7003/redis.conf
redis-server redis_cluster/7004/redis.conf
redis-server redis_cluster/7005/redis.conf
cd /data/software/redis-4.0.10/src/
创建集群
yum -y install ruby ruby-devel rubygems rpm-build
gem install redis
(如果不能执行,则wget https://rubygems.global.ssl.fastly.net/gems/redis-3.2.1.gem 然后执行命令gem install -l ./redis-3.2.1.gem)
./redis-trib.rb create --replicas 1 30.12.53.134:7000 30.12.53.134:7001 30.12.53.134:7002 30.12.53.140:7003 30.12.53.140:7004 30.12.53.140:7005
进入redis
redis-cli -c -p 7000
cluster nodes
单机启动
cd bin
./redis-server /data/software/redis-4.0.2/redis.conf
./redis-cli
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
http://www.cnblogs.com/wangyhua/p/4050563.html
https://blog.csdn.net/w1054993544/article/details/78932614
https://blog.csdn.net/qq_35498405/article/details/78030814
https://www.cnblogs.com/zhangjianbin/p/7228628.html feign 超时
https://www.2cto.com/kf/201803/727053.html fastdfs
https://blog.csdn.net/zw521cx/article/details/80704026 基于fastdfs的高性能大文件,断点续传,秒传,进度条,完整代码
,SerializerFeature.WriteNullStringAsEmpty,SerializerFeature.WriteDateUseDateFormat,SerializerFeature.WriteNonStringValueAsString
https://www.cnblogs.com/yuxiaona/p/7160648.html redisjiqun lianjie
https://blog.csdn.net/Cs_hnu_scw/article/details/79059965?utm_source=blogxgwz2
1快捷键 ctrl shift f9 热部署 idea debug模式
springcloud 踩坑日志
2通过zuul 网关上传文件 会出现中文乱码,需要在uri网关前面加上zuul
3 feignclient调用 降级 异常日志处理
@Component
static class ScheduleServiceHystrixClientFallbackFactory implements FallbackFactory
@Override
public IScheduleServiceFeignClient create(Throwable cause) {
//log不要写在这里 否则启动的时候会报异常信息
return new IScheduleServiceFeignClient() {
@Override
public ServiceResultDTO saveSchedule(OpenScheduleDto openScheduleDto) {
logger.error("IScheduleServiceFeignClient 调用SERVICE-BASE服务失败{}", cause); //不要写在匿名内部内之前, 否则启动的时候会报异常信息,但是不影响启动
return ServiceResultDTO.build("ex", "调用服务进行待办推送服务出错!");
}
}
@EnableFeignClients(basePackages = {"com.qiye.ext.service","com.qiye.base.service"}) 这时候只扫描配置了包下@feigin注解上相关包的接口或类
47 root/qiye2018@# /data/server/business_app/log/
176 root/qiyey@2018 /data/server/business_app/log/
-------------------reids集群搭建
yum install -y gcc g++ gcc-c++ make
https://www.2cto.com/database/201709/678259.html
http://www.redis.cn/topics/cluster-tutorial.html reids集群搭建
https://my.oschina.net/gaoenwei/blog/1623214
https://my.oschina.net/gaoenwei/blog/1622588
https://blog.csdn.net/zsg88/article/details/73732845 集群设置密码
https://blog.csdn.net/ldy1016/article/details/80998687 需要配置pom文件 集群设置密码后 不能使用低版本的data-redis
https://www.cnblogs.com/yjmyzz/p/redis-cluster-turotial.html * 以下是安装时出现的问题解决方案
https://blog.csdn.net/xiaoguaihu12/article/details/56845473
https://blog.csdn.net/reyleon/article/details/51454334 删除主节点
https://www.cnblogs.com/zhoujie/p/redis3.html 可参考配置
-------------------reids集群搭建
1 安装 Gcc环境 yum install -y gcc g++ gcc-c++ make
解压redis路径 /data/software/redis-4.0.10/
集群配置路径 /usr/local/myRedis/redis-cluster
cp /data/software/redis-4.0.10/redis.conf /usr/local/myRedis/redis-cluster/7000
cp /data/software/redis-4.0.10/src/redis-server /usr/local/myRedis/redis-cluster/7000
vim redis.conf 每个redis下面的redis.conf的配置(以下是我的):
port 7001 //端口7001,7002,7003
bind 本机ip //默认ip为127.0.0.1 需要改为其他节点机器可访问的ip 否则创建集群时无法访问对应的端口,无法创建集群,我直接注释掉了
daemonize yes //redis后台运行
pidfile /var/run/redis_7000.pid //pidfile文件对应7000,7001,7002
cluster-enabled yes //开启集群 把注释#去掉
cluster-config-file nodes_7000.conf //集群的配置 配置文件首次启动自动生成 7001,7002,7003
cluster-node-timeout 15000 //请求超时 默认15秒,可自行设置
appendonly yes //aof日志开启 有需要就开启,它会每次写操作都记录一条日志
可以查看 https://blog.csdn.net/xiaoguaihu12/article/details/56845473
7000目录下到其兄弟目录下(7001-7005)
cp * /usr/local/myRedis/redis-cluster/7001
启动6个redis
//分配主从
./redis-trib.rb create --replicas 1 30.23.13.36:7000 30.23.13.36:7001 30.23.13.36:7002 30.23.13.36:7003 30.23.13.36:7004 30.23.13.36:7005
//连接集群 某一个节点即可
redis-cli -c -h 30.23.13.36 -p 7003
redis-cli -c -h 30.23.8.8 -p 7000
//启动
cd /usr/local/myRedis/redis-cluster/7000
./redis-server ./redis.conf
cd /usr/local/myRedis/redis-cluster/7001
./redis-server ./redis.conf
cd /usr/local/myRedis/redis-cluster/7002
./redis-server ./redis.conf
cd /usr/local/myRedis/redis-cluster/7003
./redis-server ./redis.conf
cd /usr/local/myRedis/redis-cluster/7004
./redis-server ./redis.conf
cd /usr/local/myRedis/redis-cluster/7005
./redis-server ./redis.conf
//关闭 或kill -9 进程Id 通过pkill -9 redis杀死reids 进程之后,重新启动各个节点,集群自动创建成功(杀死之前的集群状态)
注意:前提是不要清空nodes.conf文件
//gc
cd /usr/local/myRedis/redis-cluster/7000
rm -rf appendonly.aof dump.rdb nodes.conf
cd /usr/local/myRedis/redis-cluster/7001
rm -rf appendonly.aof dump.rdb nodes.conf
cd /usr/local/myRedis/redis-cluster/7002
rm -rf appendonly.aof dump.rdb nodes.conf
cd /usr/local/myRedis/redis-cluster/7003
rm -rf appendonly.aof dump.rdb nodes.conf
cd /usr/local/myRedis/redis-cluster/7004
rm -rf appendonly.aof dump.rdb nodes.conf
cd /usr/local/myRedis/redis-cluster/7005
rm -rf appendonly.aof dump.rdb nodes.conf
到src目录下
./redis-trib.rb add-node 30.23.8.8:7001 30.23.8.8:7000
./redis-trib.rb add-node --slave 30.23.8.8:7001 30.23.8.8:7000
./redis-trib.rb reshard 30.23.8.8:7000
三主
config set masterauth redis@2018 ;
config set requirepass redis@2018;
config rewrite
https://www.cnblogs.com/coder-lzh/p/9006048.html rocktmq
https://blog.csdn.net/qq_23250633/article/details/81063762
https://blog.csdn.net/zhangweiwei2020?t=1
https://blog.csdn.net/u012394095/article/details/82180538
https://blog.csdn.net/east123321/article/details/82258366
https://blog.csdn.net/weixin_38823568/article/details/82023371 *****cloud 集群
https://blog.csdn.net/w1054993544/article/list/1?t=1
http://www.itmuch.com/spring-cloud/zuul/zuul-ha/ //zuul架构
经测试 spring定时器@Scheduled(cron=) 在集群模式下,运行代码内容时间起点是不一致的,有微小差距,微妙级别,导致定时器重复执行,后面
又趋于正常(可能是cpu是单核的吧,测试是在同一台机器
开某个服务部署2个节点),所以可能存在定时器重复执行,建议在定时器里处理业务代码的时候,休眠0.5毫秒或1秒,如果业务逻辑处理很快
再加上服务器存在的时间差,导致定时器重复执行。
@PostConstruct
private void init() {
Config config = new Config();
try {
//集群
if(clusterNodes!=null) {
String[] nodes = clusterNodes.split(",");
ClusterServersConfig clusterServersConfig = config.useClusterServers().addNodeAddress(nodes);
//redispassword
if(redisPasswd !=null){
clusterServersConfig.setPassword(redisPasswd);
}
}else { //单机
SingleServerConfig singleServerConfig = config.useSingleServer().setAddress(new StringBuilder().append(redisHost).append(":").append(redisPort).toString());
//redispassword
if(redisPasswd!=null) {
singleServerConfig.setPassword(redisPasswd);
}
}
redisson = (Redisson) Redisson.create(config);
logger.info("Redisson init success");
} catch (Exception e) {
logger.error("init Redisson error ",e);
}
}
2018-10-31 10:39:00.016 INFO [service-cache,66cb05f85f5e677f,66cb05f85f5e677f,true] 11404 --- [pool-9-thread-1] c.q.c.service.lock.ScheduleAsyncTest : ----------*******start port is 8301 current time is 2018-10-31 10:39:00,cuurent mills is 1540953540016
2018-10-31 10:39:00.049 INFO [service-cache,66cb05f85f5e677f,66cb05f85f5e677f,true] 11404 --- [pool-9-thread-1] c.q.c.service.lock.ScheduleAsyncTest : handle logic ing ....,the server port is 8301 ,current time is 2018-10-31 10:39:00 ,cuurent mills is 1540953540049
2018-10-31 10:39:00.065 INFO [service-cache,66cb05f85f5e677f,66cb05f85f5e677f,true] 11404 --- [pool-9-thread-1] c.q.c.service.lock.ScheduleAsyncTest : Redisson分布式锁释放锁:redislock,ThreadName :47 ,cuurent mills is 1540953540065
2018-10-31 10:39:30.003 INFO [service-cache,3b6fd465df8c1483,3b6fd465df8c1483,true] 11404 --- [pool-9-thread-1] c.q.c.service.lock.ScheduleAsyncTest : ----------*******start port is 8301 current time is 2018-10-31 10:39:30,cuurent mills is 1540953570003
2018-10-31 10:39:30.043 INFO [service-cache,3b6fd465df8c1483,3b6fd465df8c1483,true] 11404 --- [pool-9-thread-1] c.q.c.service.lock.ScheduleAsyncTest : handle logic ing ....,the server port is 8301 ,current time is 2018-10-31 10:39:30 ,cuurent mills is 1540953570043
2018-10-31 10:39:30.071 INFO [service-cache,3b6fd465df8c1483,3b6fd465df8c1483,true] 11404 --- [pool-9-thread-1] c.q.c.service.lock.ScheduleAsyncTest : Redisson分布式锁释放锁:redislock,ThreadName :47 ,cuurent mills is 1540953570071
2018-10-31 10:40:00.011 INFO [service-cache,dfa167b717d60e55,dfa167b717d60e55,true] 11404 --- [pool-9-thread-1] c.q.c.service.lock.ScheduleAsyncTest : ----------*******start port is 8301 current time is 2018-10-31 10:40:00,cuurent mills is 1540953600011
2018-10-31 10:40:00.027 INFO [service-cache,dfa167b717d60e55,dfa167b717d60e55,true] 11404 --- [pool-9-thread-1] c.q.c.service.lock.ScheduleAsyncTest : Redisson分布式锁没有获取到锁:redislock,ThreadName :47 cuurent mills is 1540953600027
第二台机器
2018-10-31 10:39:00.003 INFO [service-cache,2384387b0ca655f9,2384387b0ca655f9,true] 7028 --- [pool-9-thread-1] c.q.c.service.lock.ScheduleAsyncTest : ----------*******start port is 8303 current time is 2018-10-31 10:39:00,cuurent mills is 1540953540003
2018-10-31 10:39:00.028 INFO [service-cache,2384387b0ca655f9,2384387b0ca655f9,true] 7028 --- [pool-9-thread-1] c.q.c.service.lock.ScheduleAsyncTest : handle logic ing ....,the server port is 8303 ,current time is 2018-10-31 10:39:00 ,cuurent mills is 1540953540028
2018-10-31 10:39:00.049 INFO [service-cache,2384387b0ca655f9,2384387b0ca655f9,true] 7028 --- [pool-9-thread-1] c.q.c.service.lock.ScheduleAsyncTest : Redisson分布式锁释放锁:redislock,ThreadName :50 ,cuurent mills is 1540953540049
2018-10-31 10:39:30.004 INFO [service-cache,dd1ff0e96855fb48,dd1ff0e96855fb48,true] 7028 --- [pool-9-thread-1] c.q.c.service.lock.ScheduleAsyncTest : ----------*******start port is 8303 current time is 2018-10-31 10:39:30,cuurent mills is 1540953570004
2018-10-31 10:39:30.032 INFO [service-cache,dd1ff0e96855fb48,dd1ff0e96855fb48,true] 7028 --- [pool-9-thread-1] c.q.c.service.lock.ScheduleAsyncTest : Redisson分布式锁没有获取到锁:redislock,ThreadName :50 cuurent mills is 1540953570031
2018-10-31 10:40:00.004 INFO [service-cache,e6d0fb93687c76a1,e6d0fb93687c76a1,true] 7028 --- [pool-9-thread-1] c.q.c.service.lock.ScheduleAsyncTest : ----------*******start port is 8303 current time is 2018-10-31 10:40:00,cuurent mills is 1540953600004
2018-10-31 10:40:00.020 INFO [service-cache,e6d0fb93687c76a1,e6d0fb93687c76a1,true] 7028 --- [pool-9-thread-1] c.q.c.service.lock.ScheduleAsyncTest : handle logic ing ....,the server port is 8303 ,current time is 2018-10-31 10:40:00 ,cuurent mills is 1540953600020
2018-10-31 10:40:00.035 INFO [service-cache,e6d0fb93687c76a1,e6d0fb93687c76a1,true] 7028 --- [pool-9-thread-1] c.q.c.service.lock.ScheduleAsyncTest : Redisson分布式锁释放锁:redislock,ThreadName :50 ,cuurent mills is 1540953600035
Ctrl+Alt+V,可以引入变量。例如:new String(); 自动导入变量定义
Ctrl+Alt+T,可以把代码包在一个块内,例如:try/catch
Ctrl+Enter,导入包,自动修正
Ctrl+Alt+L,格式化代码
http://qiye.pingan.com.cn/group1/M00/00/2D/CglIiV04HwyEFkv4AAAAADRXu5E697.zip 15652320337、jhc12345678 pase-sams-stg1.paic.com.cn
update idm_sys_menu set style = icon where enterpriseid = 1 and dr = 0 and sys_id = (select s.id from idm_sys_system s where s.enterpriseid = 1 and s.code = 'PASE-SAMS' and dr = 0)