1 Star 0 Fork 76

刘营010/disjob

forked from dromara/disjob 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
EmbeddedRedisServerKstyrc.java 2.25 KB
一键复制 编辑 原始数据 按行查看 历史
ponfee 提交于 2023-07-06 21:25 . simplify mybatis mapper config
/* __________ _____ *\
** \______ \____ _____/ ____\____ ____ Copyright (c) 2017-2023 Ponfee **
** | ___/ _ \ / \ __\/ __ \_/ __ \ http://www.ponfee.cn **
** | | ( <_> ) | \ | \ ___/\ ___/ Apache License Version 2.0 **
** |____| \____/|___| /__| \___ >\___ > http://www.apache.org/licenses/ **
** \/ \/ \/ **
\* */
package cn.ponfee.disjob.test.redis;
import redis.embedded.RedisServer;
/**
* Embedded redis server.
* <p><a href="https://github.com/ponfee/embedded-redis">github embedded redis</a>
* <p><a href="https://blog.csdn.net/qq_45565645/article/details/125052006">redis configuration1</a>
* <p><a href="https://huaweicloud.csdn.net/633564b3d3efff3090b55531.html">redis configuration2</a>
*
* <p>username: 无需用户名
* <p>password: 123456
*
* @author Ponfee
*/
public final class EmbeddedRedisServerKstyrc {
public static void main(String[] args) {
RedisServer redisServer = start(6379, 6380);
Runtime.getRuntime().addShutdownHook(new Thread(redisServer::stop));
}
public static RedisServer start(int masterPort, int slavePort) {
RedisServer redisServer = RedisServer.builder()
//.redisExecProvider(customRedisProvider)
.port(masterPort)
.slaveOf("localhost", slavePort)
.setting("requirepass 123456")
// redis 6.0 ACL: https://blog.csdn.net/qq_29235677/article/details/121475204
// command: "ACL SETUSER username on >password ~<key-pattern> +@<category>"
// config file: "user username on >password ~<key-pattern> +@<category>"
//.setting("ACL SETUSER test123 on >123456 ~* +@all")
.setting("daemonize no")
.setting("appendonly no")
.setting("slave-read-only no")
.setting("maxmemory 128M")
.build();
System.out.println("Embedded kstyrc redis server starting...");
redisServer.start();
System.out.println("Embedded kstyrc redis server started!");
return redisServer;
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/liu-ying-010/disjob.git
git@gitee.com:liu-ying-010/disjob.git
liu-ying-010
disjob
disjob
master

搜索帮助

Cb406eda 1850385 E526c682 1850385