Redis

Spring Data Redis Lettuce Connection Issue

自闭症网瘾萝莉.ら 提交于 2021-01-05 14:37:53
问题 I have spring boot application with MYSQL DB and i am caching the data in Redis in server layer with @Cacheable Annotation @Cacheable(value= "employeeCache", key= "#customerId") @Override public Customer getEmployee(String customerId) { Optional<Customer> cust = customerRepository.findById(Long.parseLong(customerId)); if(cust.isPresent()) { return cust.get(); } return null; } I am using 1 Master 2 Slave and 2 sentinel node, i have deployed the application in docker containers, in AWS ec2

Python | Python学习之mysql交互详解

好久不见. 提交于 2021-01-05 12:02:02
前言 最近在学习scrapy redis,在复习redis的同时打算把mysql和mongodb也复习一下,本篇为mysql篇,实例比较简单,学习sql还是要动手实操记的比较牢。 安装与启动 安装:sudo apt-get install mysql-server 查看服务:ps ajx | grep mysql 停止服务:sudo service mysql stop 开启服务:sudo service mysql start 重启服务:sudo service mysql restart 链接数据库:mysql -uroot -p后输入密码 查看版本:select version(); 常见数据库语句 查看数据库:show database; 创建数据库:create database 库名 [charset = UTF8]; 查看建库语句:show create database 库名; 使用数据库:use 库名; 删除数据库:drop 库名; 常见数据表语句 查看表:show table; 查看表结构:desc 表名; 创建表: CREATE TABLE table_name( column1 datatype contrai, column2 datatype, column3 datatype, ..... columnN datatype, PRIMARY KEY

How do I run Redis on Windows 32 bit?

混江龙づ霸主 提交于 2021-01-05 09:58:45
问题 I have tried to set up Redis server on my windows 7 32 bit. I did not find a 32-bit supportive version of Redis. How can I do this? Advance thanks. 回答1: Download the .zip file to your hard drive. Unzip the files into any location, such as ‘C:\Program Files\Redis\’. Add the path of your Redis folder as a Windows ‘environment variable.’ Open your Command Prompt (ex: cmd.exe). install redis server redis-server --service-install start redis server redis-server --service-start save and stop the

数据结构与算法笔记(二)

五迷三道 提交于 2021-01-05 07:34:03
跳表 前面的数据结构笔记中分析过链表,如图所示: 由于它的内存空间非连续,因此查找某个元素时只能从头到尾遍历,时间复杂度为 O(n)。 那么能不能提高链表的查找效率呢? 我们可以对链表进行改造,在链表上建立一级“索引”,如图: 这样,在查找的时候就可以先在索引层查找,然后再根据索引去查数据(有点类似数据库的索引)。 为了进一步提高查找效率,还可以建立二级索引,如图: 以此类推,还可以建立更多层级的索引: 这种数据结构称为跳表( Skip List )。这样做查找速度更快了,但同时也会耗费更多的存储空间,它的思想其实就是空间换时间。 应用场景:Redis 的有序集合。 散列表 散列表( Hash table ),又称“哈希表”或“ Hash 表”。利用的是数组支持按照下标访问数据(时间复杂度为 O(1) )的特性,是数组的一种扩展。示意图: 其中的 key 为可理解为要存入的数据的键(键-值对形式); hash() 是「散列函数」, 它根据 key 计算得到一个非负整数, 是哈希表实现的一个关键点 ; table 为存放数据的数组。 散列表存入数据的大概流程是:将 key 经过散列函数计算得到一个值(保证在数组长度范围内)作为数组的下标,然后将 key 的值保存在数组下标对应的位置。 散列函数 散列函数设计的基本要求: 1. 散列函数计算得到的散列值是一个非负整数(数组下标从 0

Spark Structured Streaming dynamic lookup with Redis

三世轮回 提交于 2021-01-05 07:31:09
问题 i am new to spark. We are currently building a pipeline : Read the events from Kafka topic Enrich this data with the help of Redis-Lookup Write events to the new Kafka topic So, my problem is when i want to use spark-redis library it performs very well, but data stays static in my streaming job. Although data is refreshed at Redis, it does not reflect to my dataframe. Spark reads data at first then never updates it. Also i am reading from REDIS data at first,total data about 1mio key-val

Dubbo面试题(2020最新版)

不问归期 提交于 2021-01-05 01:42:02
基础知识 为什么要用 Dubbo? 随着服务化的进一步发展,服务越来越多,服务之间的调用和依赖关系也越来越复杂,诞生了面向服务的架构体系(SOA),也因此衍生出了一系列相应的技术,如对服务提供、服务调用、连接处理、通信协议、序列化方式、服务发现、服务路由、日志输出等行为进行封装的服务框架。就这样为分布式系统的服务治理框架就出现了,Dubbo 也就这样产生了。 Dubbo 是什么? Dubbo 是一款高性能、轻量级的开源 RPC 框架,提供服务自动注册、自动发现等高效服务治理方案, 可以和 Spring 框架无缝集成。 Dubbo 的使用场景有哪些? 透明化的远程方法调用:就像调用本地方法一样调用远程方法,只需简单配置,没有任何API侵入。 软负载均衡及容错机制:可在内网替代 F5 等硬件负载均衡器,降低成本,减少单点。 服务自动注册与发现:不再需要写死服务提供方地址,注册中心基于接口名查询服务提供者的IP地址,并且能够平滑添加或删除服务提供者。 Dubbo 核心功能有哪些? Remoting:网络通信框架,提供对多种NIO框架抽象封装,包括“同步转异步”和“请求-响应”模式的信息交换方式。 Cluster:服务框架,提供基于接口方法的透明远程过程调用,包括多协议支持,以及软负载均衡,失败容错,地址路由,动态配置等集群支持。 Registry:服务注册,基于注册中心目录服务

Redis系列(二):Redis高可用集群

守給你的承諾、 提交于 2021-01-04 13:04:00
一、集群模式   Redis集群是一个由多个主从(主从在 Redis系列(四): Redis持久化和主从复制原理 中详细介绍,这里先有个概念 )节点组成的高可用集群,它具有复制、高可用和分片等特性 二、集群部署 1、环境   3台主机分别是:   192.168.160.146   192.168.160.152   192.168.160.153   每台服务器1主1从,共3主3从   相关安装包存储路径:/usr/local/redis-5.0.2 2、部署    ① Redis安装详见 Redis系列(一):Redis简介    ② 进入redis-5.0.2 cd /usr/local/redis-5.0.2    ③ 创建集群配置文件夹 mkdir redis-cluster    ④ (1)cd redis-cluster (2) mkdir 7001 和 mkdir 7002    ⑤ (1)cp /usr/local/redis-5.0.2/redis.conf 7001/ (2) cd 7001    ⑥ 编辑redis配置文件 vim redis.conf 修改内容如下: daemonize yes port 7001 dir /usr/local/redis-5.0.2/redis-cluster/7001/ 这里只是demo

Redis Synchronous replication failure scenarios

旧城冷巷雨未停 提交于 2021-01-04 05:45:23
问题 In redis cluster specification here https://redis.io/topics/cluster-tutorial it mentions however note that Redis Cluster does not implement strong consistency even when synchronous replication is used: it is always possible under more complex failure scenarios that a slave that was not able to receive the write is elected as master. If I issue WAIT command with WAIT 0 <No.Of Salves> then I am forcing at the expense of availability to write data in all the slaves. Could you explain me in this

GO语言-Redis 连接池

大兔子大兔子 提交于 2021-01-03 17:30:17
自留笔记:从beego中分离出来的 //file name: redis.go package conn import ( // "fmt" "github.com/garyburd/redigo/redis" ) var MAX_POOL_SIZE = 20 var redisPool chan redis.Conn func putRedis(conn redis.Conn) { if redisPool == nil { redisPool = make(chan redis.Conn, MAX_POOL_SIZE) } if len(redisPool) >= MAX_POOL_SIZE { conn.Close() return } redisPool <- conn } func InitRedis(network, address string) redis.Conn { redisPool = make(chan redis.Conn, MAX_POOL_SIZE) if len(redisPool) == 0 { go func() { for i := 0; i < MAX_POOL_SIZE/2; i++ { c, err := redis.Dial(network, address) if err != nil { panic(err) } putRedis