redis安装

准备主机:

[root@net01 ~]# ifconfig 
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.135.139  netmask 255.255.255.0  broadcast 192.168.135.255
        inet6 fe80::e51f:8a9b:f2ce:e9ca  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:ab:5c:d4  txqueuelen 1000  (Ethernet)
                                ·····

下载tar包:

[root@net01 ~]# wget http://download.redis.io/releases/redis-3.2.12.tar.gz

解压:

[root@net01 ~]# tar xf redis-3.2.12.tar.gz 

移动目录并创建软连接

[root@net01 ~]# mv redis-3.2.12 /usr/local/
[root@net01 ~]# cd /usr/local/
[root@net01 local]# ln -s redis-3.2.12 redis
[root@net01 local]# ls
bin  etc  games  include  lib  lib64  libexec  redis  redis-3.2.12  sbin  share  src

安装依赖包

[root@net01 local]# yum install -y gcc gcc-c++

安装redis

[root@net01 local]# cd redis
[root@net01 redis]# make

启动redis

[root@net01 redis]# ./src/redis-server &

连接redis

[root@net01 redis]# ./src/redis-cli

#配置环境变量
[root@net01 redis]# vim /etc/profile.d/redis.sh
export PATH=/usr/local/redis/src:$PATH
[root@net01 redis]# source /etc/profile

关闭redis

[root@net01 redis]# redis-cli shutdown

[root@net01 redis]# redis-cli 
not connected> shutdown
13282:M 09 May 10:38:54.893 # User requested shutdown...
13282:M 09 May 10:38:54.893 * Saving the final RDB snapshot before exiting.
13282:M 09 May 10:38:54.895 * DB saved on disk
13282:M 09 May 10:38:54.895 # Redis is now ready to exit, bye bye...
not connected> quit

修改redis配置文件

#默认的配置文件
[root@net01 ~]# ll /usr/local/redis/redis.conf 
-rw-rw-r-- 1 root root 46695 May  9 10:41 /usr/local/redis/redis.conf

#一般都是自己手动写配置文件
1.创建存放配置文件的目录
[root@net01 ~]# mkdir /server/redis/6379 -p

2.编写配置文件
[root@net01 ~]# vim /server/redis/6379/redis.conf
daemonize yes					#启动守护进程,指定配置文件启动直接后台启动
bind 192.168.135.139 127.0.0.1		 #绑定的主机地址
port 6379						#指定端口
pidfile /server/redis/6379/redis.pid	#指定pid文件路径
loglevel notice						  #指定日志级别
logfile /server/redis/6379/redis.log	#指定日志文件路径
protected-mode no					  #关闭安全模式

3.指定配置文件启动redis
[root@net01 ~]# redis-server /server/redis/6379/redis.conf

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值