SpringBoot 3 + Flutter3 实战低代码运营管理[完结10章]

142 阅读5分钟

学习地址1:pan.baidu.com/s/1jKTbbi8a… 提取码: m7rw 学习地址2:share.weiyun.com/Oh3g6KRc 密码:kiyx7m

大家好,今天给大家讲讲关于低代码运营管理的相关技术,我将在本文带着大家基于全栈技术(SpringBoot 3+Flutter3),全流程打造多端低代码运营管理平台,助你急速打通“全栈+跨端“综合技能,更快胜任多领域岗位,先人一步成为企业青睐的 “驾驭全局,深广兼备,打通端到端全技能” 的全能型人才。

首先,我们先来认识一下低代码,那么什么是低代码呢? "低代码"一词最早由 Forrester Research 的 Clay Richardson 和 John Rymer 在2014年提出。这一年在他们发表报告《面向客户应用的新开发平台出现》之后,低代码平台正式诞生。在这份报告中,他们创造了"低代码"这一术语,并对低代码的技术、用途和市场进行了概述,同时指出,许多公司更喜欢选择低代码替代方法,以便快速、连续地进行应用交付。

低代码,顾名思义,就是指开发者写很少的代码,通过低代码平台提供的界面、逻辑、对象、流程等可视化编排工具来完成大量开发工作,降低软件开发中的不确定性和复杂性,从而大幅提升开发效率,让企业能够降低开发成本,降低技术门槛,快速创新应用,实现快速试错,敏捷迭代。

低代码的优点很明显,就是可以让完全不懂代码的也可以快速开发应用。对于懂代码的,开发速度提高,效率提升,可以减少很多不必要的工作量,通过一些配置就能生成基础的功能,如果要拓展,另外开发。

下面我们就开始代码实战: 创建子项目 ms-oauth2-server。 org.springframework.cloud spring-cloud-starter-netflix-eureka-client org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-data-redis org.mybatis.spring.boot mybatis-spring-boot-starter mysql mysql-connector-java org.springframework.cloud spring-cloud-starter-security org.springframework.cloud spring-cloud-starter-oauth2 com.imooc commons 1.0-SNAPSHOT org.springframework.boot spring-boot-configuration-processor true 通过配置进行启动,默认是关闭的,以下是 AOF 常用配置:

默认appendonly为no

appendonly yes appendfilename "appendonly.aof"

RDB文件和AOF文件所在目录

dir /usr/local/redis/data

fsync 持久化策略

appendfsync everysec

AOF重写期间是否禁止fsync;如果开启该选项,可以减轻文件重写时CPU和硬盘的负载(尤其是硬盘),但是可能会丢失AOF重写期间的数据;需要在负载和安全性之间进行平衡

no-appendfsync-on-rewrite no

当前aof文件大于多少字节后才触发

auto-aof-rewrite-min-size 64mb

当前写入日志文件的大小超过上一次rewrite之后的文件大小的百分之100时,也就是2倍时触发Rewrite

auto-aof-rewrite-percentage 100

如果AOF文件结尾损坏,Redis启动时是否仍载入AOF文件

aof-load-truncated yes

我们可以使用普通模式的 redis-cli 客户端,向正在导入某个槽的节点先发送 ASKING 命令,然后其他命令例如 GET 就会被正在导入槽的目标节点执行。

接受手动故障切换请求

1265:S # Manual failover user request accepted.

收到暂停服务的主节点动故障切换的复制偏移 4536

1265:S # Received replication offset for paused master manual failover: 4536

所有主复制流处理完毕,可以开始手动故障切换

1265:S # All master replication stream processed, manual failover can start.

选举开始

1265:S # Start of election delayed for 0 milliseconds (rank #0, offset 4536).

开始进行第8纪元的故障切换选举

1265:S # Starting a failover election for epoch 8.

选举成功,自己(192.168.10.101:6371)是新主节点

1265:S # Failover election won: I'm the new master.

故障切换成功后,配置文件 config epoch 设置为 8

1265:S # configEpoch set to 8 after successful failover 1265:M # Connection with master lost. 1265:M * Caching the disconnected master state.

抛弃之前缓存的主节点状态

1265:M * Discarding previously cached master state.

将二级主从 ID 设置为 xxx 有效偏移量为 4537 新的主从 ID 为 xxx

1265:M # Setting secondary replication ID to 9668c0e62ba28defda2b0360daa6b7f0fe5f89e0, valid up to offset: 4537. New replication ID is aa3c95e0f57609775000dd12deaaa122feb792dc

192.168.10.102:6374 请求同步

1265:M * Replica 192.168.10.102:6374 asks for synchronization

接受来自 192.168.10.102:6374 的部分重新同步请求。从偏移量 4537 开始

1265:M * Partial resynchronization request from 192.168.10.102:6374 accepted. Sending 0 bytes of backlog starting from offset 4537.

slave 不会让 key 过期,而是等待 master 让 key 过期。当一个 master 让一个 key 到期时,它会合成一个 DEL 命令并传输到所有的 slave。包括源码中也体现了非主库不删: int expireIfNeeded(redisDb *db, robj *key) { time_t when = getExpire(db,key);

if (when < 0) return 0; /* No expire for this key */

/* Don't expire anything while loading. It will be done later. */ if (server.loading) return 0;

/* If we are running in the context of a slave, return ASAP:

  • the slave key expiration is controlled by the master that will
  • send us synthesized DEL operations for expired keys.
  • Still we try to return the right information to the caller,
  • that is, 0 if we think the key should be still valid, 1 if
  • we think the key is expired at this time. */ if (server.masterhost != NULL) { return time(NULL) > when; }

/* Return when this key has not expired */ if (time(NULL) <= when) return 0;

/* Delete the key */ server.stat_expiredkeys++; propagateExpire(db,key); return dbDelete(db,key); }