linux版本的redis bin,Linux下安装Redis4.0版本(简便方法)
Redis介紹:
Redis 是完全開源免費(fèi)的,遵守BSD協(xié)議,是一個(gè)高性能的key-value數(shù)據(jù)庫。
Redis 與其他 key - value 緩存產(chǎn)品有以下三個(gè)特點(diǎn):
Redis支持?jǐn)?shù)據(jù)的持久化RDB和AOF,可以將內(nèi)存中的數(shù)據(jù)保存在磁盤中,重啟的時(shí)候可以再次加載進(jìn)行使用。
Redis不僅僅支持簡單的key-value類型的數(shù)據(jù),同時(shí)還提供list,set,zset,hash等數(shù)據(jù)結(jié)構(gòu)的存儲(chǔ)。
Redis支持?jǐn)?shù)據(jù)的備份,即master-slave模式的數(shù)據(jù)備份。
性能極高?– Redis能讀的速度是110000次/s,寫的速度是81000次/s 。
豐富的數(shù)據(jù)類型 – Redis支持二進(jìn)制案例的 Strings, Lists, Hashes, Sets 及 Ordered Sets 數(shù)據(jù)類型操作。
原子 – Redis的所有操作都是原子性的,意思就是要么成功執(zhí)行要么失敗完全不執(zhí)行。單個(gè)操作是原子性的。多個(gè)操作也支持事務(wù),即原子性,通過MULTI和EXEC指令包起來。
豐富的特性?– Redis還支持 publish/subscribe, 通知, key 過期等等特性。
安裝環(huán)境:
操作系統(tǒng):CentOS Linux release 7.7.1908 (Core)
IP地址:192.168.85.16
環(huán)境準(zhǔn)備:
yum install -y openssl gcc
Redis安裝:
下載最新穩(wěn)定版本。
本文章用到的是4.0.11版本,下載并安裝:
cd /data
wget http://download.redis.io/releases/redis-4.0.11.tar.gz
tar zxvf redis-4.0.11.tar.gz
添加用戶:
[root@localhost data]# useradd -M -s /sbin/nologin redis
#查看redisid信息:
[root@localhost data]#idredis
uid=1000(redis) gid=1000(redis) groups=1000(redis)
#設(shè)置redis用戶密碼
[root@localhost data]# passwd redis
創(chuàng)建相關(guān)目錄:
[root@localhost conf]# mkdir -p /data/redis/{log,conf,data}
[root@localhost conf]#chown -R redis:redis /data/redis
編譯安裝:
[root@localhost redis-4.0.11]# pwd
/data/redis-4.0.11[root@localhost redis-4.0.11]# make[root@localhost redis-4.0.11]# cd src/#指定編譯安裝路徑
[root@localhost src]#make PREFIX=/data/redis install[root@localhost src]#cp ../redis.conf /data/redis/conf
配置環(huán)境變量:
[root@localhost src]# vi ~/.bash_profile
[root@localhost src]# PATH=$PATH:$HOME/.local/bin:/data/redis/bin:$HOME/bin
[root@localhost src]# source~/.bash_profile
調(diào)整redis配置文件:
這個(gè)按需設(shè)置,我這里列出僅供參考基本的參數(shù)
[root@localhost src]# vi /data/redis/conf/redis.conf
#daemonize yes #守護(hù)進(jìn)程模式
daemonize yes
#日志文件目錄
logfile"/data/redis/log/redis.log"#redis密碼
requirepass tse123
bind192.168.85.16
啟停redis服務(wù):
[root@localhost log]# /data/redis/bin/redis-server /data/redis/conf/redis.conf
#查看服務(wù)是否啟動(dòng)成功
[root@localhost log]# netstat-lntp|grepredis
tcp0 0 192.168.85.16:6379 0.0.0.0:* LISTEN 5613/redis-server 1#停止redis實(shí)例服務(wù)/data/redis/bin/redis-cli -a 密碼 shutdown
客戶端連接測試:
[root@localhost log]# /data/redis/bin/redis-cli -h 192.168.85.16 -p 6379 -a 密碼
Warning: Using a password with"-a"option on the command line interface may not be safe.192.168.85.16:6379>PING
PONG192.168.85.16:6379>
總結(jié)
以上是生活随笔為你收集整理的linux版本的redis bin,Linux下安装Redis4.0版本(简便方法)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Nginx常见面试题及详细答案
- 下一篇: 运维学python用不上_不会Pytho