write in front
After a redis3.0.x cluster is completed, of course, to use the client jediscluster simple test cluster, this will be redis.conf bind 127.0.0.1 changed to bind + Real machine IP (my 192.168.161.131 ), the following simply records the problems and solutions encountered in the test in this article.
problems encountered and their solutions
After bind the real machine IP in redis.conf, then re-execute each redis.conf, and then create the cluster again, but error, as shown in the following figure:
The error that is reported in the picture is:
[ERR] Node 192.168.161.131:7000 is not empty. Either the node already knows other nodes (check with CLUSTER nodes) or contains some key in database 0.
That's weird, so I went over the REDIS.CONF,IP and I did change.
Thought for a while to find that these three files appendonly.aof Dump.rdb nodes.conf was generated before executing ip127.0.0.1, after I changed to True machine IP, the execution did not take effect.
Here's an explanation of the dump.rdb file:
Dump.rdb is automatically generated by the Redis server by default every once in a while the Redis server program automatically iterates through the database, writing memory snapshots in a file called "Dump.rdb", a persistence mechanism called snapshot. With snapshot, if the server goes down and the Redis server program restarts, Redis automatically loads the DUMP.RDB and restores the database state to the last time it was snapshot.
Know the reason is good to do, the solution:
1) Delete aof, RDB, nodes.conf Local backup files under each node;
2) 172.168.63.201:7001> Flushdb #清空当前数据库 (can be omitted)
3) then execute the script and execute it successfully;
After the problem is resolved, it can be successfully tested from the Java client:
PS: Here you do not test, you can write it in the configuration file, I am here for convenience.
written in the last
In fact, usually in the test encountered many problems, can find the answer on the Internet, here is just a simple record one of them. For an introduction to Redis clustering, see the Redis Chinese introduction