redis的编译安装

下载 http://download.redis.io/releases/redis-5.0.8.tar.gz

tar -xzvf redis-5.0.8.tar.gz
cd redis-5.0.8
[hadoop@node1 redis-5.0.8]$ yum install gcc tcl -y
[hadoop@node1 redis-5.0.8]$ mkdir -p  /home/hadoop/soft/redis
[hadoop@node1 redis-5.0.8]$ make PREFIX=/home/hadoop/soft/redis install
[hadoop@node1 redis-5.0.8]$ cd /home/hadoop/soft/redis-5.0.8/src
[hadoop@node1 src]$ cp redis-sentinel /home/hadoop/soft/redis/bin

#配置环境变量
vim ~/.bash_profile
export REDIS_HOME=/home/hadoop/soft/redis
export PATH=$PATH:$REDIS_HOME/bin
source ~/.bash_profile


把redis做成一个后台服务,最好在root的~/.bash_profile中先配置环境变量
[root@node1 ~]# cd /home/hadoop/soft/redis-5.0.8/utils
[root@node1 utils]# source ~/.bash_profile 
[root@node1 utils]# ./install_server.sh 
Welcome to the redis service installer
This script will help you easily set up a running redis server

Please select the redis port for this instance: [6379] 
Selecting default: 6379
Please select the redis config file name [/etc/redis/6379.conf] 
Selected default - /etc/redis/6379.conf
Please select the redis log file name [/var/log/redis_6379.log] 
Selected default - /var/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379] 
Selected default - /var/lib/redis/6379
Please select the redis executable path [/home/hadoop/soft/redis/bin/redis-server] 
Selected config:
Port           : 6379
Config file    : /etc/redis/6379.conf
Log file       : /var/log/redis_6379.log
Data dir       : /var/lib/redis/6379
Executable     : /home/hadoop/soft/redis/bin/redis-server
Cli Executable : /home/hadoop/soft/redis/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
Successfully added to chkconfig!
Successfully added to runlevels 345!
Starting Redis server...
Installation successful!
[root@node1 utils]# cd /etc/init.d/
[root@node1 init.d]# mv redis_6379 redisd
#启动redis
[root@node1 init.d]# service redisd start
Starting Redis server...

#查看端口
[root@node1 init.d]# ss -tanl


[hadoop@node1 ~]$ redis-cli 
127.0.0.1:6379> set msg 111
OK
127.0.0.1:6379> get msg
"111"
127.0.0.1:6379> 

redis快照被强制关闭了导致不能持久化的问题
127.0.0.1:6379> set a 1
(error) MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.
127.0.0.1:6379> config set stop-writes-on-bgsave-error no
OK

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值