The same physical machine deploys 6 redis processes, 7001, 7002, 7003 ports are master processes, 7004, 7005, 7006 ports are slave processes. When deploying multiple machines, note that the paired master and slave are not on the same physical machine.
1. Download the source code file redis-3.0.0.tar.gz
2. Unzip TAR-XZVF redis-3.0.0. tar.gz
3. Go to the Catalog CD redis-3.0.0
4. Compile Make
5. Install make install
6. Create 6 directories to hold the profile and data for each process mkdir 7001 to 7006
7. CP redis.conf 7001/to 7006/folder
At this point, 7001 to 7006 of these 6 directories have redis.conf configuration pieces.
- Modifying a configuration file
6 redis.conf profiles are the same, be careful to modify the contents of the Yellow Font section, the others are the same
configuration Options |
value |
Description |
daemonize |
Yes |
|
logfile |
"/opt/log/redis-7001. Log" |
|
databases |
1 |
|
dir |
/opt/oracle/redis-3.0.0/7001 |
a place to store data |
cluster-enabled |
Yes |
|
Cluster-config-file |
/opt/oracle/redis-3.0.0/7001/nodes.conf |
|
Cluster-node-timeout |
15000 |
|
Cluster-migration-barrier |
1 |
|
Cluster-require-full-coverage |
Yes |
as long as there is a pair in the cluster Master-slave Unavailable , the entire cluster is unavailable |
Start each of the 6 Redis processes by following these commands
[Email protected] redis-3.0.0]# Redis-server 7001/redis.conf
After the boot is complete, 6 redis processes have not yet formed a cluster.
1. Download the source code file ruby-2.1.6.tar.gz
2. Unzip TAR-XZVF ruby-2.1.6.tar.gz
3. Go to the Catalog CD ruby-2.1.6
4. Run./configure–prefix=/usr/opt/oracle/ruby
5. Compile Make
6. Install make install
7. Configure Environment variables
Add export path=/usr/opt/oracle/ruby/bin in/etc/profile file: $PATH
8. Execute source/etc/profile to make the environment variable effective
9. Verify that Ruby is installed successfully, execute RUBY–V, and the following output appears: Ruby installation OK.
Ruby 2.1.6p336 (2015-04-13 revision 50298) [X86_64-linux]
1. Download the source file Redis-3.2.1.gem
2. Install the gem install–l Redis-3.2.1.gem
1. Enter the SRC directory cd/opt/oracle/redis-3.0.0/src
2. Execute./REDIS-TRIB.RB Create--replicas 1 192.168.126.131:7001 192.168.126.131:7002 192.168.126.131:7003 192.168.126.131:7004 192.168.126.131:7005 192.168.126.131:7006
The yellow part is the native IP, the following log is the cluster deployment OK
[OK] All nodes agree about slots configuration.
>>> Check for open Slots ...
>>> Check Slots Coverage ...
[OK] All 16384 slots covered.
When a multi-machine deployment is performed on one of the machines./REDIS-TRIB.RB on it.
1. Go to Redis console redis-cli–c–p 7001
2. Set Foo car
3. Get Foo
If you can remove the data, the cluster installation is OK.
<bean id= "Jedispoolconfig" class= "Redis.clients.jedis.JedisPoolConfig" ><property name= "Maxtotal" value= " "/><property name=" Maxidle "value="/><property name= "Minidle" value= "ten"/><property name= " Blockwhenexhausted "value=" true "></property><property name=" Maxwaitmillis "value="/>< " Property Name= "Testonborrow" value= "false"/><property name= "Testonreturn" value= "false"/><property name = "Testwhileidle" value= "false"/></bean><bean id= "Jediscluster" class= " Redis.clients.jedis.JedisCluster "><constructor-arg index=" 0 "><set><bean class=" Redis.clients.jedis.HostAndPort "><constructor-arg index=" 0 "value=" 192.168.126.131 "/>< Constructor-arg index= "1" value= "7001" type= "int"/></bean><bean class= "Redis.clients.jedis.HostAndPort "><constructor-arg index=" 0 "value=" 192.168.126.131 "/><constructor-arg index=" 1 "value=" 7002 "type=" int "/></bean><bean class="Redis.clients.jedis.HostAndPort" ><constructor-arg index= "0" value= "192.168.126.131"/>< Constructor-arg index= "1" value= "7003" type= "int"/></bean><bean class= "Redis.clients.jedis.HostAndPort "><constructor-arg index=" 0 "value=" 192.168.126.131 "/><constructor-arg index=" 1 "value=" 7004 "type=" int "/></bean><bean class=" Redis.clients.jedis.HostAndPort "><constructor-arg index=" 0 "value=" 192.168.126.131 "/><constructor-arg index=" 1 "value=" 7005 "type=" int "/></bean><bean class=" Redis.clients.jedis.HostAndPort "><constructor-arg index=" 0 "value=" 192.168.126.131 "/>< Constructor-arg index= "1" value= "7006" type= "int"/></bean></set></constructor-arg>< Constructor-arg index= "1" value= "15000" type= "int" ></constructor-arg><constructor-arg index= "2" ref= " Jedispoolconfig "></constructor-arg></bean>
@Testpublic void Test8 () {System.out.println (jediscluster); for (int i=0;i<1000;i++) {jediscluster.set ("" +i, "" +i);} Use is not closed, Jediscluster internal automatically closed}
Redis3.0 Cluster cluster installation