【澳门金沙vip】redis集群搭建_引力节点Java高校收拾

# Note that you must specify a directory here, not a file name.dir ./6379/
# Accept connections on the specified port, default is 6379 (IANA #815344).# If port 0 is specified Redis will not listen on a TCP socket.port 6379

一:Redis集群搭建

$ wget $ tar xzf redis-3.2.0.tar.gz$ cd redis-3.2.0$ make

结果苦逼了,照旧报错,看提醒貌似是少了八个rubygems,本次大家依旧通过yum安装。

[root@localhost jack]# cluster/redis-trib.rb create --replicas 1 192.168.161.133:6379 192.168.161.133:6380 192.168.161.133:6381 192.168.161.133:6382 192.168.161.133:6383 192.168.161.133:6384cluster/redis-trib.rb:24:in `require': no such file to load -- rubygems (LoadError) from cluster/redis-trib.rb:24[root@localhost jack]# 

以此是redis 3.2
才扩充的一个功力,从效率注释中,大家就能够发现,那个私下认可便是不让外部得以访谈redis,所以这边大家就改为no,能够中远间隔访问。

第一去官方网站下载较新的3.2.0版本,下载格局照旧极其容易的,举个例子官方网址介绍的那样。

究竟貌似全体的信赖我们都化解了,接下去就能够真正进行了。

[root@localhost jack]# cluster/redis-trib.rb create --replicas 1 192.168.161.133:6379 192.168.161.133:6380 192.168.161.133:6381 192.168.161.133:6382 192.168.161.133:6383 192.168.161.133:6384 Creating cluster Performing hash slots allocation on 6 nodes...Using 3 masters:192.168.161.133:6379192.168.161.133:6380192.168.161.133:6381Adding replica 192.168.161.133:6382 to 192.168.161.133:6379Adding replica 192.168.161.133:6383 to 192.168.161.133:6380Adding replica 192.168.161.133:6384 to 192.168.161.133:6381M: fdae457e803e2e04a7c549c69b44a2beefdae3bc 192.168.161.133:6379 slots:0-5460 (5461 slots) masterM: 74285cee0fa65e64b443ecc630e447a8a65ee9f8 192.168.161.133:6380 slots:5461-10922 (5462 slots) masterM: 14ed067a1b85044325d5800fa8479a6b4e41a10c 192.168.161.133:6381 slots:10923-16383 (5461 slots) masterS: c50b1ff1fe3a00b16703f3b5705d2dafe046240b 192.168.161.133:6382 replicates fdae457e803e2e04a7c549c69b44a2beefdae3bcS: 8f7bd92f7ffb48e327820693a5820b5be7ea5556 192.168.161.133:6383 replicates 74285cee0fa65e64b443ecc630e447a8a65ee9f8S: 4a85ed078b4c99afad7f3a9a8df09082c681a649 192.168.161.133:6384 replicates 14ed067a1b85044325d5800fa8479a6b4e41a10cCan 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 clusterWaiting for the cluster to join.... Performing Cluster Check (using node 192.168.161.133:6379)M: fdae457e803e2e04a7c549c69b44a2beefdae3bc 192.168.161.133:6379 slots:0-5460 (5461 slots) masterM: 74285cee0fa65e64b443ecc630e447a8a65ee9f8 192.168.161.133:6380 slots:5461-10922 (5462 slots) masterM: 14ed067a1b85044325d5800fa8479a6b4e41a10c 192.168.161.133:6381 slots:10923-16383 (5461 slots) masterM: c50b1ff1fe3a00b16703f3b5705d2dafe046240b 192.168.161.133:6382 slots: (0 slots) master replicates fdae457e803e2e04a7c549c69b44a2beefdae3bcM: 8f7bd92f7ffb48e327820693a5820b5be7ea5556 192.168.161.133:6383 slots: (0 slots) master replicates 74285cee0fa65e64b443ecc630e447a8a65ee9f8M: 4a85ed078b4c99afad7f3a9a8df09082c681a649 192.168.161.133:6384 slots: (0 slots) master replicates 14ed067a1b85044325d5800fa8479a6b4e41a10c[OK] All nodes agree about slots configuration. Check for open slots... Check slots coverage...[OK] All 16384 slots covered.[root@localhost jack]# 
[root@localhost jack]# gem install redisSuccessfully installed redis-3.3.01 gem installedInstalling ri documentation for redis-3.3.0...Installing RDoc documentation for redis-3.3.0...

能够观望ruby是绝非设置的,所以下一步我们要安装ruby了。。。

1 port 端口地址,举个例子6380文件夹上面包车型大巴port正是6380,

# Normal Redis instances can't be part of a Redis Cluster; only nodes that are# started as cluster nodes can. In order to start a Redis instance as a# cluster node enable the cluster support uncommenting the following:#cluster-enabled yes# Every cluster node has a cluster configuration file. This file is not# intended to be edited by hand. It is created and updated by Redis nodes.# Every Redis Cluster node requires a different cluster configuration file.# Make sure that instances running in the same system do not have# overlapping cluster configuration file names.#cluster-config-file nodes-6379.conf
[root@localhost jack]# yum install -y rubygemsLoaded plugins: fastestmirror, refresh-packagekit, securityLoading mirror speeds from cached hostfile * base: mirror.bit.edu.cn * extras: mirror.bit.edu.cn * updates: mirror.bit.edu.cnSetting up Install ProcessResolving Dependencies-- Running transaction check--- Package rubygems.noarch 0:1.3.7-5.el6 will be installed-- Processing Dependency: ruby-rdoc for package: rubygems-1.3.7-5.el6.noarch-- Running transaction check--- Package ruby-rdoc.x86_64 0:1.8.7.374-4.el6_6 will be installed-- Processing Dependency: ruby-irb = 1.8.7.374-4.el6_6 for package: ruby-rdoc-1.8.7.374-4.el6_6.x86_64-- Running transaction check--- Package ruby-irb.x86_64 0:1.8.7.374-4.el6_6 will be installed-- Finished Dependency ResolutionDependencies Resolved================================================================================ Package Arch Version Repository Size================================================================================Installing: rubygems noarch 1.3.7-5.el6 base 207 kInstalling for dependencies: ruby-irb x86_64 1.8.7.374-4.el6_6 base 317 k ruby-rdoc x86_64 1.8.7.374-4.el6_6 base 381 kTransaction Summary================================================================================Install 3 Package(s)Total download size: 905 kInstalled size: 3.0 MDownloading Packages:(1/3): ruby-irb-1.8.7.374-4.el6_6.x86_64.rpm | 317 kB 00:00 (2/3): ruby-rdoc-1.8.7.374-4.el6_6.x86_64.rpm | 381 kB 00:00 (3/3): rubygems-1.3.7-5.el6.noarch.rpm | 207 kB 00:00 --------------------------------------------------------------------------------Total 625 kB/s | 905 kB 00:01 Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction Installing : ruby-irb-1.8.7.374-4.el6_6.x86_64 1/3 Installing : ruby-rdoc-1.8.7.374-4.el6_6.x86_64 2/3 Installing : rubygems-1.3.7-5.el6.noarch 3/3 Verifying : ruby-rdoc-1.8.7.374-4.el6_6.x86_64 1/3 Verifying : ruby-irb-1.8.7.374-4.el6_6.x86_64 2/3 Verifying : rubygems-1.3.7-5.el6.noarch 3/3 Installed: rubygems.noarch 0:1.3.7-5.el6 Dependency Installed: ruby-irb.x86_64 0:1.8.7.374-4.el6_6 ruby-rdoc.x86_64 0:1.8.7.374-4.el6_6 Complete![root@localhost jack]# 

依旧有标题,这一次貌似是一个gem_original_require未有设置,当然那些貌似是说ruby版本皇帝数大了,所以今后亲要么进级ruby版本,要么直接安装ruby的redis驱动。

依旧再而三不死心,我们后续运营replicas命令命令。

3. config配置。

2 cluster-enabled 和 cluster-config-file

4 protected-mode

3 directory

2. 安装ruby

[root@localhost jack]# cluster/redis-trib.rb create --replicas 1 192.168.161.133:6379 192.168.161.133:6380 192.168.161.133:6381 192.168.161.133:6382 192.168.161.133:6383 192.168.161.133:6384/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- redis (LoadError) from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' from cluster/redis-trib.rb:25[root@localhost jack]# 

三:配置redis-trib.rb

近期项目上用redis的话,少之又少说绝不集群的情事,毕竟一旦生产上唯有一台redis会有宏大的危机,举例机械挂掉,恐怕内部存款和储蓄器爆掉,就比方我们传延亲族情状曾今也饱受到这种境况,引致redis内部存款和储蓄器非常不足挂掉的情状,当然那个都以大家及其不可能忍受的,第三个应当要做到高可信赖,其次才是高性能,好了,上面作者来挨门挨户搭建转眼。

其一从名称想到所包涵的意义,首先须求开启redis的cluster形式,然后配置一个cluster-config-file文件,那么些文件用于贮存redis的实时新闻,redis会动态追加和修正那几个conf上边包车型地铁开始和结果消息,可是要铭记,那么些nodes-6379.conf
能够依据端口文件夹依次配置,比如6380文书夹能够改成nodes-6380.conf那样。。。

随之大家重国民党的新生活运动行 replicas命令,看看会怎么着。。。

[jack@localhost ~]$ cluster/redis-trib.rb create --replicas 1 192.168.161.133:6379 192.168.161.133:6380 192.168.161.133:6381 192.168.161.133:6382 192.168.161.133:6383 192.168.161.133:6384/usr/bin/env: ruby: No such file or directory[jack@localhost ~]$ 

ok,到明天了却,大家的config就更改实现了,其余端口的文件夹也足以依次配置之~

为了方便管理,作者这里配置的root目录决计于在哪些文件夹,举例6380下边我的dir便是:
dir ./6380/

近日directory的布满情形大意如上海教室,接下去要做的作业正是陈设redis.conf了,在此须要配备几个选拔。。。

因为redis-trib.rb是ruby写的,而大家的计算机料定是尚未ruby和有些配置信赖项,可是没什么,有强有力的yum安装,一切都平常。

由于我们要做集群,而且还要redis自带的redis-trib.rb
能健康运作,大家需求在集群中展开三台master,三台slave,所以那边作者索要树立6个公文夹,并且文件夹的名号就利用端口地址的名字,比方:6389.
6380….6384。

从地方能够看来,trib程序告知大家是还是不是用 6379,6380,6381 作为主,
6382,6383,6384用作从。。然后笔者就特许了。。就那样我们的集群就创建好了

二:开启redis

1. 下载

[jack@localhost ~]$ sudousage: sudo [-D level] -h | -K | -k | -Vusage: sudo -v [-AknS] [-D level] [-g groupname|#gid] [-p prompt] [-u user name|#uid]usage: sudo -l[l] [-AknS] [-D level] [-g groupname|#gid] [-p prompt] [-U user name] [-u user name|#uid] [-g groupname|#gid] [command]usage: sudo [-AbEHknPS] [-r role] [-t type] [-C fd] [-D level] [-g groupname|#gid] [-p prompt] [-u user name|#uid] [-g groupname|#gid] [VAR=value] [-i|-s] [command]usage: sudo -e [-AknS] [-r role] [-t type] [-C fd] [-D level] [-g groupname|#gid] [-p prompt] [-u user name|#uid] file ...[jack@localhost ~]$ suPassword: jacsu: incorrect password[jack@localhost ~]$ yum install rubyLoaded plugins: fastestmirror, refresh-packagekit, securityYou need to be root to perform this command.[jack@localhost ~]$ jackbash: jack: command not found[jack@localhost ~]$ suPassword: [root@localhost jack]# yum install rubyLoaded plugins: fastestmirror, refresh-packagekit, securityLoading mirror speeds from cached hostfile * base: mirror.bit.edu.cn * extras: mirror.bit.edu.cn * updates: mirror.bit.edu.cnSetting up Install ProcessResolving Dependencies-- Running transaction check--- Package ruby.x86_64 0:1.8.7.374-4.el6_6 will be installed-- Processing Dependency: ruby-libs = 1.8.7.374-4.el6_6 for package: ruby-1.8.7.374-4.el6_6.x86_64-- Processing Dependency: libruby.so.1.8()(64bit) for package: ruby-1.8.7.374-4.el6_6.x86_64-- Running transaction check--- Package ruby-libs.x86_64 0:1.8.7.374-4.el6_6 will be installed-- Processing Dependency: libreadline.so.5()(64bit) for package: ruby-libs-1.8.7.374-4.el6_6.x86_64-- Running transaction check--- Package compat-readline5.x86_64 0:5.2-17.1.el6 will be installed-- Finished Dependency ResolutionDependencies Resolved================================================================================ Package Arch Version Repository Size================================================================================Installing: ruby x86_64 1.8.7.374-4.el6_6 base 538 kInstalling for dependencies: compat-readline5 x86_64 5.2-17.1.el6 base 130 k ruby-libs x86_64 1.8.7.374-4.el6_6 base 1.7 MTransaction Summary================================================================================Install 3 Package(s)Total download size: 2.3 MInstalled size: 7.8 MIs this ok [y/N]: yDownloading Packages:(1/3): compat-readline5-5.2-17.1.el6.x86_64.rpm | 130 kB 00:00 (2/3): ruby-1.8.7.374-4.el6_6.x86_64.rpm | 538 kB 00:00 (3/3): ruby-libs-1.8.7.374-4.el6_6.x86_64.rpm | 1.7 MB 00:02 --------------------------------------------------------------------------------Total 747 kB/s | 2.3 MB 00:03 warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEYRetrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6Importing GPG key 0xC105B9DE: Userid : CentOS-6 Key (CentOS 6 Official Signing Key) centos-6-key@centos.org Package: centos-release-6-5.el6.centos.11.1.x86_64 (@anaconda-CentOS-201311272149.x86_64/6.5) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6Is this ok [y/N]: yRunning rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning Transaction Installing : compat-readline5-5.2-17.1.el6.x86_64 1/3 Installing : ruby-libs-1.8.7.374-4.el6_6.x86_64 2/3 Installing : ruby-1.8.7.374-4.el6_6.x86_64 3/3 Verifying : compat-readline5-5.2-17.1.el6.x86_64 1/3 Verifying : ruby-libs-1.8.7.374-4.el6_6.x86_64 2/3 Verifying : ruby-1.8.7.374-4.el6_6.x86_64 3/3 Installed: ruby.x86_64 0:1.8.7.374-4.el6_6 Dependency Installed: compat-readline5.x86_64 0:5.2-17.1.el6 ruby-libs.x86_64 0:1.8.7.374-4.el6_6 Complete![root@localhost jack]# 

到近年来停止,种种端口文件夹都布置成功了,接下去计划张开了。

3. 安装rubygems

6. 运行replicas命令

澳门金沙vip,1. 执行replicas命令

# By default protected mode is enabled. You should disable it only if# you are sure you want clients from other hosts to connect to Redis# even if no authentication is configured, nor a specific set of interfaces# are explicitly listed using the "bind" directive.protected-mode no

4. 安装redis驱动

2. redis配置

接下去大家得以看一下,在6379底下是不是有生成node-6379.conf文件,比方上面: