Redis安装部署 

安装5.0以上版本gcc要求在9.0以上

https://www.cnblogs.com/sanduzxcvbnm/p/12955145.html

下载:
wget http://download.redis.io/releases/redis-3.2.12.tar.gz
解压:
上传至 /data
tar xzf redis-3.2.12.tar.gz
mv redis-3.2.12 redis

安装:
yum -y install gcc automake autoconf libtool make
cd redis
make

环境变量:
vim /etc/profile 
export PATH=/data/redis/src:$PATH
source /etc/profile 

启动:
redis-server & 

连接测试:
redis-cli 
127.0.0.1:6379> set num 10
OK
127.0.0.1:6379> get num
10

基础配置文件介绍

mkdir /data/6379
cat > /data/6379/redis.conf<<EOF
daemonize yes
port 6379
logfile /data/6379/redis.log
dir /data/6379
dbfilename dump.rdb
EOF

redis-cli shutdown 
redis-server /data/6379/redis.conf 
netstat -lnp|grep 63

+++++++++++配置文件说明++++++++++++++
redis.conf
是否后台运行:
daemonize yes
默认端口:
port 6379
日志文件位置
logfile /var/log/redis.log
持久化文件存储位置
dir /data/6379
RDB持久化数据文件:
dbfilename dump.rdb
++++++++++++++++++++++++++++++++++++++
redis-cli
127.0.0.1:6379> set name zhangsan 
OK
127.0.0.1:6379> get name
"zhangsan"

系统进程启动

[Unit]
Description=Redis
After=network.target

[Service]
ExecStart=/tools/redis/src/redis-server /etc/redis/redis.conf --daemonize no
ExecStop=/tools/redis/src/redis-cli -h 127.0.0.1 -p 6379 shutdown

[Install]
WantedBy=multi-user.target
/lib/systemd/system/redis.service

相关文章:

  • 2021-11-23
  • 2021-11-28
  • 2021-10-17
  • 2019-12-02
  • 2021-11-13
  • 2021-11-02
猜你喜欢
  • 2021-10-02
  • 2021-11-23
  • 2021-12-05
  • 2021-09-29
  • 2021-09-29
  • 2021-09-29
  • 2021-11-27
  • 2021-11-23
相关资源
相似解决方案