no-sql数据库之redis
一、FAQ
1、如果用连接器连接redis不成功,报如下错误:
crash-report-server replied:Request Entity Too Large

则可以先通过cmd命令查看端口连接:

使用telnet ip 端口号查看,若出现:

则可以按照上面说明进行修改:

再次连接:


成功后会出现提示信息:

2、外网无法连接,只能本机访问:
---------------------------------------以下部分为转载-------------------------------------------
在配置文件redis.conf中,默认的bind 接口是127.0.0.1,也就是本地回环地址。这样的话,访问redis服务只能通过本机的客户端连接,而无法通过远程连接,
这样可以避免将redis服务暴露于危险的网络环境中,防止一些不安全的人随随便便通过远程
连接到redis服务。
如果bind选项为空的话,那会接受所有来自于可用网络接口的连接。
在使用redis的时候出现连接不成功;
在项目中导入jar包jedis-2.7.2.jar,编写测试类
@Test
public void testJedisSingle() throws Exception {
//创建一个jedis对象
Jedis jedis = new Jedis("192.168.64.129",6379);
jedis.set("test", "hello jedis");
String string = jedis.get("test");
System.out.println(string);
jedis.close();
}
根据redis.conf配置文件中bind的值的不同,出现不同的提示信息;但是不影响Linux系统中redis的正常使用;
当不存在bind时
redis.clients.jedis.exceptions.JedisDataException: 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.
当bind 本机ip地址时
代码可以测试通过,但是Linux系统中出现问题
[root@root redis]# ./bin/redis-cli -c
Could not connect to Redis at 127.0.0.1:6379: Connection refused
Could not connect to Redis at 127.0.0.1:6379: Connection refused
当bind 为默认的127.0.0.1时
代码测试不通过
redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refused: connect
Linux中操作正常
目前采用的方式,代码和Linux中的redis客户端都可以使用
1.在bind中配置多个IP地址,bind 192.168.64.129 127.0.0.1
2.将bind的值配置为bind 0.0.0.0
-------------------------转自https://www.cnblogs.com/lonelyxmas/p/8084808.html--------------------------------
3、redis.conf不生效
--------------------以下部分为转载------------------------
修改redis.conf后,重启redis,发现修改的配置未生效,原来是需要在启动redis的时候在命令中加上配置文件,命令如下:
./redis-server /usr/local/redis-3.2./redis.conf &
仔细阅读配置文件可以开头看到有这样的描述:
# Note that in order to read the configuration file, Redis must be
# started with the file path as first argument:
#
# ./redis-server /path/to/redis.conf
-----------------------转自https://blog.csdn.net/shiyong1949/article/details/78197267-----------------------
no-sql数据库之redis的更多相关文章
- 使用关系型数据库作为Redis落地的思路
Redis的持久化方式主要有2种:RDB和AOF,但各有不足,同时Redis没有SQL支持,Redis本身提供的命令不足以实现大多数SQL查询需求,对后期运营的分析需求支撑不足.此外,对于游戏来说,活 ...
- Linux实战教学笔记45:NoSQL数据库之redis持久化存储(一)
第1章 redis存储系统 1.1 redis概述 REmote DIctionary Server(Redis)是一个基于key-value键值对的持久化数据库存储系统.redis和大名鼎鼎的Mem ...
- Python操作nosql数据库之redis
一.NoSQL的操作 NoSQL,泛指非关系型的数据库.随着互联网web2.0网站的兴起,传统的关系数据库在应付web2.0网站,特别是超大规模和高并发的SNS类型的web2.0纯动态网站已经显得力不 ...
- 非关系型数据库(NOSQL)-Redis
整理一波Redis 简介,与memcached比较 官网:http://redis.io Redis是一个key-value存储系统.和Memcached类似,它支持存储的value类型相对更多,包括 ...
- 告诉你 SQL 数据库与 NoSQL 数据库的区别
简单来说 SQL 数据库和 NoSQL 数据库有着共同的目标:存储数据,但存储的方式不同 一. 表 SQL中的表结构具有严格的数据模式约束: 存储数据很难出错. NoSQL存储数据更加灵活自由:可能导 ...
- NOSQL数据库之 REDIS
NOSQL数据库之 REDIS 一.NOSQL 1.简介 NoSQL ,(Not Only SQL),泛指非关系型数据库. 特点: NoSQL 通常是以key-value形式存储, 不支持SQL语句, ...
- OAuth + Security - 5 - Token存储升级(数据库、Redis)
PS:此文章为系列文章,建议从第一篇开始阅读. 在我们之前的文章中,我们当时获取到Token令牌时,此时的令牌时存储在内存中的,这样显然不利于我们程序的扩展,所以为了解决这个问题,官方给我们还提供了其 ...
- Redis 01: 非关系型数据库 + 配置Redis
数据库应用的发展历程 单机数据库时代:一个应用,一个数据库实例 缓存时代:对某些表中的数据访问频繁,则对这些数据设置缓存(此时数据库中总的数据量不是很大) 水平切分时代:将数据库中的表存放到不同数据库 ...
- KTV项目 SQL数据库的应用 结合C#应用窗体
五道口北大青鸟校区 KTV项目 指导老师:袁玉明 歌曲播放原理 SQL数据库关系图 C#解决方案类图 第一步:创建数据库连接方法和打开方法和关闭方法! public class DBHelper { ...
- jquery autocomplete实现读取sql数据库自动补全TextBox
转自我本良人 原文 jquery autocomplete实现读取sql数据库自动补全TextBox 项目需要这样子一个功能,其他部门提的意见,只好去实现了哦,搞了好久才弄出来,分享一下. 1.前台页 ...
随机推荐
- php快速定位当前调用的类的位置
php快速定位当前调用的类的位置 $func = new ReflectionMethod('类名', '方法名'); $start = $func->getStartLine() - 1; $ ...
- (转)Spring Boot (十九):使用 Spring Boot Actuator 监控应用
http://www.ityouknow.com/springboot/2018/02/06/spring-boot-actuator.html 微服务的特点决定了功能模块的部署是分布式的,大部分功能 ...
- C. Edgy Trees Codeforces Round #548 (Div. 2) 并查集求连通块
C. Edgy Trees time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...
- 从 0 → 1,学习Linux该这么开始!
首先我们还是来普及以下概念,讲点虚的.现在是图形系统的天下,windows我们用了20多年.成功归功与它图形界面,你会点鼠标吗你会敲键盘吗?所以你会上网会聊天会玩游戏了.那么,0基础接触的Linux, ...
- 15.selenium_case03
# 利用搜狗搜索接口抓取微信公众号 # 搜狗的微信搜索: # http://weixin.sogou.com # 搜索:“Python爱好者社区” # 找到它的微信号:python_shequ fro ...
- Python3爬虫 利用百度地图api得到城市经纬度
有2种方式,第一种是利用urllib , 方法1:利用urllib , 先把url 转成urlcode,然后读取网页,读到网页再用json读取内容,比较麻烦. 可以在浏览器输入,看一下格式. http ...
- sqrt函数
import numpy as np B = np.arange(3) print (B) print (np.sqrt(B)) #求平方根
- [tool] AI视频翻译 解决英文视频字幕问题(类似youtube自动生成字幕)
1.网易见外是网易人工智能事业部旗下的AI视频翻译产品. 字幕支持手工编辑和下载 不过网易见外 只支持WEB在线操作 并且只支持单个上传操作 目前没有客户端 2.人人译视界 (IOS 安卓 PC客户端 ...
- SPA游标采集之去除重复
注:转:http://shsnc2014.blog.163.com/blog/static/2403690822014102411217903/ 当我们做数据库升级项目的时候,我们一般会去做性能回归测 ...
- Linux:Day7(上) find、文件特殊权限、if语句
文件查找: 在文件系统上查找符合条件的文件: 文件查找工具:locate,find locate:非实时查找(数据库查找) find:实时查找: locate: 依赖于事先 构建的索引:索引的构建是在 ...