Redis
安装
其实之前有一篇文章记录过redis的安装过程。redis安装其实很简单的。
# tar -zxvf redis-3.2.0.tar.gz
# make
# make PREFIX=/usr/local/redis-3.2.0 install
安装hiredis
# cd deps/hiredis
# make install
/usr/local/lib
├── libhiredis.a
├── libhiredis.so -> libhiredis.so.0
├── libhiredis.so.0 -> libhiredis.so.0.11
└── libhiredis.so.0.11
0 directories, 4 files
/usr/local/include/
└── hiredis
├── adapters
│ ├── ae.h
│ ├── libevent.h
│ ├── libev.h
│ └── libuv.h
├── async.h
└── hiredis.h
指定hiredis安装目录
# make PREFIX=/usr/local/redis-3.2.0 install
/usr/local/redis-3.2.0/lib
├── libhiredis.a
├── libhiredis.so -> libhiredis.so.0
├── libhiredis.so.0 -> libhiredis.so.0.11
└── libhiredis.so.0.11
0 directories, 4 files
/usr/local/redis-3.2.0/include/
└── hiredis
├── adapters
│ ├── ae.h
│ ├── libevent.h
│ ├── libev.h
│ └── libuv.h
├── async.h
└── hiredis.h
2 directories, 6 files
单独安装hiredis
$ tar -zxvf hiredis-1.0.0.tar.gz
$ make
$ make PREFIX=/usr/local/hiredis-1.0.0 install
├─include │ └─hiredis │ │ alloc.h │ │ async.h │ │ hiredis.h │ │ read.h │ │ sds.h │ │ │ └─adapters │ ae.h │ glib.h │ ivykis.h │ libev.h │ libevent.h │ libuv.h │ macosx.h │ qt.h │ └─lib │ libhiredis.a │ libhiredis.so.1.0.0 │ └─pkgconfig hiredis.pc
启动
# redis-server
4944:C 12 Oct 05:04:49.824 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
4944:M 12 Oct 05:04:49.832 * Increased maximum number of open files to 10032 (it was originally set to 1024).
4944:M 12 Oct 05:04:49.885 # Warning: 32 bit instance detected but no memory limit set. Setting 3 GB maxmemory limit with 'noeviction' policy now.
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 3.0.0 (00000000/0) 32 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 4944
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
4944:M 12 Oct 05:04:49.896 # Server started, Redis version 3.0.0
4944:M 12 Oct 05:04:49.920 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
4944:M 12 Oct 05:04:49.923 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
4944:M 12 Oct 05:04:49.924 * The server is now ready to accept connections on port 6379
连接
连接到redis可以通过redis提供的redis-cli工具,还可以通过telnet的方式连接到redis。
通过redis-cli工具连接到redis
# redis-cli
127.0.0.1:6379> help
redis-cli 3.0.0
Type: "help @<group>" to get a list of commands in <group>
"help <command>" for help on <command>
"help <tab>" to get a list of possible help topics
"quit" to exit
# redis-cli -h 127.0.0.1 -p 6379
通过redis-cli工具还可以不进入命令行模式下直接执行命令:
# redis-cli get hello
"this is c"
# redis-cli set key1 value1
OK
# redis-cli get key1
"value1"
通过telnet的方式连接到redis
>telnet 192.168.0.102 6379
配置文件
可以从源代码程序中拷贝一份配置文件模板:
# cp /home/root/packages/redis-3.2.0/redis.conf /usr/local/redis-3.2.0/redis-default.conf
# cp /home/root/packages/redis-3.2.0/sentinel.conf /usr/local/redis-3.2.0/sentinel-default.conf
-DENIED Redis is running in protected mode because protected mode is e
nabled, no bind address was specified, no authentication password is r
equested to clients. In this mode connections are only accepted from t
he 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' fro
m 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 pe
rmanent. 2) Alternatively you can just disable the protected mode by e
diting the Redis configuration file, and setting the protected mode op
tion to 'no', and then restarting the server. 3) If you started the se
rver manually just for testing, restart it with the '--protected-mode
no' option. 4) Setup a bind address or an authentication password. NOT
E: You only need to do one of the above things in order for the server
to start accepting connections from the outside.
第一种方式
# ./redis-cli
127.0.0.1:6379> CONFIG SET protected-mode no
OK
这样就行了:
GEODIST Sicily Palermo Catania
$11
166274.1516
GEORADIUS Sicily 15 37 100 km
*1
$7
Catania
GEORADIUS Sicily 15 37 200 km
*2
$7
Palermo
$7
Catania
第二种方式
# cat ../redis.conf
protected-mode no
# ./redis-server ../redis.conf
这样就行了:
GEODIST Sicily Palermo Catania
$11
166274.1516
GEORADIUS Sicily 15 37 100 km
*1
$7
Catania
GEORADIUS Sicily 15 37 200 km
*2
$7
Palermo
$7
Catania
第三种方式
# ./redis-server --protected-mode no
这样就行了:
GEODIST Sicily Palermo Catania
$11
166274.1516
GEORADIUS Sicily 15 37 100 km
*1
$7
Catania
GEORADIUS Sicily 15 37 200 km
*2
$7
Palermo
$7
Catania
第四种方式
# cat ../redis.conf
bind 0.0.0.0
这样就行了:
GEODIST Sicily Palermo Catania
$11
166274.1516
GEORADIUS Sicily 15 37 100 km
*1
$7
Catania
GEORADIUS Sicily 15 37 200 km
*2
$7
Palermo
$7
Catania
第五种方式
# cat ../redis.conf
requirepass 123456
连接的时候通过auth命令指定密码,这样就行了:
auth 123456
+OK
GEODIST Sicily Palermo Catania
$11
166274.1516
GEORADIUS Sicily 15 37 100 km
*1
$7
Catania
GEORADIUS Sicily 15 37 200 km
*2
$7
Palermo
$7
Catania
相关推荐
ubuntu下docker安装redis:6.2.14
掌握Redis:从安装到高效数据处理的核心原理与技巧
Windows 上安装 Redis安装Windows 上安装 Redis安装Windows 上安装 Redis安装Windows 上安装 Redis安装Windows 上安装 Redis安装Windows 上安装 Redis安装Windows 上安装 Redis安装Windows 上安装 Redis安装Windows ...
安装npm install --save keyv ioredis @microlink/keyv-redis用法const Keyv = require ( 'keyv' )const keyv = new Keyv ( 'redis://user:pass@localhost:6379' ) 任何有效的选项都将直接通过。 const keyv = new ...
【安装部署】-Linux上安装Redis教程 本篇是基于CentOS7,安装Redis版本为redis-6.2.6。 一、下载并解压Redis ...1、进入redis安装目录,执行make命令编译redis: cd /usr/local/redis make 等待make命令执行完成即可。
一些用于redis的(例如 )需要在本地主机上安装redis-server。 用法 参见 基本的: steps : - uses : actions/checkout@v2 - uses : shogo82148/actions-setup-redis@v1 with : redis-version : ' 6.x ' - run ...
内容概要:本文提供了CentOS 7下安装Redis的详细教程,包括安装、配置、启动和测试等多个方面,并提供了相关代码和操作步骤。 使用人群:需要在CentOS 7系统中安装Redis的程序员和技术人员。 内容关键词:CentOS 7...
redis2.8.6的安装过程和一些错误的解决,
redis:安装路径/usr/local/redis,配置文件redis.cnf路径/usr/local/redis/bin/ mongodb:安装路径/usr/local/mongodb 启动命令: mysqld --user=root /usr/local/redis/bin/redis-server /usr/local/redis/bin/...
Redis 6.2.1 现已发布,该版本升级迫切性程度为低:修复了编译问题。具体更新内容如下: Bug 修复 修复带有已删除记录的 stream 的 sanitize-dump-payload(#8568) 防止将 client-query-buffer-limit 配置设置为...
Linux环境下安装步骤 从redis官网下载出对应的安装包,本文档以3.2.0版本为例子
独库redis dokku 的官方 redis 插件。 当前默认安装 。 要求 独孤 0.19.x+ 码头工人 1.8.x 安装 # on 0.19.x+ sudo dokku plugin:install https://github.com/dokku/dokku-redis.git redis 命令 redis:app-links...
厨师-redis 描述 这本食谱从 Chris Lea 的...如果 Redis 组件不存在,本说明书将安装它们,如果系统上安装了它们,则提取更新。 属性 case node [ "platform" ] when "debian" default [ "redis" ] [ "apt_distribut
Redis3集群安装Redis3集群安装Redis3集群安装Redis3集群安装Redis3集群安装Redis3集群安装Redis3集群安装Redis3集群安装Redis3集群安装Redis3集群安装Redis3集群安装Redis3集群安装Redis3集群安装Redis3集群安装...
安装将此行添加到应用程序的 Gemfile 中: gem 'pooled_redis'用法使用Redis.new支持的选项将redis部分添加到您的database.yml development : redis : db : 2production : redis : url : ' redis://mymaster ' ...
Redis/Redis 哨兵多实例安装配置模块。 目录 评论属性 多个Redis实例 服务 例子 Redis LRU缓存 Redis 哨兵 Redis + Redis 哨兵 + LRU 缓存 安装 木偶 图书管理员木偶 测试 单元测试 烟雾测试 作者 贡献 执照 地位...
以下是Redis的安装和配置步骤: ### 1. 下载Redis 您可以从Redis官方网站(https://redis.io/download)下载最新版本的Redis。选择合适的版本并下载压缩包到本地。 ### 2. 解压Redis 在您希望安装Redis的目录中...
arm服务器redis5.0.3
首先使用pip install flask-redis安装扩展。 完成后,在Flask配置中对其进行配置。 像这样设置您的Redis实例的URL: REDIS_URL = "redis://:password@localhost:6379/0" 如果要连接到Unix套接字,可以将其指定为...