redis 安装

该博客介绍了Redis的安装步骤,包括从指定网址下载,解压,编译二进制文件,并指出默认启动方式不会使用配置文件。建议修改redis.conf以调整配置,如启用守护进程模式。还提供了Redis新手教程链接及解决安装启动时可能遇到的问题。
摘要由CSDN通过智能技术生成

http://www.redis.net.cn/download

如何安装

下载,解压,编译:

 
 
  1. $ wget http://download.redis.io/releases/redis-3.0.6.tar.gz
  2. $ tar xzf redis-3.0.6.tar.gz
  3. $ cd redis-3.0.6
  4. $ make

二进制文件是编译完成后在src目录下. 运行如下:

 
 
  1. $ src/redis-server

注意: 此种启动方式 并不会调用src/redis.conf文件作为配置信息

所有的启动参数都是程序内部配置好的

如果想改变默认的配置参数, 可以以redis.conf作为模板进行编辑修改

一般需要做如下配置

我新建了一个redis.conf文件里面加了一行代码

daemonize   yes          #redis以守护进程的方式运行,no表示不以守护进程的方式运行(会占用一个终端)

logfile catalina.out  # 在根目录下记录日志


你能使用Redis的内置客户端进行进行redis代码的编写:

 
 
  1. $ src/redis-cli
  2. redis> set foo bar
  3. OK
  4. redis> get foo
  5. "bar"

你是redis新手吗?可以下看看我们制作的教程: redis教程.


redis安装启动 报错

8221:M 01 Mar 18:37:25.868 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
8221:M 01 Mar 18:37:25.868 # Server started, Redis version 3.0.6
8221:M 01 Mar 18:37:25.868 # 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.
8221:M 01 Mar 18:37:25.868 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
8221:M 01 Mar 18:37:25.868 * The server is now ready to accept connections on port 6379
^C8221:signal-handler (1488364669) Received SIGINT scheduling shutdown...
8221:M 01 Mar 18:37:49.714 # User requested shutdown...
8221:M 01 Mar 18:37:49.714 * Saving the final RDB snapshot before exiting.
8221:M 01 Mar 18:37:49.721 * DB saved on disk
8221:M 01 Mar 18:37:49.721 # Redis is now ready to exit, bye bye...

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值