去除内嵌redis
This commit is contained in:
parent
a7de5a1f32
commit
5cce02a1e1
|
|
@ -88,13 +88,6 @@
|
|||
</build>
|
||||
|
||||
<dependencies>
|
||||
<!--内嵌redis,生产环境请勿使用!!!-->
|
||||
<dependency>
|
||||
<groupId>com.github.tonivade</groupId>
|
||||
<artifactId>claudb</artifactId>
|
||||
<version>1.7.1</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
package org.jetlinks.community.standalone.configuration;
|
||||
|
||||
import com.github.tonivade.claudb.ClauDB;
|
||||
import com.github.tonivade.claudb.DBConfig;
|
||||
import com.github.tonivade.resp.RespServer;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.event.ApplicationPreparedEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class EmbeddedRedisConfiguration implements ApplicationListener<ApplicationPreparedEvent>, Ordered {
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ApplicationPreparedEvent event) {
|
||||
Environment environment = event.getApplicationContext().getEnvironment();
|
||||
if (!environment.getProperty("spring.redis.embedded.enabled", Boolean.class, false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
String dataPath = environment.getProperty("spring.redis.embedded.data-path", "./data/redis");
|
||||
new File(dataPath).mkdirs();
|
||||
DBConfig config = new DBConfig();
|
||||
config.setPersistenceActive(true);
|
||||
config.setAofFile(dataPath.concat("/jetlinks.aof"));
|
||||
config.setRdbFile(dataPath.concat("/jetlinks.rdb"));
|
||||
|
||||
RespServer server = ClauDB.builder()
|
||||
.port(environment.getProperty("spring.redis.embedded.port", Integer.class, 6379))
|
||||
.host(environment.getProperty("spring.redis.embedded.host", "0.0.0.0"))
|
||||
.config(config)
|
||||
.build();
|
||||
server.start();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return Ordered.HIGHEST_PRECEDENCE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
org.springframework.context.ApplicationListener=\
|
||||
org.jetlinks.community.standalone.configuration.EmbeddedRedisConfiguration
|
||||
|
|
@ -2,13 +2,8 @@ spring:
|
|||
resources:
|
||||
static-locations: file:./index/, file:./static/,/,classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/, classpath:/public/
|
||||
redis:
|
||||
embedded:
|
||||
enabled: true # 使用内置的redis,不建议在生产环境中使用.
|
||||
host: 127.0.0.1
|
||||
port: 6370
|
||||
data-path: ./data/redis
|
||||
host: 127.0.0.1
|
||||
port: 6370
|
||||
port: 6379
|
||||
lettuce:
|
||||
pool:
|
||||
max-active: 1024
|
||||
|
|
|
|||
Loading…
Reference in New Issue