Redis Centos7单机安装
英文官网 https://redis.io/
中文官网:http://redis.cn/
源码安装:
版本是redis 5.0.5
下载、解压、编译Redis
$ wget http://download.redis.io/releases/redis-5.0.5.tar.gz
$ tar xzf redis-5.0.5.tar.gz
$ cd redis-5.0.5
$ make
如果报错 升级gcc
yum -y install gcc
yum -y install centos-release-scl
编译失败后,需要清除后 才能再次编译
make distclean
redis 实例 安装
make install PREFIX=/opt/zyt/redis5
vi etc/profile
添加
export REDIS_HOME=/opt/zyt/redis5
export PATH=REDIS_HOME/bin:$PATH
source /etc/profile
一个物理机可以有多个redis实例(进程) 通过port 区分
可执行程序就一份在目录,但在内存中未来的多个实例需要各自的配置文件,持久化目标等资源
通过 install_server.sh 进行实例安装
cd /zyt/redis5/utils
./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/zyt/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/zyt/redis5/bin/redis-server
Cli Executable : /opt/zyt/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!
查看 实例 运行状态/etc/init.d 存放的可执行 程序
service redis_6379 status/start/stop > /etc/init.d/redis_6379