日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

redis5.0.5版本搭建集群

發布時間:2023/12/20 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 redis5.0.5版本搭建集群 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?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版本搭建集群的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。