python初学者用redis搭建服务器集群练习的相关点
来源:互联网 发布:淘宝买家用户数据出售 编辑:程序博客网 时间:2024/05/16 13:44
需要安装的东西
- redis-3.0.7
- ruby-1.8.7:
sudo apt-get install ruby
- rubygems:
sudo apt-get install rubygems
sudo gem install redis
# 其中我们如果执行时发现如下问题,请执行上述部分中gem install redis操作
redis-trib.rb:1573: warning: key "threshold" is duplicated and overwritten on line 1573
/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- redis (LoadError)
from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from ./redis-trib.rb:25:in `<main>'
pip install redis-py-cluster
- 这里创建3个节点,所以复制3份redis.conf
- 分别命名为:redis-6379.conf, redis-6380.conf, redis-6381.conf
- 分别修改其中如下地方,拿redis-6379.conf来举例
port 6379cluster-enabled yescluster-config-file nodes-6379.confcluster-node-timeout 15000
开启3个redis-server节点./redis-server ./redis-6379.conf
./redis-server ./redis-6380.conf
./redis-server ./redis-6381.conf
./redis-trib.rb create 127.0.0.1:6379 127.0.0.1:6380 127.0.0.1:6381
- 官网:https://github.com/Grokzen/redis-py-cluster
from rediscluster import StrictRedisClusterstartup_nodes = [{"host": "127.0.0.1", "port": "6379"}, {"host": "127.0.0.1", "port": "6380"}, {"host": "127.0.0.1", "port": "6381"} ]# Note: decode_responses must be set to True when used with python3rc = StrictRedisCluster(startup_nodes=startup_nodes, decode_responses=True)rc.set("foo", "bar")print rc.get("foo")
ps 这是以前收集的一篇文章,转自哪里忘记了,请原作者看到时候或其他人知道的时候说声谢谢,并抱歉
阅读全文
0 0
- python初学者用redis搭建服务器集群练习的相关点
- 【Python】搭建redis集群
- 服务器上redis集群搭建
- Redis集群的搭建
- Redis的集群搭建
- redis集群的搭建
- Redis集群的搭建
- redis集群的搭建
- Redis集群的搭建
- redis 集群的搭建
- 【Redis】--集群的搭建
- Redis集群的搭建
- Redis集群的搭建
- redis集群的搭建
- redis集群的搭建
- Redis集群的搭建
- redis集群的搭建
- Redis集群的搭建
- C/C++:对阵结果
- 5.18
- c++第六次作业
- linux系统简述和源码目录的介绍
- JavaWeb 09 会话和状态管理
- python初学者用redis搭建服务器集群练习的相关点
- 第八届ACM山东省赛 F quadratic equation
- Android Kotlin anko 标题居中
- QT信号与槽的简单实例
- idea玩转“码云”(一、idea安装码云插件)
- c++第六次实验
- Java人民币从数字形式转换成汉字(繁体)!
- 进程间通信---->信号量
- 170518 逆向-寄存器传递参数、函数返回值