Redis

TimeoutError: [Errno 110] Connect call failed when trying to connect to redis service in docker

偶尔善良 提交于 2021-02-11 12:25:38
问题 I'm dockerizing a web application that uses Django Channels for websocket functionality. It depends on redis. I'm having trouble getting the redis portion of the application to work correctly. I've tried to stick to this redis/compose guide. docker-compose.yml version: "3" services: db: image: mysql:latest volumes: - "./.mysql-data/db:/var/lib/mysql" restart: always ports: - 3306:3306 environment: MYSQL_ROOT_PASSWORD: rootpassword MYSQL_DATABASE: database MYSQL_USER: user MYSQL_PASSWORD:

Redis BGSAVE因为内存不足 fork 失败导致目标 Redis 无法访问的问题

本小妞迷上赌 提交于 2021-02-11 10:32:55
中秋的时候正在外面愉快的在外卖喝着咖啡玩电脑。。。。。。突发 redis 报警从 sentry 应用端曝出的错误 MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error. 于是又开始愉快的处理问题了,看上去像是执行 rdb 快照持久化的时候出现的问题,上到 redis 机器查看日志定位详细问题 420 :M 14 Sep 15 : 56 : 27.067 # Can ' t save in background: fork: Cannot allocate memory 420 :M 14 Sep 15 : 56 : 33.071 * 10000 changes

当我去了网易上班,才知道为什么人人都想进大厂了,附上我进网易的面试宝典!

巧了我就是萌 提交于 2021-02-11 06:43:32
前言 首先自我介绍一下,本人南京某渣渣本科毕业,毕业后一直待在一家不大不小的公司里面摸鱼等死,今年疫情的时候差点被裁员裁掉,自己想了想总不能就这样下去了吧,前几个月决心辞职。辞职后去面了几家公司有过的有被毙的 也没拿到满意的offer,自己在家闲下来学习了几个月,上个月朋友给了一个网易的内推,想着去试试,结果过了! 我这里准备了一线大厂面试资料和我原创的超硬核PDF技术文档,以及我为大家精心准备的多套大厂面试题(不断更新中),有需要的朋友 点击这里备注csdn,自行下载即可 希望大家都能找到心仪的工作! java基础相关 1.手撕代码。牛客题霸上的原题,可以去看看:NC20数字字符串转化成IP地址 2.定义Integer x=20 Integer y=200 在内存里是个什么过程? 3.volite关键字的原理?它能保证原子性吗?AtomicInteger底层怎么实现的? 4.threadLocal关键字有用过吗?如果没有重写initialValue方法就直接get会怎样? 5.hashMap与concurrentHashMap原理和区别? 6.hashMap什么情况下会出现循环链表?concurrentHashMap写的时候用什么锁?7.RenteenLock底层是怎么保证线程安全的? 8.反射能获取到父类的私有方法吗?怎么防止反射破坏单例模式? 9.描述下JVM内存模型

单线程Redis性能为何如此之高?

人盡茶涼 提交于 2021-02-11 01:34:21
文章原创于公众号:程序猿周先森。本平台不定时更新,喜欢我的文章,欢迎关注我的微信公众号。 实际项目开发中现在无法逃避的一个问题就是缓存问题,而缓存问题也是面试必问知识点之一,如果面试官好一点可能会简单的问你二八定律或者热数据和冷数据,但是如果问的深入一点可能就会问到缓存更新、降级、预热、雪崩、穿透等问题,而这些问题可能会拦下大部分平时不怎么关注缓存的朋友,这些问题实际上都和缓存服务器息息相关,我们日常中经常使用的缓存服务器一般有两种:Redis和Memcached。本篇开始正式进入Redis系列文章,本篇主要讲讲Redis使用单线程为何速度还能如此之快? 既然谈到缓存服务器有两种,那我们为何要选择Redis呢?Redis与Memcached两者之间有何区别呢? Redis 和 Memcached 的区别 Redis支持常见数据类型:Redis 不仅仅支持简单的 key/value 类型的数据,同时还提供string(字符串)、list(链表)、set(集合)、zset(有序集合)和hash(哈希类型)等数据结构的存储。而Memcache 只支持简单的数据类型 String。 Redis 支持数据的持久化,可以将内存中的数据保持在磁盘中,重启的时候可以再次加载进行使用,而 Memecache 把数据全部存在内存之中。 集群模式:Memcached 没有原生的集群模式

微信生成授权URL

假装没事ソ 提交于 2021-02-10 23:01:27
一 准备工作 1 注册 微信开放平台: https://open.weixin.qq.com 2 邮箱激活 3 完善开发者资料 4 开发者资质认证 准备营业执照,1-2个工作日审批、300元 5 创建网站应用 提交审核,7个工作日审批 6 熟悉微信登录流程 获取access_token时序图 参考文档: https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419316505&token=e547653f995d8f402704d5cb2945177dc8aa4e7e&lang=zh_CN 第一步:请求CODE(生成授权URL) 第二步:通过code获取access_token(开发回调URL) 二 后端开发 service_ucenter微服务 1 添加配置 open: # 微信开放平台 appid appId: <你的微信开放平台appid> # 微信开放平台 appsecret appSecret: <你的微信开放平台 appsecret> # 微信开放平台 重定向url(guli.shop需要在微信开放平台配置) redirectUri: <你的微信开放平台 重定向url> 2 创建常量类 创建util包

Redis Pub/Sub - Publisher also a subscriber?

寵の児 提交于 2021-02-10 19:12:19
问题 I'm new to Redis, and I've been messing around with the Pub/Sub. Due to dependency factors, I would like the publisher to also be the subscriber of a channel, such that when the publisher sends a message through the channel, they also receive the message. Is this possible? 回答1: No it is not possible with pub/sub because there is no persistence. When the publisher publishes the message to a channel, only the connected clients of the channel will receive the message. No message will be saved.

Redis Pub/Sub - Publisher also a subscriber?

心不动则不痛 提交于 2021-02-10 19:11:43
问题 I'm new to Redis, and I've been messing around with the Pub/Sub. Due to dependency factors, I would like the publisher to also be the subscriber of a channel, such that when the publisher sends a message through the channel, they also receive the message. Is this possible? 回答1: No it is not possible with pub/sub because there is no persistence. When the publisher publishes the message to a channel, only the connected clients of the channel will receive the message. No message will be saved.

Redis Pub/Sub - Publisher also a subscriber?

血红的双手。 提交于 2021-02-10 19:10:07
问题 I'm new to Redis, and I've been messing around with the Pub/Sub. Due to dependency factors, I would like the publisher to also be the subscriber of a channel, such that when the publisher sends a message through the channel, they also receive the message. Is this possible? 回答1: No it is not possible with pub/sub because there is no persistence. When the publisher publishes the message to a channel, only the connected clients of the channel will receive the message. No message will be saved.

Listen for changes in redis list

白昼怎懂夜的黑 提交于 2021-02-10 18:42:01
问题 I want to write a function that constantly listens for changes in a redis list (usually when elements are pushed to the list) and pops its elements whenever the list is not empty. Then it will execute a function on the popped elements. How should I implement this? 回答1: You can use notify-keyspace-events for that example with Node.js but the idea is similar for other languages. const Redis = require('ioredis') const redis = new Redis() ;(async function () { redis.on('ready', () => { console

Listen for changes in redis list

吃可爱长大的小学妹 提交于 2021-02-10 18:40:45
问题 I want to write a function that constantly listens for changes in a redis list (usually when elements are pushed to the list) and pops its elements whenever the list is not empty. Then it will execute a function on the popped elements. How should I implement this? 回答1: You can use notify-keyspace-events for that example with Node.js but the idea is similar for other languages. const Redis = require('ioredis') const redis = new Redis() ;(async function () { redis.on('ready', () => { console