centos7安裝redis并開啟持久化和遠程訪問
2017.03.26 00:12
6828瀏覽
下載redis3.2.4
wget http://download.redis.io/releases/redis-3.2.4.tar.gz
解壓tar -zxf redis-3.2.4.tar.gz
編譯需要gcc環境,如果沒有gcc環境yum install gcc
編譯cd redis-3.2.4
make
安裝make install
開啟aof持久化、以守護進程啟動、遠程訪問先把配置文件拷貝一份到/etc/redis/下面,目錄隨意
cp redis-3.2.4/redis.conf /etc/redis/
vim /etc/redis/redis.conf
修改四個配置:
daemonize yes #守護進程
appendonly yes #開啟aof持久化
appendfsync everysec
bind 0.0.0.0 #開啟遠程訪問
將redis安裝為服務,設置開機啟動vim /lib/systemd/system/redis.service
加入以下內容:
[Unit]
Description=redis service
Wants=network.target
[Service]
Type=forking
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
[Install]
WantedBy=multi-user.target
重新載入
systemctl daemon-reload
設置開機啟動systemctl enable redis
啟動redissystemctl start redis
開啟防火墻的3306端口firewall-cmd --add-port=3306/tcp --permanent
firewall-cmd --reload
點擊查看更多內容
8人點贊
評論
共同學習,寫下你的評論
評論加載中...
相關文章推薦
正在加載中
作者相關文章
慕課專欄
更多