CentOS编译-安装-部署Redis

1. 下载
  1. 指定某一目录, 下载安装包
[root@localhost install]# wget http://download.redis.io/releases/redis-5.0.7.tar.gz
  1. 解压
[root@localhost install]#tar xf redis-5.0.7.tar.gz
  1. 进入
[root@localhost install]#cd redis-5.0.7/
2. 编译
  1. 查看指导文件
[root@localhost redis-5.0.7]# cat README.md
  1. 执行
[root@localhost redis-5.0.7]# make
  1. gcc
[root@localhost redis-5.0.7]# yum install gcc -y
  1. 清除
[root@localhost redis-5.0.7]# make distclean
  1. 执行
[root@localhost redis-5.0.7]# make
3. 安装
  1. 选定路径
[root@localhost redis-5.0.7]# make PREFIX=/opt/bigdata/redis5 install
  1. 环境变量
[root@localhost redis-5.0.7]# vim /etc/profile
export REDIS_HOME=/opt/bigdata/redis5
export PATH=$PATH:$REDIS_HOME/bin
[root@localhost redis-5.0.7]# source /etc/profile

配置完环境变量后, 可以在任何目录使用redis命令

[root@localhost ~]# redis-
redis-benchmark  redis-check-aof  redis-check-rdb  redis-cli        redis-sentinel   redis-server
[root@localhost ~]# redis-
4. 部署service服务
  1. 进入redis目录
[root@localhost redis-5.0.7]# cd utils/
  1. 配置端口, 日志等相关参数
./install_server.sh
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 [/opt/bigdata/redis5/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     : /opt/bigdata/redis5/bin/redis-server
Cli Executable : /opt/bigdata/redis5/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!
  1. 查看服务
cd /etc/init.d/
[root@localhost init.d]# ll
total 44
-rw-r--r--. 1 root root 18281 Aug 24  2018 functions
-rwxr-xr-x. 1 root root  4569 Aug 24  2018 netconsole
-rwxr-xr-x. 1 root root  7923 Aug 24  2018 network
-rw-r--r--. 1 root root  1160 Oct 31  2018 README
-rwxr-xr-x. 1 root root  1720 Feb 29 10:47 redis_6379
  1. 使用service
[root@localhost init.d]# service redis_6379 status
Redis is running (40164)
[root@localhost init.d]# ps -fe | grep redis
root      40164      1  0 10:47 ?        00:00:00 /opt/bigdata/redis5/bin/redis-server 127.0.0.1:6379
root      40182   7418  0 10:48 pts/0    00:00:00 grep --color=auto redis
[root@localhost init.d]# service redis_6379 start
[root@localhost init.d]# service redis_6379 stop
[root@localhost init.d]# service redis_6379 restart
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

敲代码der

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值