温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

redis如何用命令web化操作实现

发布时间:2021-11-11 17:27:59 来源:亿速云 阅读:163 作者:柒染 栏目:云计算

这篇文章给大家介绍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

redis如何用命令web化操作实现

redis如何用命令web化操作实现

redis如何用命令web化操作实现

redis如何用命令web化操作实现

集群代理采用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

redis如何用命令web化操作实现

配置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

redis如何用命令web化操作实现

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

redis如何用命令web化操作实现

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

redis如何用命令web化操作实现

关于redis如何用命令web化操作实现就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI