1. 程式人生 > 資料庫 >CentOS 8 安裝mysql8 流程

CentOS 8 安裝mysql8 流程

1. 安裝

wget http://download.redis.io/releases/redis-5.0.3.tar.gz
tar -zxvf redis-5.0.3.tar.gz
cd redis-5.0.3
make
make install PREFIX=/usr/local/redis

 

2. 修改配置

設定後臺啟動:

cp redis.conf /usr/local/redis/bin/
# /usr/local/redis/bin/redis.conf
...
daemonize yes

 

設定最大記憶體:

# /usr/local/redis/bin/redis.conf
...
# in bytes
maxmemory 2147483648

 

3. 建立 Service

# /etc/systemd/system/redis.service
[Unit]
Description=redis-server
After=network.target

[Service]
Type=forking
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf
PrivateTmp=true

[Install]
WantedBy=multi-user.target
systemctl daemon-reload

 

systemctl start redis.service       # 啟動redis服務
systemctl stop redis.service        # 停止redis服務
systemctl restart redis.service     # 重新啟動服務
systemctl status redis.service      # 檢視服務當前狀態
systemctl enable redis.service      # 設定開機自啟動
systemctl disable redis.service     # 停止開機自啟動

 

4. 建立 redis 命令軟連結

ln -s /usr/local/redis/bin/redis-cli /usr/bin/redis

 

5. 測試

$ redis
127.0.0.1:6379> ping
PONG

 

 

參考資料

https://www.cnblogs.com/heqiuyong/p/10463334.html

https://www.cnblogs.com/cheyunhua/p/9068029.html