标签:page 1.2 command ret input over 生效 maximum rest
本文档 以 redhat 6.2 版本为例安装(其他系统版本需自行下载相关文件)创建用户
adduser redis
passwd redis
mkdir /home/redis/tools
将本次安装会是用到的 tar、zip 、rpm 等文件 ftp 到该目录
tar -xzvf redis-3.2.9.tar.gz
mv ../redis-3.2.9
cd ../
mv redis-3.2.9 redis-master
mkdir -p /home/redis/redis-master/bin
mkdir -p /home/redis/redis-master/log
mkdir -p /home/redis/redis-master/pid
mkdir -p /home/redis/redis-master/db
mkdir -p /home/redis/redis-master/sentinel
mkdir -p /home/redis/redis-master/conf
安装
1). 安装 gcc 编译环境 (root 帐号操作)
rpm -ivh kernel-headers-2.6.32-220.el6.x86_64.rpm
rpm -ivh glibc-headers-2.12-1.47.el6.x86_64.rpm
rpm -ivh glibc-devel-2.12-1.47.el6.x86_64.rpm
rpm -ivh mpfr-2.4.1-6.el6.x86_64.rpm
rpm -ivh ppl-0.10.2-11.el6.x86_64.rpm
rpm -ivh cloog-ppl-0.15.7-1.2.el6.x86_64.rpm
rpm -ivh cpp-4.4.6-3.el6.x86_64.rpm
rpm -ivh gcc-4.4.6-3.el6.x86_64.rpm
按顺序安装上面的 rpm 包
rpm -ivh 包名
2). 安装 tcl8.6.6 (root 帐号操作)
unzip tcl866-src.zip
mv tcl8.6.6 /opt/
cd /opt/tcl8.6.6/unix
./configure
make
make install /opt/tcl8.6.6
安装完成
3). 安装 redis (redis 帐号操作)
cd /home/redis/redis-master
进入之前的 redis-master 目录
PREFIX=/home/redis/redis-master make MALLOC=libc test // 测试安装 OK
PREFIX=/home/redis/redis-master/ make MALLOC=libc //正式安装
PREFIX=/home/redis/redis-master/ make install
安装完成
修改 redis.conf 基础配置
a. #bind 127.0.0.1 (注释掉)
b. port 6379 (生产建议修改为其他端口)
c. daemonize yes 设为后台运行程序
d. pidfile /home/redis/redis-master/pid/redis.pid 设置 pid 目录
e. logfile /home/redis/redis-master/log/redis.log 设置 log 目录
f. dir /home/redis/redis-master/db 设置 db 目录
g. requirepass redis 设置连接密码
redis 功能优化配置 :
root 编辑 /etc/security/limits.conf
添加
redis soft nofile 65535
redis hard nofile 65535
注意: redis 为安装启动运行 redis 的用户 ,如果使用 xxx 用户安装启动则配置为
xxx soft nofile 65535
xxx hard nofile 65535
以上配置修改用于解决下面四个警告:
3711:S 02 Mar 09:42:28.018 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
3711:S 02 Mar 09:42:28.046 # 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.
3711:S 02 Mar 09:42:28.084 # 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.
4063:S 02 Mar 09:57:33.685 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
4063:S 02 Mar 09:57:33.687 # Server can‘t set maximum open files to 10032 because of OS error: Operation not permitted.
4063:S 02 Mar 09:57:33.687 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase ‘ulimit -n‘.
root 开放端口
/sbin/iptables -I INPUT -p tcp --dport 6379 -j ACCEPT
/etc/rc.d/init.d/iptables save
/etc/init.d/iptables restart
标签:page 1.2 command ret input over 生效 maximum rest
原文地址:http://blog.51cto.com/jstorm/2318072