linux下redis安装

Redis安装

下载链接:http://download.redis.io/releases/redis-5.0.5.tar.gz
安装依赖包

[root@test01 ~]# yum -y install gcc gcc-c++ automake autoconf libtool make tcl

创建redis用户

[root@test01 ~]# groupadd yunwei
[root@test01 ~]# useradd -g yunwei redis
[root@test01 ~]# passwd redis 
Changing password for user redis.
New password: 

创建redis存放目录并赋权

[root@test01 /]# mkdir -p /app/
[root@test01 /]# chown -R redis:yunwei /app/

切换到redis用户操作,先将压缩包上传到/app目录下并解压

[root@test01 app]# su - redis 
[redis@test01 ~]$ cd /app/
[redis@test01 app]$ tar -zvxf redis-5.0.4.tar.gz 

编译安装

[redis@test01 app]$ mv redis-5.0.4 redis
[redis@test01 app]$ cd redis/
[redis@test01 redis]$ make 

安装完成,修改配置文件

[redis@test01 redis]$ cp redis.conf /app/conf/redis-6379.conf
[redis@test01 redis]$ cd /app/conf/
[redis@test01 conf]$ vi redis-6379.conf 

修改以下几个参数,其余参数暂时先不动

bind 192.168.191.9						#绑定本地IP	
daemonize yes							#开启守护进程
requirepass redis123					#redis数据库密码
pidfile /app/conf/redis_6379.pid		#redis进程文件
logfile "/app/conf/redis_6379.log"		#redis日志文件
dbfilename dump_6379.rdb				#本地数据文件名
dir /app/conf/							#数据目录

启动redis进程,ps查看进程是否正常启动

[redis@test01 conf]$ cd /app/redis/src/
[redis@test01 src]$ ./redis-server /app/conf/redis-6379.conf 
[redis@test01 src]$ ps -ef|grep redis
root       2574   2173  0 20:00 pts/0    00:00:00 su - redis
redis      2575   2574  0 20:00 pts/0    00:00:00 -bash
redis      7242      1  0 20:24 ?        00:00:00 ./redis-server 192.168.191.9:6379
redis      7248   2575  0 20:24 pts/0    00:00:00 ps -ef
redis      7249   2575  0 20:24 pts/0    00:00:00 grep --color=auto redis
[redis@test01 src]$ 

客户端连接正常

[redis@test01 src]$ ./redis-cli -h 192.168.191.9 -p 6379 -a redis123
Warning: Using a password with '-a' or '-u' option on the command line interface may not be safe.
192.168.191.9:6379> set hello world
OK
192.168.191.9:6379> get hello
"world"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值