Redis之-初識(shí)安裝

redis是開源,BSD許可,高級的key-value存儲(chǔ)系統(tǒng).
可以用來存儲(chǔ)字符串,哈希結(jié)構(gòu),鏈表,集合常用來提供數(shù)據(jù)結(jié)構(gòu)服務(wù).

創(chuàng)新互聯(lián)堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:網(wǎng)站建設(shè)、做網(wǎng)站、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的本溪網(wǎng)站設(shè)計(jì)、移動(dòng)媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

redis和memcached相比,的獨(dú)特之處:
1: redis可以用來做存儲(chǔ), 而memccached是用來做緩存,這個(gè)特點(diǎn)主要因?yàn)槠溆小背志没钡墓δ?
2: 存儲(chǔ)的數(shù)據(jù)有”結(jié)構(gòu)”,對于memcached來說,存儲(chǔ)的數(shù)據(jù),只有1種類型字符串
而redis則可以存儲(chǔ)字符串,鏈表,哈希結(jié)構(gòu),集合,有序集合等

公司使用redis很久了,一直沒有拿起心來認(rèn)認(rèn)真真的學(xué)習(xí)掌握。今天試著寫一下,互相交流。
redis官網(wǎng)是https://redis.io
我們的生產(chǎn)環(huán)境使用redis-3.2.13版本,就以此來初識(shí)并給大家展示安裝過程;
在有外網(wǎng)權(quán)限的系統(tǒng)上直接就可以做,可以從官網(wǎng)中獲取安裝的信息如:https://redis.io/download

1,wget http://download.redis.io/releases/redis-3.2.13.tar.gz
2,直接解壓
tar -zvxf redis-3.2.13.tar.gz
3,進(jìn)入安裝目錄make
4,回彈使用make test進(jìn)行測試命令語法等有效性
66 seconds - unit/dump
69 seconds - unit/type/list-2
72 seconds - integration/replication-3
74 seconds - integration/replication-4
44 seconds - unit/hyperloglog
58 seconds - unit/obuf-limits
53 seconds - unit/geo
99 seconds - unit/type/list-3
112 seconds - integration/replication-psync

\o/ All tests passed without errors!

Cleanup: may take some time... OK
make[1]: Leaving directory `/laoyang/redis-3.2.13/src'
[root@test-laoyangtest redis-3.2.13]#

5,如果我們想更改安裝的目錄,我們可以這樣安裝
[root@test-laoyangtest redis-3.2.13]# make PREFIX=/usr/local/redis install
cd src && make install
make[1]: Entering directory `/src/redis-3.2.13/src'

Hint: It's a good idea to run 'make test' ;)

INSTALL install
INSTALL install
INSTALL install
INSTALL install
INSTALL install

make[1]: Leaving directory `/laoyang/redis-3.2.13/src'
[root@test-laoyangtest redis-3.2.13]#
并復(fù)制一份配置文件到安裝的目錄
[root@test-laoyangtest local]# cd /usr/local/redis/bin/
[root@test-laoyangtest local]# cd ..

[root@test-laoyangtest redis]# cp /src/redis-3.2.13/redis.conf ./

6,解釋說明一下Redis目錄
[root@test-laoyangtest bin]# ls
redis-benchmark redis-check-aof redis-check-rdb redis-cli redis-sentinel redis-server

redis-benchmark 性能測試工具
redis-check-aof 日志文件檢測工(比如斷電造成日志損壞,可以檢測并修復(fù))
redis-check-dump 快照文件檢測工具,效果類上
redis-cli 客戶端
redis-server 服務(wù)端

7,啟動(dòng)Redis---非后臺(tái)進(jìn)程開啟

[root@test-laoyangtest redis]# ./bin/redis-server ./redis.conf
.
_.-__ ''-._ <br/>_.- .. ''-. Redis 3.2.13 (00000000/0) 64 bit
.-.-```. ```\/ _.,_ ''-._ <br/>( ' , .-` | `, ) Running in standalone mode<br/>|`-._`-...-` __...-.-.|'` .-'| Port: 6379
| -._. / .-' | PID: 10994
-._-. `-./ .-' .-'
|`-.
-._-..-' .-'.-'|
| -._-. .-'.-' | http://redis.io
`-.
-._-.
.-'.-' .-'
|-._-._ -.__.-' _.-'_.-'| <br/>|-.`-. .-'.-' |
-._-._-.__.-'_.-' _.-' <br/>-._ -.__.-' _.-' <br/>-. .-'
`-.__.-'

10994:M 09 May 21:14:48.408 # Server started, Redis version 3.2.13
10994:M 09 May 21:14:48.408 * The server is now ready to accept connections on port 6379

8,嘗試查詢,并測試
[root@test-laoyangtest redis]# ./bin/redis-cli
127.0.0.1:6379> info replication
role:master
connected_slaves:0
master_repl_offset:0
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0
127.0.0.1:6379> set What laoyang
OK
127.0.0.1:6379> get What
"laoyang"

9,更改redis讓其后臺(tái)執(zhí)行,在配置文件中改成

daemonize yes

分享題目:Redis之-初識(shí)安裝
本文地址:http://bm7419.com/article20/gejejo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計(jì)建站公司、外貿(mào)網(wǎng)站建設(shè)、云服務(wù)器、小程序開發(fā)、營銷型網(wǎng)站建設(shè)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

外貿(mào)網(wǎng)站建設(shè)