溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

redis如何用命令web化操作實(shí)現(xiàn)

發(fā)布時(shí)間:2021-11-11 17:27:59 來源:億速云 閱讀:181 作者:柒染 欄目:云計(jì)算

這篇文章給大家介紹redis如何用命令web化操作實(shí)現(xiàn),內(nèi)容非常詳細(xì),感興趣的小伙伴們可以參考借鑒,希望對(duì)大家能有所幫助。

單機(jī)場(chǎng)景不考慮,以下以集群場(chǎng)景進(jìn)行測(cè)試

版本/root/redis-6.0.4/src

/root/redis-6.0.4 編譯安裝需要采用較高版本gcc

操作系統(tǒng)centos7

[root@localhost src]# cat /etc/redhat-release

CentOS Linux release 7.7.1908 (Core)

編譯問題參考:https://www.cnblogs.com/sanduzxcvbnm/p/12955145.html

yum -y install centos-release-scl yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils

[root@localhost redis-6.0.4]# cat cluster/redis6001.conf

port 6001

cluster-enabled yes

cluster-config-file nodes6001.conf

cluster-node-timeout 5000

appendonly yes

[root@localhost redis-6.0.4]# cat redis6002.conf

cat: redis6002.conf: 沒有那個(gè)文件或目錄

[root@localhost redis-6.0.4]# cat cluster/redis6002.conf

port 6002

cluster-enabled yes

cluster-config-file nodes6002.conf

cluster-node-timeout 5000

appendonly yes

[root@localhost redis-6.0.4]# cat cluster/redis6003.conf

port 6003

cluster-enabled yes

cluster-config-file nodes6003.conf

cluster-node-timeout 5000

appendonly yes

[root@localhost redis-6.0.4]# cat cluster/redis6004.conf

port 6004

cluster-enabled yes

cluster-config-file nodes6004.conf

cluster-node-timeout 5000

appendonly yes

[root@localhost redis-6.0.4]# cat cluster/redis6005.conf

port 6005

cluster-enabled yes

cluster-config-file nodes6005.conf

cluster-node-timeout 5000

appendonly yes

[root@localhost redis-6.0.4]# cat cluster/redis6006.conf

port 6006

cluster-enabled yes

cluster-config-file nodes6006.conf

cluster-node-timeout 5000

appendonly yes

[root@localhost redis-6.0.4]#

創(chuàng)建集群

src/redis-cli --cluster create 127.0.0.1:6001 127.0.0.1:6002 127.0.0.1:6003 127.0.0.1:6004 127.0.0.1:6005 127.0.0.1:6006 --cluster-replicas 1

redis如何用命令web化操作實(shí)現(xiàn)

redis如何用命令web化操作實(shí)現(xiàn)

redis如何用命令web化操作實(shí)現(xiàn)

redis如何用命令web化操作實(shí)現(xiàn)

集群代理采用redis6 自己到工具:https://github.com/RedisLabs/redis-cluster-proxy

代理啟動(dòng)方式:

./redis-cluster-proxy 127.0.0.1:6001 127.0.0.1:6002 127.0.0.1:6003 127.0.0.1:6004 127.0.0.1:6005 127.0.0.1:6006 &

代理啟動(dòng)后默認(rèn)端口是7777

redis如何用命令web化操作實(shí)現(xiàn)

配置webdis

[root@localhost webdis]# cat webdis.json

{

"redis_host": "127.0.0.1",

"redis_port": 7777,

"redis_auth": null,

"http_host": "0.0.0.0",

"http_port": 7379,

"threads": 5,

"pool_size": 20,

"daemonize": false,

"websockets": false,

"database": 0,

"acl": [

{

"disabled": ["DEBUG"]

},

{

"http_basic_auth": "user:password",

"enabled": ["DEBUG"]

}

],

        "verbosity": 6,

        "logfile": "webdis.log"

}

[root@localhost webdis]#

啟動(dòng)運(yùn)行./webdis

命令測(cè)試

 curl -v http://localhost:7379/GET/books

redis如何用命令web化操作實(shí)現(xiàn)

curl -v http://localhost:7379/DEL/books

redis如何用命令web化操作實(shí)現(xiàn)

 curl -v http://localhost:7379/SET/books/java

redis如何用命令web化操作實(shí)現(xiàn)

關(guān)于redis如何用命令web化操作實(shí)現(xiàn)就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI