Redis 安裝與配置

2021-09-26 07:20:52 字數 2873 閱讀 3121

redis編譯安裝

redis執行測試

cd /opt

sudo yum install wget -y

wget

tar -zvxf redis-stable.tar.gz

mkdir etc

mv etc

1> 編譯

make
2> 安裝

//預設路徑安裝,預設路徑可在makefile檔案中檢視,也可直接修改檔案中路徑

sudo make install

//修改預設安裝路徑

sudo make prefix=/usr/local/bin install

//redis原始碼中makefile預設安裝路徑如下

32 prefix?=/usr/local

33 install_bin=$(prefix)/bin

34 install=install

[user@localhost redis-stable]$ cd /usr/local

[user@localhost local]$ ll

total 0

drwxr-xr-x. 12 root root 131 feb 17 21:55 .

drwxr-xr-x. 13 root root 155 feb 17 21:55 ..

drwxr-xr-x. 2 root root 134 mar 22 14:18 bin

drwxr-xr-x. 2 root root 6 apr 11 2018 etc

drwxr-xr-x. 2 root root 6 apr 11 2018 games

drwxr-xr-x. 2 root root 6 apr 11 2018 include

drwxr-xr-x. 2 root root 6 apr 11 2018 lib

drwxr-xr-x. 2 root root 6 apr 11 2018 lib64

drwxr-xr-x. 2 root root 6 apr 11 2018 libexec

drwxr-xr-x. 2 root root 6 apr 11 2018 sbin

drwxr-xr-x. 5 root root 49 feb 17 21:55 share

drwxr-xr-x. 2 root root 6 apr 11 2018 src

[user@localhost local]$ cd bin

[user@localhost bin]$ ll

total 32772

drwxr-xr-x. 2 root root 134 mar 22 14:18 .

drwxr-xr-x. 12 root root 131 feb 17 21:55 ..

-rwxr-xr-x. 1 root root 4366880 mar 22 14:18 redis-benchmark

-rwxr-xr-x. 1 root root 8125080 mar 22 14:18 redis-check-aof

-rwxr-xr-x. 1 root root 8125080 mar 22 14:18 redis-check-rdb

-rwxr-xr-x. 1 root root 4807856 mar 22 14:18 redis-cli

lrwxrwxrwx. 1 root root 12 mar 22 14:18 redis-sentinel -> redis-server

-rwxr-xr-x. 1 root root 8125080 mar 22 14:18 redis-server

[user@localhost bin]$

3> 清空編譯目標檔案

make clean
1> 服務端執行( 不指定配置檔案 )

redis-server
2> 終止服務端執行

ps -aux|grep redis

kill -9 pid

pkill -9 redis-server

3> 服務端後台執行

daemon:守護神

//修改redis.conf中daemonize為yes

134 # by default redis does not run as a daemon. use 'yes' if you need it.

135 # note that redis will write a pid file in /var/run/redis.pid when daemonized.

136 daemonize yes

redis-server /opt/redis-stable/etc/redis.conf
4> 客戶端連線與斷開

[user@localhost etc]$ redis-cli -h 127.0.0.1 -p 6379

127.0.0.1:6379> quit

[user@localhost etc]$

Redis安裝與配置

一 windows下安裝redis 由上圖可見redis服務的預設埠為6379 3 保持開啟redis服務剛剛開啟的視窗請不要關閉 另起乙個cmd視窗執行客戶端進驗證是否正常執行,使用cd命令切換到redis目錄執行redis cli.exe h 127.0.0.1 p 6379命令。設定鍵值對 s...

Redis安裝與配置

1.1 編譯 redis 資料庫 1 將 redis 源 檔案上傳到 linux 系統之中,隨後將其解壓縮到 usr local src 目錄之中 tar xzvf srv ftp redis 3.2.5.tar.gz c usr local src 2 為了進行 redis 資料庫的編譯,那麼需要...

Redis安裝與配置

wget tar xf usr local redis 2.8.12.tar.gz cd redis 2.8.12 make 如果出現一下報錯 zmalloc.h 50 31 fatal error jemalloc jemalloc.h no such file or directory 解決辦法...