Linux下安装配置Redis
一 下载并安装
[root@localhost src]# wget http://download.redis.io/releases/redis-3.2.5.tar.gz
[root@localhost src]# tar -zxvf redis-3.2.5.tar.gz [root@localhost src]# cd redis-3.2.5 [root@localhost src]# make [root@localhost src]# make install
[root@localhost src]# redis-server -v Redis server v=3.2.5 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=e6b75f3646645042
二 配置
[root@localhost src]# cd /etc [root@localhost etc]# mkdir redis
[root@localhost etc]# cd /var [root@localhost var]# mkdir redis [root@localhost var]# cd redis [root@localhost redis]# mkdir data log run
[root@localhost src]# cd /usr/local/src/redis-3.2.5/ [root@localhost redis-3.2.5]# cp redis.conf /etc/redis/ [root@localhost redis-3.2.5]# vim /etc/redis/redis.conf
#绑定的主机地址,这里是允许其他所有主机访问 bind 0.0.0.0 #端口 port 6379 #认证密码 requirepass admin #pid目录 pidfile /var/redis/run/redis_6379.pid #log存储目录 logfile /var/redis/log/redis.log #dump目录 dir /var/redis/data #Redis默认不是以守护进程的方式运行,可以通过该配置项修改,使用yes启用守护进程 daemonize yes
save, shutdown, slave 命令会触发这个操作。
粒度比较大,如果save, shutdown, slave 之前crash了,则中间的操作没办法恢复。
粒度较小,crash之后,只有crash之前没有来得及做日志的操作没办法恢复。
两种区别就是,一个是持续的用日志记录写操作,crash后利用日志恢复;一个是平时写操作的时候不触发写,只有手动提交save命令,或者是关闭命令时,才触发备份操作。
选择的标准,就是看系统是愿意牺牲一些性能,换取更高的缓存一致性(aof),还是愿意写操作频繁的时候,不启用备份来换取更高的性能,待手动运行save的时候,再做备份(rdb)
注:更多参数设置请参考:http://www.redis.net.cn/tutorial/3504.html
[root@localhost redis-3.2.5]# cd /usr/local/src/redis-3.2.5/utils [root@localhost utils]# cp redis_init_script /etc/init.d/redis
#!/bin/sh # # Simple Redis init.d script conceived to work on Linux systems #chkconfig: 2345 55 25 #description: Starts,stops and restart the redis-server # as it does use of the /proc filesystem.REDISPORT=6379 EXEC=/usr/local/bin/redis-server CLIEXEC=/usr/local/bin/redis-cliPIDFILE=/var/redis/run/redis_${REDISPORT}.pid CONF="/etc/redis/redis.conf" PASS=`grep "requirepass " $CONF | awk {print'$2'}`case "$1" instart)if [ -f $PIDFILE ]thenecho "$PIDFILE exists, process is already running or crashed"elseecho "Starting Redis server..."$EXEC $CONFfi;;stop)if [ ! -f $PIDFILE ]thenecho "$PIDFILE does not exist, process is not running"elsePID=$(cat $PIDFILE)echo "Stopping ..."if [ -z "$PASS" ]then$CLIEXEC -p $REDISPORT shutdownelse$CLIEXEC -p $REDISPORT -a $PASS shutdownfiwhile [ -x /proc/${PID} ]doecho "Waiting for Redis to shutdown ..."sleep 1doneecho "Redis stopped"fi;;*)echo "Please use start or stop as first argument";; esac
添加可执行权限并设置开机自启:
[root@localhost utils]# chmod a+x /etc/init.d/redis [root@localhost utils]# chkconfig redis on
[root@localhost utils]# service redis start [root@localhost ~]# redis-cli -a admin
[root@localhost bin]# redis-cli -h 127.0.0.1 -p 6379 -a admin
127.0.0.1:6379> set hello "hi,redis" OK 127.0.0.1:6379> get hello "hi,redis"
转自:https://www.zifangsky.cn/823.html
转载于:https://www.cnblogs.com/duhuo/p/5230903.html
Linux下安装配置Redis相关推荐
- linux下安装配置redis服务
2019独角兽企业重金招聘Python工程师标准>>> linux下安装配置redis服务 2016年03月25日 15:39:31 coding_everyday 阅读数:3530 ...
- linux下redis安装教程,linux下安装配置redis图文详解
在linux系统下安装redis的详细步骤如下: 1. 首先下载一个redis安装包,下载地址:https://www.daixiaorui.com/source/13.html .也可以去官网下载最 ...
- Linux 下安装配置redis
第一部分:安装redis 本人是先下载了4.0.2版本的redis安装包直接远程上传到linux服务器/usr/local目录下 那么安装过程如下: tar -zxvf redis-4.0.2.ta ...
- linux下安装 配置 redis数据库
通过终端命令安装(推荐): 1 确保更新源服务器能正常使用 如果没有更换更新源服务器,那么可能一直都下不了软件.欢迎参考我之前的博文来更换成国内的镜像服务器http://www.cnblogs.com ...
- Linux 下安装配置C/C++开发环境 Code::Blocks
Linux 下安装配置C开发环境Code::Blocks 一.提前的话 要说C语言和Linux的关系大家应该都不会陌生,Linux系统内核就是用C语言开发的,所以所有的Linux系统下面 都会有C的编 ...
- Linux下安装配置vsftpd
Linux下安装配置vsftpd 安装vsftpd服务器 yum -y install vsftpd 可以使用rpm -qa vsftpd命令确认是否安装好vsftpd服务器. vsftpd.conf ...
- Linux 下安装配置 JDK7
Linux 下安装配置 JDK7 配置环境(debian 7) 自从从Oracle收购Sun近三年来,已经有很多变化.早在8月,甲骨文将"Operating System Distribut ...
- linux login 安装桌面,Linux_Ubuntu Linux下安装配置fluxbox桌面环境,安装 基本系统Ubuntu 7.10 G - phpStudy...
Ubuntu Linux下安装配置fluxbox桌面环境 安装 基本系统Ubuntu 7.10 Gutsy,Xfce桌面.直接安装源里的fluxbox: aptitude install fluxbo ...
- Docker Linux下安装配置及启动
Docker Linux下安装配置及启动 linux配置环境 基础下载镜像: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliy ...
最新文章
- Python的系统管理_12_rrdtool
- canvas系列教程02-直线和曲线
- 怀里橘猫柴犬,掌上代码江湖——对话阿里云MVP郭旭东
- Kotlin的基本数据类型
- Unity3d十二 3d主要引擎名称Ogre Unreal Unity Gamebryo Bigworld
- LCD12864图片字模生成
- 卖服务器销售打广告语句子,朋友圈销售广告语大全,创意广告语最能打动客户的句子!...
- 我的MBTI职业性格测试
- IT 行业有前景么?
- service now 接口进行GET、POST
- SpringSecurity(一)
- 【Java容器】Java容器入门教程
- nn.Bilinear讲解
- 粒子群算法 PSO(Particle Swarm Optimization)——原理及实现
- wx-sideslip:类似 QQ 通讯录侧滑
- Google Earth Engine (GEE) ——export 导出指定尺寸的影像
- 微雪电子SIM7000C NB-IOT Emqx MQTT 通信的详细测试过程
- python数组加入值_python一维数组怎么添加元素
- 技巧:win10的另一种美化字体的方式,使用noMeiryoUI
- CSS margin 重叠(margin collapse)