Redis安装部署
2020-04-17 本文已影响0人
村东头老骥
Redis的安装部署
# 下载软件
mkdir /data/soft -p
wget -O /data/soft/redis-3.2.9.tar.gz http://download.redis.io/releases/redis-3.2.9.tar.gz
# 目录结构
mkdir /opt/redis_cluster/redis_6379/{conf,logs,pid} -p
redis_cluster/
└── redis_6379
├── conf -- 配置文件
├── logs -- 日志
└── pid -- 进程
# 解压
tar zxvf redis-3.2.9.tar.gz -C /opt/redis_cluster/
# 创建软连接
ln -s /opt/redis_cluster/redis-3.2.9/ /opt/redis_cluster/redis
# 安装
cd /opt/redis_cluster/redis
make && make install
ll /usr/local/bin/
total 15052
-rwxr-xr-x. 1 root root 2432016 Apr 24 20:29 redis-benchmark
-rwxr-xr-x. 1 root root 25088 Apr 24 20:29 redis-check-aof
-rwxr-xr-x. 1 root root 5180928 Apr 24 20:29 redis-check-rdb
-rwxr-xr-x. 1 root root 2584968 Apr 24 20:29 redis-cli
lrwxrwxrwx. 1 root root 12 Apr 24 20:29 redis-sentinel -> redis-server
-rwxr-xr-x. 1 root root 5180928 Apr 24 20:29 redis-server
# 配置
vim /opt/redis_cluster/redis_6379/conf/redis_6379.conf
### 以守护进行模式启动
daemonize yes
### 绑定主机ip地址
bind 192.168.8.105
### 监听端口
port 6379
### pid文件存放位置
pidfile /opt/redis_cluster/redis_6379/pid/redis_6379.pid
### log文件存放位置
logfile /opt/redis_cluster/redis_6379/logs/redis_6379.log
### 设置数据库的数量
databases 16
### 指定本地持久化文件的文件名,默认为dump.rdb
dbfilename redis_6379.rdb
# 启动服务
ps -ef | grep redis
root 107878 00:00:00 /usr/local/bin/redis-server 127.0.0.1:6379
root 111025 00:00:00 redis-server 192.168.8.104:6379
# 启动redis
redis-cli -h 192.168.8.104