1.redis下载安装
cd /usr/local/src tar -zxvf redis-3.2.3.tar.gz wget http://download.redis.io/releases/redis-3.2.3.tar.gz cd redis-3.2.3 make PREFIX=/usr/local/redis-3.2.3 install ln -s /usr/loca/redis-3.2.3 /usr/local/redis
2.redis启动脚本
cp /usr/local/src/redis-3.2.3/utils/redis_init_script /etc/init.d/redis chmod +x /etc/init.d/redis vim /etc/init.d/redis 6 REDISPORT=6379 7 EXEC=/usr/local/redis/bin/redis-server # 启动命令更改 8 CLIEXEC=/usr/local/redis/bin/redis-cli
3.redi配置文件
mkdir /etc/redis cp /usr/local/src/redis-3.2.3/redis.conf /etc/redis/6379.conf # 修改redis的配置文件 [[email protected] ~]# vim /etc/init.d/6379.conf 61 bind 192.168.2.10 # 绑定IP地址 88 # In high requests-per-second environments you need an high backlog in order 89 # to avoid slow clients connections issues. Note that the Linux kernel 90 # will silently truncate it to the value of /proc/sys/net/core/somaxconn so 91 # make sure to raise both the value of somaxconn and tcp_max_syn_backlog 92 # in order to get the desired effect. 93 tcp-backlog 511 # 修改/proc/sys/net/core/somaxconn值 128 daemonize yes # no改成yes 163 logfile "/etc/redis/redis_6379.log" # 日志文件 247 dir /etc/redis/redis_6379 # 数据目录 480 requirepass xiaoyi # 开启密码认证 [[email protected] ~]# cat /proc/sys/net/core/somaxconn 128 [[email protected] ~]# echo 512 >/proc/sys/net/core/somaxconn [[email protected] ~]# cat /proc/sys/net/core/somaxconn 512 [[email protected] ~]# mkdir /etc/redis/redis_6379 [[email protected] local]# /etc/init.d/redis start
时间: 2024-10-25 15:41:51