redis5.0.5版本搭建集群

安装redis5.0.5版本

将redis5.0.5解压

sudo tar -zxcf redis5.0.5.tar.gz make make install

如果没有make命令:

sudo apt-get install make

安装ruby

sudo apt-get install ruby

ubuntu16.0.4创建redis集群(三主三从)

一..创建六个redis节点目录

sudo mkdir 7000 7001 7002 7003 7004 7005

二.各自创建redis.conf配置文件 (端口号需要改成各自实例的端口号)

port 7000
#用于开实例的集群模式
cluster-enabled yes
#设定了保存节点配置文件的路径
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes
bind 192.168.44.128
protected-mode no

坑1:bind 地址写虚拟机的真实ip地址,通过ifconfig查ip地址 (写127.0.0.1项目连接会报连接被拒绝)

坑2:由于Linux上的redis处于安全保护模式,这就让你无法从虚拟机外部去轻松建立连接,这里就有两种解决方法,一种是在redis.conf中设置保护模式为no,要么设置redis密码

原因:配置文件少了第8,9行的配置

如下图:

报错关键字:protected mode is enabled no bind address was specified , no authentication password is requested to clients

020-07-29 15:14:36.960 ERROR 27312 --- [isson-netty-2-3] o.r.client.handler.CommandDecoder        : Error message from Redis: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside. channel: [id: 0x770bbad2, L:/192.168.44.1:55318 - R:/192.168.44.128:7002]
2020-07-29 15:14:36.960 ERROR 27312 --- [isson-netty-2-4] o.r.client.handler.CommandDecoder        : Error message from Redis: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside. channel: [id: 0x04f2e3ec, L:/192.168.44.1:55319 - R:/192.168.44.128:7001]
2020-07-29 15:14:36.960 ERROR 27312 --- [isson-netty-2-5] o.r.client.handler.CommandDecoder        : Error message from Redis: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside. channel: [id: 0x5ff2054a, L:/192.168.44.1:55320 - R:/192.168.44.128:7005]
2020-07-29 15:14:36.961 ERROR 27312 --- [isson-netty-2-6] o.r.client.handler.CommandDecoder        : Error message from Redis: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside. channel: [id: 0xee00c278, L:/192.168.44.1:55321 - R:/192.168.44.128:7000]
2020-07-29 15:14:36.961 ERROR 27312 --- [isson-netty-2-7] o.r.client.handler.CommandDecoder        : Error message from Redis: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside. channel: [id: 0x251a1d0f, L:/192.168.44.1:55322 - R:/192.168.44.128:7003]
2020-07-29 15:14:37.058 ERROR 27312 --- [isson-netty-2-9] o.r.client.handler.CommandDecoder        : Error message from Redis: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside. channel: [id: 0xb8ac96ea, L:/192.168.44.1:55324 - R:/192.168.44.128:7002]
2020-07-29 15:14:37.059 ERROR 27312 --- [isson-netty-2-8] o.r.client.handler.CommandDecoder        : Error message from Redis: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside. channel: [id: 0x8bb11b83, L:/192.168.44.1:55323 - R:/192.168.44.128:7004]
2020-07-29 15:14:37.059 ERROR 27312 --- [sson-netty-2-10] o.r.client.handler.CommandDecoder        : Error message from Redis: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside. channel: [id: 0x767d5ad4, L:/192.168.44.1:55325 - R:/192.168.44.128:7005]
2020-07-29 15:14:37.059 ERROR 27312 --- [sson-netty-2-11] o.r.client.handler.CommandDecoder        : Error message from Redis: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside. channel: [id: 0x9b0330e8, L:/192.168.44.1:55326 - R:/192.168.44.128:7001]
2020-07-29 15:14:37.060 ERROR 27312 --- [sson-netty-2-12] o.r.client.handler.CommandDecoder        : Error message from Redis: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside. channel: [id: 0x7fa82b2b, L:/192.168.44.1:55327 - R:/192.168.44.128:7000]
2020-07-29 15:14:37.060 ERROR 27312 --- [sson-netty-2-13] o.r.client.handler.CommandDecoder        : Error message from Redis: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside. channel: [id: 0x7b2c00f4, L:/192.168.44.1:55328 - R:/192.168.44.128:7003]
2020-07-29 15:14:37.163 ERROR 27312 --- [sson-netty-2-14] o.r.client.handler.CommandDecoder        : Error message from Redis: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside. channel: [id: 0x26c4eedc, L:/192.168.44.1:55329 - R:/192.168.44.128:7002]
2020-07-29 15:14:37.163 ERROR 27312 --- [sson-netty-2-15] o.r.client.handler.CommandDecoder        : Error message from Redis: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside. channel: [id: 0x7282e05a, L:/192.168.44.1:55330 - R:/192.168.44.128:7004]
2020-07-29 15:14:37.164 ERROR 27312 --- [sson-netty-2-16] o.r.client.handler.CommandDecoder        : Error message from Redis: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside. channel: [id: 0xefdb98b3, L:/192.168.44.1:55331 - R:/192.168.44.128:7005]
2020-07-29 15:14:37.164 ERROR 27312 --- [sson-netty-2-17] o.r.client.handler.CommandDecoder        : Error message from Redis: DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authentication password. NOTE: You only need to do one of the above things in order for the server to start accepting connections from the outside. channel: [id: 0x67a229bb, L:/192.168.44.1:55332 - R:/192.168.44.128:7001]
2020-07-29 15:14:37.166 ERROR 27312 --- [sson-netty-2-18] o.r.client.handler.CommandDecoder        : Error message from Redis: DENIED Redis is running in protecte

连接虚拟机redis集群超时:

解决:打开防火墙对应的端口

1.查询防火墙状态

sudo ufw status

2.将对应的端口允许外界访问

sudo ufw allow 7000

三.将redis的 src目录下的redis-server复制到各自的节点目录下

四.各自启动redis实例

sudo redis-server ./redis.conf

五.在src目录下启动redis集群

./redis-cli --cluster create 192.168.44.128:7000 192.168.44.128:7001 192.168.44.128:7002 192.168.44.128:7003 192.168.44.128:7004 192.168.44.128:7005 --cluster-replicas 1

启动成功如下:

>>> Performing hash slots allocation on 6 nodes...
Master[0] -> Slots 0 - 5460
Master[1] -> Slots 5461 - 10922
Master[2] -> Slots 10923 - 16383
Adding replica 192.168.44.128:7004 to 192.168.44.128:7000
Adding replica 192.168.44.128:7005 to 192.168.44.128:7001
Adding replica 192.168.44.128:7003 to 192.168.44.128:7002
>>> Trying to optimize slaves allocation for anti-affinity
[WARNING] Some slaves are in the same host as their master
M: fdd5b5cad16dd7b2ec1af2a1e924bca063a0d485 192.168.44.128:7000slots:[0-5460] (5461 slots) master
M: 89916e443012ba383abe88d498fc2beedb40a724 192.168.44.128:7001slots:[5461-10922] (5462 slots) master
M: 0c255df5d24f3adbbdcbaa3fc4253fed4a8c7b9d 192.168.44.128:7002slots:[10923-16383] (5461 slots) master
S: 45f4c6de4886bf5649c701add740a876426c2943 192.168.44.128:7003replicates 0c255df5d24f3adbbdcbaa3fc4253fed4a8c7b9d
S: 42ef4cba5c428108c756f8d7e0686cf50c1de7c7 192.168.44.128:7004replicates fdd5b5cad16dd7b2ec1af2a1e924bca063a0d485
S: 3076609e3f87450feb652640ba67347057c0b45a 192.168.44.128:7005replicates 89916e443012ba383abe88d498fc2beedb40a724
Can I set the above configuration? (type 'yes' to accept): yes
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join
...
>>> Performing Cluster Check (using node 192.168.44.128:7000)
M: fdd5b5cad16dd7b2ec1af2a1e924bca063a0d485 192.168.44.128:7000slots:[0-5460] (5461 slots) master1 additional replica(s)
M: 0c255df5d24f3adbbdcbaa3fc4253fed4a8c7b9d 192.168.44.128:7002slots:[10923-16383] (5461 slots) master1 additional replica(s)
M: 89916e443012ba383abe88d498fc2beedb40a724 192.168.44.128:7001slots:[5461-10922] (5462 slots) master1 additional replica(s)
S: 42ef4cba5c428108c756f8d7e0686cf50c1de7c7 192.168.44.128:7004slots: (0 slots) slavereplicates fdd5b5cad16dd7b2ec1af2a1e924bca063a0d485
S: 45f4c6de4886bf5649c701add740a876426c2943 192.168.44.128:7003slots: (0 slots) slavereplicates 0c255df5d24f3adbbdcbaa3fc4253fed4a8c7b9d
S: 3076609e3f87450feb652640ba67347057c0b45a 192.168.44.128:7005slots: (0 slots) slavereplicates 89916e443012ba383abe88d498fc2beedb40a724
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.

用redisson测试

配置redisson:

/*** @Description:* @Author: ldl* @CreateDate: 2020/7/6 10:32*/
@Configuration
public class RedisConfig {@Beanpublic RedissonClient redissonClient() {
//        // 默认连接地址 127.0.0.1:6379
//        RedissonClient redisson = Redisson.create();Config config = new Config();//单redis节点配置
//        config.useSingleServer().setAddress("redis://127.0.0.1:6379");//主从节点配置
//        config.useMasterSlaveServers()
//                //可以用"rediss://"来启用SSL连接
//                .setMasterAddress("redis://192.168.44.128:6379")
//                .addSlaveAddress("redis://192.168.44.128:6380")
//                .addSlaveAddress("redis://192.168.44.128:6381");//cluster配置config.useClusterServers()集群状态扫描间隔时间,单位是毫秒.setScanInterval(2000).addNodeAddress("redis://192.168.44.128:7000").addNodeAddress("redis://192.168.44.128:7001").addNodeAddress("redis://192.168.44.128:7002").addNodeAddress("redis://192.168.44.128:7003").addNodeAddress("redis://192.168.44.128:7004").addNodeAddress("redis://192.168.44.128:7005");return Redisson.create(config);}
}

测试:

@Testpublic void testRedisson() {
//        RLock ddd = redissonClient.getLock("ddd");
//        System.out.println(ddd.getName());RMap<String, String> map = redissonClient.getMap("lll");
//        MallRole role = new MallRole();
//        role.setName("lll");
//        String roleJson = JSON.toJSONString(role);
//        map.put("124", roleJson);System.out.println(map.get("124"));}

结果:

16:21:11.596 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils - Could not detect default configuration classes for test class [com.lindl.mall.mapper.MallUserMapperTest]: MallUserMapperTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
16:21:11.642 [main] DEBUG org.springframework.test.context.support.ActiveProfilesUtils - Could not find an 'annotation declaring class' for annotation type [org.springframework.test.context.ActiveProfiles] and class [com.lindl.mall.mapper.MallUserMapperTest]
16:21:11.753 [main] DEBUG org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider - Identified candidate component class: file [E:\Desktop\stu\mall\target\classes\com\lindl\mall\MallApplication.class]
16:21:11.754 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Found @SpringBootConfiguration com.lindl.mall.MallApplication for test class com.lindl.mall.mapper.MallUserMapperTest
16:21:11.885 [main] DEBUG org.springframework.boot.test.context.SpringBootTestContextBootstrapper - @TestExecutionListeners is not present for class [com.lindl.mall.mapper.MallUserMapperTest]: using defaults.
16:21:11.886 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Loaded default TestExecutionListener class names from location [META-INF/spring.factories]: [org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener, org.springframework.test.context.web.ServletTestExecutionListener, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener, org.springframework.test.context.support.DependencyInjectionTestExecutionListener, org.springframework.test.context.support.DirtiesContextTestExecutionListener, org.springframework.test.context.transaction.TransactionalTestExecutionListener, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener, org.springframework.test.context.event.EventPublishingTestExecutionListener]
16:21:11.908 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper - Using TestExecutionListeners: [org.springframework.test.context.web.ServletTestExecutionListener@77a7cf58, org.springframework.test.context.support.DirtiesContextBeforeModesTestExecutionListener@3d97a632, org.springframework.boot.test.mock.mockito.MockitoTestExecutionListener@616fe72b, org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener@37efd131, org.springframework.test.context.support.DirtiesContextTestExecutionListener@7e7b159b, org.springframework.test.context.transaction.TransactionalTestExecutionListener@7e5d9a50, org.springframework.test.context.jdbc.SqlScriptsTestExecutionListener@60957c0f, org.springframework.test.context.event.EventPublishingTestExecutionListener@293a5f75, org.springframework.boot.test.mock.mockito.ResetMocksTestExecutionListener@fcb4004, org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListener@1dd6d4b7, org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener@56e8b606, org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener@2dd29a59, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener@784c3487, org.springframework.boot.test.autoconfigure.webservices.client.MockWebServiceServerTestExecutionListener@53142455]
16:21:11.913 [main] DEBUG org.springframework.test.context.support.AbstractDirtiesContextTestExecutionListener - Before test class: context [DefaultTestContext@3cc41abc testClass = MallUserMapperTest, testInstance = [null], testMethod = [null], testException = [null], mergedContextConfiguration = [WebMergedContextConfiguration@4566d049 testClass = MallUserMapperTest, locations = '{}', classes = '{class com.lindl.mall.MallApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@2254127a, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@f68f0dc, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@6f36c2f0, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@3e78b6a5, org.springframework.boot.test.context.SpringBootTestArgs@1], resourceBasePath = 'src/main/webapp', contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map['org.springframework.test.context.web.ServletTestExecutionListener.activateListener' -> true]], class annotated with @DirtiesContext [false] with mode [null].
16:21:11.953 [main] DEBUG org.springframework.test.context.support.TestPropertySourceUtils - Adding inlined properties to environment: {spring.jmx.enabled=false, org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true}.   ____          _            __ _ _/\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \\\/  ___)| |_)| | | | | || (_| |  ) ) ) )'  |____| .__|_| |_|_| |_\__, | / / / /=========|_|==============|___/=/_/_/_/:: Spring Boot ::        (v2.3.0.RELEASE)2020-07-29 16:21:12.448  INFO 35960 --- [           main] c.lindl.mall.mapper.MallUserMapperTest   : Starting MallUserMapperTest on LAPTOP-5L33IHOU with PID 35960 (started by Lenovo in E:\Desktop\stu\mall)
2020-07-29 16:21:12.450  INFO 35960 --- [           main] c.lindl.mall.mapper.MallUserMapperTest   : No active profile set, falling back to default profiles: default
2020-07-29 16:21:13.488  INFO 35960 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2020-07-29 16:21:13.491  INFO 35960 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode.
2020-07-29 16:21:13.548  INFO 35960 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 40ms. Found 0 JPA repository interfaces.
2020-07-29 16:21:13.567  INFO 35960 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2020-07-29 16:21:13.569  INFO 35960 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Redis repositories in DEFAULT mode.
2020-07-29 16:21:13.596  INFO 35960 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 16ms. Found 0 Redis repository interfaces.
2020-07-29 16:21:15.272  INFO 35960 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2020-07-29 16:21:15.997  INFO 35960 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} inited
2020-07-29 16:21:16.091  INFO 35960 --- [         task-1] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [name: default]
2020-07-29 16:21:16.164  INFO 35960 --- [         task-1] org.hibernate.Version                    : HHH000412: Hibernate ORM core version 5.4.15.Final
2020-07-29 16:21:16.384  INFO 35960 --- [         task-1] o.hibernate.annotations.common.Version   : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2020-07-29 16:21:19.492  INFO 35960 --- [           main] org.redisson.Version                     : Redisson 3.13.1
2020-07-29 16:21:19.615  INFO 35960 --- [         task-1] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.MySQL57Dialect
2020-07-29 16:21:20.017  INFO 35960 --- [         task-1] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2020-07-29 16:21:20.032  INFO 35960 --- [         task-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2020-07-29 16:21:27.525  INFO 35960 --- [           main] o.r.cluster.ClusterConnectionManager     : Redis cluster nodes configuration got from /192.168.44.128:7000:
0c255df5d24f3adbbdcbaa3fc4253fed4a8c7b9d 192.168.44.128:7002@17002 master - 0 1596010886321 3 connected 10923-16383
89916e443012ba383abe88d498fc2beedb40a724 192.168.44.128:7001@17001 master - 0 1596010886119 2 connected 5461-10922
fdd5b5cad16dd7b2ec1af2a1e924bca063a0d485 192.168.44.128:7000@17000 myself,master - 0 1596010885000 1 connected 0-5460
42ef4cba5c428108c756f8d7e0686cf50c1de7c7 192.168.44.128:7004@17004 slave fdd5b5cad16dd7b2ec1af2a1e924bca063a0d485 0 1596010885315 5 connected
45f4c6de4886bf5649c701add740a876426c2943 192.168.44.128:7003@17003 slave 0c255df5d24f3adbbdcbaa3fc4253fed4a8c7b9d 0 1596010886000 4 connected
3076609e3f87450feb652640ba67347057c0b45a 192.168.44.128:7005@17005 slave 89916e443012ba383abe88d498fc2beedb40a724 0 1596010886522 6 connected2020-07-29 16:21:27.604  INFO 35960 --- [           main] o.r.cluster.ClusterConnectionManager     : slaves: [redis://192.168.44.128:7004] added for slot ranges: [[0-5460]]
2020-07-29 16:21:27.752  INFO 35960 --- [isson-netty-2-5] o.r.cluster.ClusterConnectionManager     : slaves: [redis://192.168.44.128:7005] added for slot ranges: [[5461-10922]]
2020-07-29 16:21:27.786  INFO 35960 --- [sson-netty-2-29] o.r.cluster.ClusterConnectionManager     : slaves: [redis://192.168.44.128:7003] added for slot ranges: [[10923-16383]]
2020-07-29 16:21:27.823  INFO 35960 --- [sson-netty-2-19] o.r.c.pool.MasterPubSubConnectionPool    : 1 connections initialized for /192.168.44.128:7001
2020-07-29 16:21:27.826  INFO 35960 --- [sson-netty-2-31] o.r.c.pool.MasterPubSubConnectionPool    : 1 connections initialized for /192.168.44.128:7000
2020-07-29 16:21:27.837  INFO 35960 --- [sson-netty-2-25] o.r.c.pool.MasterConnectionPool          : 24 connections initialized for /192.168.44.128:7002
2020-07-29 16:21:27.853  INFO 35960 --- [sson-netty-2-27] o.r.c.pool.PubSubConnectionPool          : 1 connections initialized for /192.168.44.128:7004
2020-07-29 16:21:27.854  INFO 35960 --- [sson-netty-2-29] o.r.cluster.ClusterConnectionManager     : master: redis://192.168.44.128:7000 added for slot ranges: [[0-5460]]
2020-07-29 16:21:27.854  INFO 35960 --- [sson-netty-2-26] o.r.cluster.ClusterConnectionManager     : master: redis://192.168.44.128:7002 added for slot ranges: [[10923-16383]]
2020-07-29 16:21:27.854  INFO 35960 --- [sson-netty-2-26] o.r.c.pool.MasterPubSubConnectionPool    : 1 connections initialized for /192.168.44.128:7002
2020-07-29 16:21:27.854  INFO 35960 --- [sson-netty-2-29] o.r.c.pool.MasterConnectionPool          : 24 connections initialized for /192.168.44.128:7000
2020-07-29 16:21:27.854  INFO 35960 --- [isson-netty-2-1] o.r.cluster.ClusterConnectionManager     : master: redis://192.168.44.128:7001 added for slot ranges: [[5461-10922]]
2020-07-29 16:21:27.854  INFO 35960 --- [isson-netty-2-1] o.r.c.pool.MasterConnectionPool          : 24 connections initialized for /192.168.44.128:7001
2020-07-29 16:21:27.865  INFO 35960 --- [sson-netty-2-16] o.r.connection.pool.SlaveConnectionPool  : 24 connections initialized for /192.168.44.128:7004
2020-07-29 16:21:27.866  INFO 35960 --- [sson-netty-2-18] o.r.c.pool.PubSubConnectionPool          : 1 connections initialized for /192.168.44.128:7005
2020-07-29 16:21:27.866  INFO 35960 --- [sson-netty-2-20] o.r.connection.pool.SlaveConnectionPool  : 24 connections initialized for /192.168.44.128:7005
2020-07-29 16:21:27.870  INFO 35960 --- [sson-netty-2-24] o.r.c.pool.PubSubConnectionPool          : 1 connections initialized for /192.168.44.128:7003
2020-07-29 16:21:27.872  INFO 35960 --- [sson-netty-2-25] o.r.connection.pool.SlaveConnectionPool  : 24 connections initialized for /192.168.44.128:7003
2020-07-29 16:21:28.149 ERROR 35960 --- [           main] o.a.catalina.core.AprLifecycleListener   : An incompatible version [1.2.8] of the Apache Tomcat Native library is installed, while Tomcat requires version [1.2.14]
2020-07-29 16:21:28.590  WARN 35960 --- [           main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2020-07-29 16:21:30.060  INFO 35960 --- [           main] DeferredRepositoryInitializationListener : Triggering deferred initialization of Spring Data repositories…
2020-07-29 16:21:30.061  INFO 35960 --- [           main] DeferredRepositoryInitializationListener : Spring Data repositories initialized!
2020-07-29 16:21:30.074  INFO 35960 --- [           main] c.lindl.mall.mapper.MallUserMapperTest   : Started MallUserMapperTest in 18.109 seconds (JVM running for 19.386){"deleted":0,"enabled":0,"name":"lll"}2020-07-29 16:21:30.871  INFO 35960 --- [extShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2020-07-29 16:21:30.874  INFO 35960 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
2020-07-29 16:21:30.931  INFO 35960 --- [extShutdownHook] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} closedProcess finished with exit code 0

当出现:

[ERR] Node 127.0.0.1:7001 is not empty. Either the node already knows other nodes (check with CLUSTER NODES) or contains some key in database 0.

错误操作,如果要重新配置文件。需要按ctrl+c将redis节点停掉,不要直接叉掉终端。

并且将

*.aof,

*.rdb,

nodes.conf

删除掉,然后重新启动就行了。

redis5.0.5版本搭建集群相关推荐

  1. centos7 redis5.0以前版本 部署集群示例 - 第二篇

    redis集群(5.0版本以前)的搭建,请参考笔者的这篇博客 https://blog.csdn.net/yzf279533105/article/details/103696990 redis集群( ...

  2. aix7.1.4上安装12.1.0.2版本RAC集群时遇到的bug无法创建mgmt库

    1.具体故障表现: 在AIX 7100-04-03-1642版本操作系统上安装ORACLE 12.1.0.2版本GRID集群软件时,运行root.sh脚本正常构建集群: 之后图形界面脚本之后的操作,在 ...

  3. centos7 redis5.0以后版本 集群部署示例

    简言 1. redis5.0版本以前的集群部署是使用ruby脚本完成的,略为复杂,具体示例见笔者的这篇博客,https://blog.csdn.net/yzf279533105/article/det ...

  4. ubuntu16 redis5.0以后版本集群部署示例

    简言 1. redis5.0版本以前的集群部署是使用ruby脚本完成的,略为复杂,具体示例见笔者的这篇博客,https://blog.csdn.net/yzf279533105/article/det ...

  5. ubuntu16 redis5.0以前版本集群部署示例

    简言 1. redis5.0版本以前集群的部署是使用ruby脚本完成的,ruby脚本的安装少略麻烦(主要原因是系统自动安装的版本太低,无法部署集群,必须手动安装) 2. redis5.0版本以后把集群 ...

  6. centos7 redis5.0以前版本 集群部署示例 - 第一篇

    简言 1. redis5.0版本以前的集群部署是使用ruby脚本完成的,ruby脚本的安装少略麻烦(主要原因是系统自动安装的版本太低,无法部署集群,必须手动安装) 2. redis5.0版本以后的集群 ...

  7. redis5.0使用redis-cli快速搭建集群

    1 下载安装redis5.0以上版本 $ ./redis-server --version 2安装gcc依赖 $ yum install gcc-c++ 3编译安装 $ tar xzf redis-5 ...

  8. redis 5.0.2 搭建集群

    前言 我们日常在对于redis的使用中,经常会遇到一些问题 高可用问题,如何保证redis的持续高可用性. 容量问题,单实例redis内存无法无限扩充,达到32G后就进入了64位世界,性能下降. 并发 ...

  9. Redis5搭建集群

    Redis5.x搭建集群 仅在同一台服务器测试 1.安装redis 安装redis完成之后复制六份 # 创建集群存放redis的文件夹 mkdir redis-clustercd ../cp -r r ...

最新文章

  1. 硬核!如何在 Github 精准搜索开源项目?
  2. Linux 进程状态【转】
  3. android圆形进度条ProgressBar颜色设置
  4. c++显式加载dll并使用DLL的类
  5. 腾讯云COS对象存储图片文件API的详细步骤过程
  6. Windows编程判断是否为该进程的父进程
  7. Serlizable序列化接口
  8. 基于Python+Django+Mysql的蔬菜水果在线购物商城
  9. Unity常用工具类
  10. Linux黑客基础01篇
  11. AdapterView及子类(一)
  12. BIOS int 10H中断介绍
  13. xposed修改手机屏幕分辨率
  14. 大数据MBA 通过大数据实现与分析驱动企业决策与转型
  15. 详解sklearn——CountVectorizer
  16. Bitly野心彰显,发布实时热门链接引擎Realtime
  17. 如何删除WhatsApp消息
  18. 浅谈虚拟化软件再防泄密领域的表现如何
  19. 射频毫米波芯片设计11:基于奇偶模法分析设计射频微波Wilkinson功分器
  20. July, 29(R)

热门文章

  1. 《断章》----卞之琳
  2. Socket套接字编程
  3. 为什么word修改下一节页眉奇偶不同会影响到下一节页眉的奇偶相同
  4. PMBOK项目管理实践
  5. 免费升级到 iOS 17 Developer Beta:官方Apple Store升级方案与爱思助手方法比较
  6. TextMeshPro使用说明
  7. 操作系统_05_调度算法(个人总结)
  8. ES6类和哨兵的错误跟踪
  9. python课程编程题汇总(中)
  10. 设计模式之状态模式详解