Centos6.5安装redis服务
来源:互联网 发布:冰川网络不败传说 编辑:程序博客网 时间:2024/05/12 01:15
下载redis安装包
wget http://download.redis.io/releases/redis-3.2.6.tar.gz
解压、编译、安装
tar -xvzf redis-3.2.6.tar.gz -C /usr/srccd /usr/src/redis-3.2.6/make && make install
创建redis相关目录
mkdir -p /home/redis/binmkdir -p /home/redis/logmkdir -p /home/redis/pidmkdir -p /home/redis/db
将可执行文件复制到自己的安装目录:/home/redis/
ln -s /usr/local/bin/redis-* /home/redis/bin/
复制配置文件到安装目录:/home/redis
cp redis.conf /home/redis/
编辑redis配置文件
cd /home/redis/vim /home/redis/redis.conf
tar -xvzf redis-3.2.6.tar.gz -C /usr/srccd /usr/src/redis-3.2.6/make && make install
mkdir -p /home/redis/binmkdir -p /home/redis/logmkdir -p /home/redis/pidmkdir -p /home/redis/db
cp redis.conf /home/redis/
根据实际需要修改配置文件,以下仅供参考
daemonize yespidfile /home/redis/pid/redis.pidlogfile /home/redis/log/redis.logdir /home/redis/dbport 6379tcp-backlog 511timeout 600tcp-keepalive 0loglevel noticedatabases 16save 900 1save 300 10save 60 10000rdbcompression yesdbfilename dump.rdbslave-serve-stale-data yesappendonly yesappendfilename "appendonly.aof"appendfsync everysecno-appendfsync-on-rewrite noauto-aof-rewrite-percentage 100auto-aof-rewrite-min-size 64mbslowlog-log-slower-than 10000slowlog-max-len 128latency-monitor-threshold 0notify-keyspace-events ""hash-max-ziplist-entries 512hash-max-ziplist-value 64list-max-ziplist-entries 512list-max-ziplist-value 64set-max-intset-entries 512zset-max-ziplist-entries 128zset-max-ziplist-value 64hll-sparse-max-bytes 3000activerehashing yesclient-output-buffer-limit normal 0 0 0client-output-buffer-limit slave 256mb 64mb 60client-output-buffer-limit pubsub 32mb 8mb 60hz 10aof-rewrite-incremental-fsync yes# vm-enabled no# maxmemory 4G
创建redis服务脚本
vim /etc/init.d/redis
#!/bin/sh## Simple Redis init.d script conceived to work on Linux systems# as it does use of the /proc filesystem.PATH=/home/redis/bin:/sbin:/usr/bin:/binREDISPORT=6379EXEC=/home/redis/bin/redis-serverCLIEXEC=/home/redis/bin/redis-cliPIDFILE=/home/redis/pid/redis.pidCONF="/home/redis/redis.conf"case "$1" in start) if [ -f $PIDFILE ] then echo "$PIDFILE exists, process is already running or crashed" else echo "Starting Redis server..." $EXEC $CONF fi ;; stop) if [ ! -f $PIDFILE ] then echo "$PIDFILE does not exist, process is not running" else PID=$(cat $PIDFILE) echo "Stopping ..." $CLIEXEC -p $REDISPORT shutdown while [ -x /proc/${PID} ] do echo "Waiting for Redis to shutdown ..." sleep 1 done echo "Redis stopped" fi ;; *) echo "Please use start or stop as first argument" ;;esac
添加redis服务开机启动
chmod a+x /etc/init.d/redis
启动redis服务
service redis startps -ef | grep redisnetstat -anptu | grep 6379
测试OK
redis-cli set key1 hello get key1 quit
(防火墙启用6379端口:iptables -A INPUT -p tcp --dport 6379 -j ACCEPT)
1 0
- Centos6.5安装redis服务
- Centos6.5安装Redis
- centos6.5安装Redis
- centos6.5Redis安装
- CentOS6.5 安装redis
- Redis centos6.5安装
- CentOS6.5 下Redis 安装
- centos6.5安装配置redis
- CentOS6.5安装LAMP+Redis
- centos6.5 yum安装redis
- centos6.5 yum安装redis
- redis安装在centos6.5
- centos6.5下安装redis
- CentOS6.5-dhcp服务安装
- CentOS6.5安装Apache服务
- centos6.8下redis安装与简单服务配置
- CentOS6上安装redis并配置服务自启动
- VMware安装CentOS6.5 + redis安装测试
- WbeBroswer控件不显示某些网页
- 选择有那么难吗?
- 查看一下数据库现有的进程数,是否已经达到参数processes的大小
- 计算机启动的过程
- Service的总结
- Centos6.5安装redis服务
- ios 10 在WebView中选择文件上传 出现 whose view is not in the window hierarchy!
- 关于Python安装和pip更新过程中遇到的问题及解决方案
- sicp 元循环求值器 全部源码
- POJ 2823 Sliding Window【RMQ压缩(长度确定)】
- android使用延时策略实现弹性滑动
- 【Leetcode】7.Reverse Integer
- 【JS学习】——DOM
- swagger环境的搭建(swagger-editor|swagger-ui)