您好,登錄后才能下訂單哦!
這篇文章給大家介紹redis如何用命令web化操作實現,內容非常詳細,感興趣的小伙伴們可以參考借鑒,希望對大家能有所幫助。
單機場景不考慮,以下以集群場景進行測試
版本/root/redis-6.0.4/src
/root/redis-6.0.4 編譯安裝需要采用較高版本gcc
操作系統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: 沒有那個文件或目錄
[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]#
創建集群
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
集群代理采用redis6 自己到工具:https://github.com/RedisLabs/redis-cluster-proxy
代理啟動方式:
./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 &
代理啟動后默認端口是7777
配置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]#
啟動運行./webdis
命令測試
curl -v http://localhost:7379/GET/books
curl -v http://localhost:7379/DEL/books
curl -v http://localhost:7379/SET/books/java
關于redis如何用命令web化操作實現就分享到這里了,希望以上內容可以對大家有一定的幫助,可以學到更多知識。如果覺得文章不錯,可以把它分享出去讓更多的人看到。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。