Projects
About 2 min
Overview
This page is the English counterpart of the Chinese Projects guide. It summarizes cluster edition operation, deployment, integration, and high-availability maintenance while keeping the document path aligned with the Chinese documentation structure.
How To Use This Page
- Follow the same operation order as the Chinese source page.
- Keep configuration values, topic names, ports, commands, and file paths consistent with your deployment environment.
- Screenshots and diagrams reuse the Chinese documentation image directory so assets are maintained in one place.
- For production changes, validate the operation in a test environment before applying it online.
Reference Commands And Configuration
The following snippets are preserved from the source guide because commands, configuration keys, and protocol examples should remain exact.
spring:
application:
name: fbmq
webflux:
static-path-pattern: /static/** #配置webflux的前端资源路径
profiles:
active: dev
server:
port: 18083
fastbee:
jwt: #jwt认证
secret: com.fastbee.jwt
expireTime: 14400000
user: #默认的登录账号密码,可修改
username: admin
password: admin123
datasource: # 配置信息存在的数据库,目前只支持mysql
url: jdbc:mysql://81.71.xx.xx:3306/fbmq?useSSL=false
username: root
password: 123456
servers:
- port: 1883
auth: true # 是否开启认证
- port: 8083
openws: true # 是否使用websocket
path: /mqtt # ws路径
auth: true
router: #线程池配置
batchSize: 200
logging: #日志级别配置,建议设置为 error
level:
root: info
com.fastbee: error
org.springframework.boot.autoconfigure: error
org.apache.kafka: error
org.apache.ignite: error
fastbee:
cluster: # 集群配置
localAddress: 127.0.0.1
addresses: [ "127.0.0.1" ] # 内网地址
node-id: fastbee # 节点id@Configuration
@EnableWebFlux
public class WebFluxCorsConfig implements WebFluxConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*") // 允许所有来源,实际应用中需精确配置具体的前端域名
.allowedMethods(HttpMethod.GET.name(), HttpMethod.POST.name(), HttpMethod.PUT.name(), HttpMethod.DELETE.name(), HttpMethod.OPTIONS.name())
.allowedHeaders("*")
.allowCredentials(false);
}
}@Configuration
@EnableWebFlux
public class WebFluxMvcConfig implements WebFluxConfigurer {
@Bean
public RouterFunction<ServerResponse> staticResourcesRouter() {
ClassPathResource classPathResource = new ClassPathResource("static/");
return resources("/**", classPathResource);
}
}@Configuration
public class WebFluxRedirectConfig {
@Bean
public WebFilter redirectFilter() {
return (ServerWebExchange exchange, WebFilterChain chain) -> {
ServerHttpRequest request = exchange.getRequest();
ServerHttpResponse response = exchange.getResponse();
// 判断请求路径是否为根路径("/")
if ("/".equals(request.getPath().pathWithinApplication().value())) {
// 设置重定向的状态码为302(临时重定向,也可根据需求换为301等)
response.setStatusCode(HttpStatus.FOUND);
// 设置重定向的目标地址为 "/index.html"
response.getHeaders().setLocation(request.getURI().resolve("/index.html"));
return Mono.empty();
}
return chain.filter(exchange);
};
}
}