zoukankan      html  css  js  c++  java
  • Spring Boot+redis

    1.整合单机版

      <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-redis</artifactId> </dependency>

      application.properties配置:

        spring.redis.host=192.168.66.66
        spring.redis.port=6379

    2.整合redis集群

      <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-redis</artifactId> </dependency>

      application.properties配置:spring.redis.cluster.nodes=192.168.66.7001,192.168.66.7002,192.168.66.7003,192.168.66.7004,192.168.66.7005

      src/main/java 下编写配置类:

      在service实现类中注入成员变量@Autowired private JedisCluster jedisCluster.

       jedisCluster.set("key","value");设置redis集群key的值是value

      或者@Autowired private RedisTemplate redisTemplate; boundValueOps

  • 相关阅读:
    NFS服务安装
    Redhat 6.3 yum 本地源配置
    在redhat enterprise linux 6中部署samba
    React
    链表
    map, set
    二叉查找树
    数制间的相互转换
    二维数组
    拖拽
  • 原文地址:https://www.cnblogs.com/god-monk/p/8872978.html
Copyright © 2011-2022 走看看