[心缘地方]同学录
首页 | 功能说明 | 站长通知 | 最近更新 | 编码查看转换 | 代码下载 | 常见问题及讨论 | 《深入解析ASP核心技术》 | 王小鸭自动发工资条VBA版
登录系统:用户名: 密码: 如果要讨论问题,请先注册。

[备忘]linux下安装redis

上一篇:[备忘]nginx的server_name匹配所有域名
下一篇:[备忘]jprofiler9.2注册码

添加日期:2017/9/14 12:14:51 快速返回   返回列表 阅读1908次
(1)安装
-------------------
yum install -y gcc
yum install -y tcl
wget http://download.redis.io/releases/redis-4.0.1.tar.gz
tar -xzvf redis-4.0.1.tar.gz
cd redis-4.0.1/src/
make
make test
make install

mkdir -p /usr/local/redis/bin
mkdir -p /usr/local/redis/etc
cd ..
cp redis.conf /usr/local/redis/etc/
cd src
mv mkreleasehdr.sh redis-benchmark redis-check-aof redis-check-dump redis-check-rdb redis-cli redis-sentinel redis-server  /usr/local/redis/bin/
---------------------------------

(2)修改path路径
-------------------------------------
vi /etc/profile
---------------------
PATH=$PATH:/usr/local/redis/bin
export PATH
----------------------
source /etc/profile


(3)运行:
redis-server

会报几个警告:
31084:M 14 Sep 19:39:07.644 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
31084:M 14 Sep 19:39:07.644 # Server initialized
31084:M 14 Sep 19:39:07.644 # 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.
31084:M 14 Sep 19:39:07.644 # 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.

先ctrl+c结束。

<3-1>
vim /etc/sysctl.conf

添加
net.core.somaxconn= 1024
vm.overcommit_memory = 1
保存,然后
sysctl -p

<3-2>
echo never > /sys/kernel/mm/transparent_hugepage/enabled
echo "echo never > /sys/kernel/mm/transparent_hugepage/enabled" >>/etc/rc.local

(4)修改配置文件,启动
vim /usr/local/redis/etc/redis.conf
daemonize 改为yes,即可后台启动redis

redis-server /usr/local/redis/etc/redis.conf

(5)测试
redis-cli
auth 你的密码
set name aaa
get name
exit

(6)关闭
redis-cli shutdown
redis-cli -a 你的密码 shutdown

(7)自动启动
echo "/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf" >>/etc/rc.local
 

评论 COMMENTS
没有评论 No Comments.

添加评论 Add new comment.
昵称 Name:
评论内容 Comment:
验证码(不区分大小写)
Validation Code:
(not case sensitive)
看不清?点这里换一张!(Change it here!)
 
评论由管理员查看后才能显示。the comment will be showed after it is checked by admin.
CopyRight © 心缘地方 2005-2999. All Rights Reserved