Redis 6.0 安裝 + 持久化配置
#型別
c語言包: yum install -y gcc
記憶體資料庫:讀寫快,持久化可寫入硬碟
單執行緒,弱於多執行緒的 memcache,忽略這一特性
#集合的使用場景
更具文章tag來檢索文章
#版本號
小數點後的第一個數字:偶數為穩定版,奇數為非穩定版
穩定版:2.4、2.6
非穩定版:2.5、2.7
#安裝redis-6.0.6:step 1
cd /usr/local/src/
wget http://download.redis.io/releases/redis-6.0.6.tar.gz
tar zxf redis-6.0.6.tar.gz
cd redis-6.0.6
make 「要求gcc >5.3,預設4.8.5」
server.c:5209:176: error: ‘struct redisServer’ has no member named ‘maxmemory’
serverLog(LL_WARNING,"WARNING: You specified a maxmemory value that is less than 1MB (current value is %llu bytes). Are you sure this is what you really want?", server.maxmemory);
server.c:5212:31: error: ‘struct redisServer’ has no member named ‘server_cpulist’
redisSetCpuAffinity(server.server_cpulist);
make distclean 「清理錯誤」
#升級gcc 9
yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
scl enable devtoolset-9 bash
echo "source /opt/rh/devtoolset-9/enable" >> /etc/profile
gcc -v
9.3.1
#安裝redis-6.0.6:step 2
cd /usr/local/src/redis-6.0.6
make
make PREFIX=/usr/local/redis install
ls -1 /usr/local/redis/bin/
redis-benchmark
redis-check-aof
redis-check-rdb
redis-cli 「命令列客戶端」
redis-sentinel
redis-server 「服務端」
cp redis.conf /usr/local/redis/ 「配置檔案」
#啟動:適用開發環境 step 1
cd /usr/local/redis/
vim redis.conf
./bin/redis-server redis.conf
./bin/redis-server
#啟動:適用生產環境 step 2
vim /usr/local/src/redis-6.0.6/utils/redis_init_script 「啟動指令碼」
#!/bin/sh
#
# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem.
### BEGIN INIT INFO
# Provides: redis_6379
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Redis data structure server
# Description: Redis data structure server. See https://redis.io
### END INIT INFO
REDISPORT=6379
EXEC=/usr/local/redis/bin/redis-server
CLIEXEC=/usr/local/redis/bin/redis-cli
PIDFILE=/var/run/redis_${REDISPORT}.pid
CONF="/etc/redis/${REDISPORT}.conf"
case "$1" in
start)
if [ -f $PIDFILE ]
then
echo "$PIDFILE exists, process is already running or crashed"
else
echo "Starting Redis server..."
$EXEC $CONF
fi
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist, process is not running"
else
PID=$(cat $PIDFILE)
echo "Stopping ..."
$CLIEXEC -p $REDISPORT shutdown
while [ -x /proc/${PID} ]
do
echo "Waiting for Redis to shutdown ..."
sleep 1
done
echo "Redis stopped"
fi
;;
*)
echo "Please use start or stop as first argument"
;;
esac
cp redis_init_script /etc/init.d/redis_6379 「埠號」
vim +14 /etc/init.d/redis_6379
REDISPORT=6379
EXEC=/usr/local/redis/bin/redis-server 「命令路徑」
CLIEXEC=/usr/local/redis/bin/redis-cli
PIDFILE=/var/run/redis_${REDISPORT}.pid
CONF="/etc/redis/${REDISPORT}.conf" 「配置檔案」
mkdir -p /var/redis/6379 「持久化儲存目錄」
mkdir /etc/redis
cp redis.conf /etc/redis/6379.conf
vim /etc/redis/6379.conf 「配置檔案」
daemonize yes 守護程式方式執行
pidfile /var/run/redis_6379.pid pid檔案
port 6379
dir /var/redis/6379 持久化
/etc/init.d/redis_6379 [start | stop] 「啟動指令碼」
chkconfig --add redis_6379 「開機自啟」
相關文章
- redis之 Redis持久化配置Redis持久化
- Redis持久化及其配置Redis持久化
- Java Redis系列2 (redis的安裝與使用+redis持久化的實現))JavaRedis持久化
- 配置方案:Redis持久化RDB和AOFRedis持久化
- Redis 持久化之 AOF 配置詳解Redis持久化
- Docker下redis的主從、持久化配置DockerRedis持久化
- [Redis]持久化Redis持久化
- redis持久化Redis持久化
- Redis - 持久化Redis持久化
- Redis 持久化Redis持久化
- 【Redis】安裝與配置Redis
- [Redis] 安裝與配置Redis
- CentOS redis安裝配置CentOSRedis
- Redis資料持久化—RDB持久化與AOF持久化Redis持久化
- redis 持久化策略Redis持久化
- Redis的持久化Redis持久化
- Redis 的持久化Redis持久化
- redis 之 持久化Redis持久化
- Redis 七 持久化Redis持久化
- Redis 持久化方案Redis持久化
- redis ——AOF持久化Redis持久化
- Redis 持久化(Persistence)Redis持久化
- Redis:持久化篇Redis持久化
- redis-持久化Redis持久化
- redis系列:RDB持久化與AOF持久化Redis持久化
- Redis的安裝與配置Redis
- Centos安裝與配置RedisCentOSRedis
- windows上安裝配置redisWindowsRedis
- 高可用Redis(七):Redis持久化Redis持久化
- redis持久化機制Redis持久化
- Redis的持久化方案Redis持久化
- Redis的持久化策略Redis持久化
- Redis 持久化詳解Redis持久化
- 淺談redis持久化Redis持久化
- Redis-持久化策略Redis持久化
- redis-15.持久化Redis持久化
- Redis 資料持久化Redis持久化
- redis快照--RDB持久化Redis持久化