符合中小企业对网站设计、功能常规化式的企业展示型网站建设
本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...
商城网站建设因基本功能的需求不同费用上面也有很大的差别...
手机微信网站开发、微信官网、微信商城网站...
用redis-trib.rb搭建集群【常用方法】
创新互联公司专注为客户提供全方位的互联网综合服务,包含不限于做网站、网站制作、穆棱网络推广、微信小程序开发、穆棱网络营销、穆棱企业策划、穆棱品牌公关、搜索引擎seo、人物专访、企业宣传片、企业代运营等,从售前售中售后,我们都将竭诚为您服务,您的肯定,是我们大的嘉奖;创新互联公司为所有大学生创业者提供穆棱建站搭建服务,24小时服务热线:13518219792,官方网址:www.cdcxhl.comredis-trib.rb 是采用Ruby实现的redis集群管理工具;
内部通过Cluster相关命令进行简化集群创建、检查、槽乔伊和均衡等常见运维操作;
使用之前需要安装Ruby依赖环境
https://cache.ruby-lang.org/pub/ruby/2.3/【下载网址】 -- 下载ruby --- cd /soft/tools wget https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.4.tar.gz -- 安装ruby --- tar zxf ruby-2.3.4.tar.gz cd ruby-2.3.4 ./configure --prefix=/soft/ruby-2.3.4 make make install ln -s /soft/ruby-2.3.4 /soft/ruby cd /soft/ruby cp bin/ruby /usr/local/bin/ cp bin/gem /usr/local/bin/ [root@lbl ruby]# ll /usr/local/bin/{ruby,gem} -rwxr-xr-x. 1 root root 548 Apr 21 00:42 /usr/local/bin/gem -rwxr-xr-x. 1 root root 22306743 Apr 21 00:42 /usr/local/bin/ruby -- 安装rubygem redis依赖 --- wget http://rubygems.org/downloads/redis-3.3.0.gem gem install -l redis-3.3.0.gem gem list --check redis gem -- 安装redis-rb管理工具 --- [root@test ruby]# cp /soft/tools/redis-3.2.0/src/redis-trib.rb /usr/local/bin/ [root@test ruby]# ll /usr/local/bin/{ruby,gem,*.rb} -rwxr-xr-x. 1 root root 548 Apr 16 10:05 /usr/local/bin/gem -rwxr-xr-x. 1 root root 60578 Apr 16 10:07 /usr/local/bin/redis-trib.rb -rwxr-xr-x. 1 root root 22306727 Apr 16 10:05 /usr/local/bin/ruby
-- 主节点 redis-server /soft/redis/cluster/7000/redis.conf & redis-server /soft/redis/cluster/7100/redis.conf & redis-server /soft/redis/cluster/7200/redis.conf & -- 从节点 redis-server /soft/redis/cluster/7001/redis.conf & redis-server /soft/redis/cluster/7101/redis.conf & redis-server /soft/redis/cluster/7201/redis.conf &
启动好6个节点之后,使用redis-trib.rb create命令完成节点握手和槽分配过程:
注意:指定 主从节点时,前三个为主节点;后三个为对应从节点
[root@test cluster]# redis-trib.rb create --replicas 1 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7100 127.0.0.1:7101 127.0.0.1:7200 127.0.0.1:7300 >>> Creating cluster >>> Performing hash slots allocation on 6 nodes... Using 3 masters: 127.0.0.1:7000 127.0.0.1:7001 127.0.0.1:7100 Adding replica 127.0.0.1:7101 to 127.0.0.1:7000 Adding replica 127.0.0.1:7200 to 127.0.0.1:7001 Adding replica 127.0.0.1:7300 to 127.0.0.1:7100 M: b70ce6df43039cd8ef2004a031851668dfe51982 127.0.0.1:7000 slots:0-5460 (5461 slots) master M: 3300b8f899d7f369d7095025954f2069857801c0 127.0.0.1:7001 slots:5461-10922 (5462 slots) master M: 085d2851ef195428786f7df14a2c00fedb6ccec9 127.0.0.1:7100 slots:10923-16383 (5461 slots) master S: 97cf943c9fac35520fdd9426e344f7b7cc390fb8 127.0.0.1:7101 replicates b70ce6df43039cd8ef2004a031851668dfe51982 S: e2fae64bbac1fc28d66c4cb21c5be95be4ba8953 127.0.0.1:7200 replicates 3300b8f899d7f369d7095025954f2069857801c0 S: 5207520b05fd05240a56d132bf90fa4e9dde97cb 127.0.0.1:7300 replicates 085d2851ef195428786f7df14a2c00fedb6ccec9 Can I set the above configuration? (type 'yes' to accept): yes >>> Nodes configuration updated >>> Assign a different config epoch to each node >>> Sending CLUSTER MEET messages to join the cluster Waiting for the cluster to join... >>> Performing Cluster Check (using node 127.0.0.1:7000) M: b70ce6df43039cd8ef2004a031851668dfe51982 127.0.0.1:7000 slots:0-5460 (5461 slots) master M: 3300b8f899d7f369d7095025954f2069857801c0 127.0.0.1:7001 slots:5461-10922 (5462 slots) master M: 085d2851ef195428786f7df14a2c00fedb6ccec9 127.0.0.1:7100 slots:10923-16383 (5461 slots) master M: 97cf943c9fac35520fdd9426e344f7b7cc390fb8 127.0.0.1:7101 slots: (0 slots) master replicates b70ce6df43039cd8ef2004a031851668dfe51982 M: e2fae64bbac1fc28d66c4cb21c5be95be4ba8953 127.0.0.1:7200 slots: (0 slots) master replicates 3300b8f899d7f369d7095025954f2069857801c0 M: 5207520b05fd05240a56d132bf90fa4e9dde97cb 127.0.0.1:7300 slots: (0 slots) master replicates 085d2851ef195428786f7df14a2c00fedb6ccec9 [OK] All nodes agree about slots configuration. >>> Check for open slots... >>> Check slots coverage... [OK] All 16384 slots covered.
集群完整性是指所有的槽都分配到了存活的主节点上,只要16384个槽中有一个没有分配给节点则表示集群不完整;
可以使用redis-trib.rb check命令检测之前创建的两个集群是否成功,check命令只需要给出集群中任意一个节点地址就可以完成整个集群的检查工作;
-- 命令如下: -- redis-trib.rb check 127.0.0.1:7000 redis-trib.rb check 127.0.0.1:7100 -- 输出如下信息,提示集群所有的槽都已分配到节点 -- [root@test cluster]# redis-trib.rb check 127.0.0.1:7000 >>> Performing Cluster Check (using node 127.0.0.1:7000) M: b70ce6df43039cd8ef2004a031851668dfe51982 127.0.0.1:7000 slots:0-5460 (5461 slots) master 1 additional replica(s) S: e2fae64bbac1fc28d66c4cb21c5be95be4ba8953 127.0.0.1:7200 slots: (0 slots) slave replicates 3300b8f899d7f369d7095025954f2069857801c0 S: 97cf943c9fac35520fdd9426e344f7b7cc390fb8 127.0.0.1:7101 slots: (0 slots) slave replicates b70ce6df43039cd8ef2004a031851668dfe51982 M: 085d2851ef195428786f7df14a2c00fedb6ccec9 127.0.0.1:7100 slots:10923-16383 (5461 slots) master 1 additional replica(s) S: 5207520b05fd05240a56d132bf90fa4e9dde97cb 127.0.0.1:7300 slots: (0 slots) slave replicates 085d2851ef195428786f7df14a2c00fedb6ccec9 M: 3300b8f899d7f369d7095025954f2069857801c0 127.0.0.1:7001 slots:5461-10922 (5462 slots) master 1 additional replica(s) [OK] All nodes agree about slots configuration. >>> Check for open slots... >>> Check slots coverage... [OK] All 16384 slots covered.
1. 建立集群主要步骤如下: ① 准备节点 ② 节点握手【meet命令,是一个异步命令】 ③ 分配槽 【cluster addslots {number_start..number_end}】 2. redis cluster 需要至少6个节点,3个主节点 +3个从节点 3. 主从节点必须为复制关系【cluster replicate 主节点ID 命令,建立复制关系】 4. 节点握手协议采用Gossip协议进行通信,通过meet命令建立握手关系,通过ping/pong命令保持正常通信 5. 加入到集群中的节点,在没有分配槽时,无法进行任何读写操作;
相关链接:
手动构建redis集群
redis集群【报错总结】
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。