Many users are familiar with redis list, hash, set, string, and other operations,
This section briefly introduces the dynamic parameter modification, master-slave switchover, persistent settings, and system information monitoring.
The redis Chinese document provides detailed instructions on console operations,
Http://redis.readthedocs.org/en/latest/index.html
The following content is the Java API application.
Package redis; import Java. util. list; import Java. util. UUID; import redis. clients. jedis. jedis; import redis. clients. jedis. shardedjedis; import redis. clients. util. shardinfo;/*** @ author Andy */public class redismasterslavetest {Private Static final string host = ""; Private Static final int Port = 0; /*** add Test Data */Private Static void setdata (Jedis) {for (INT I = 0; I <100; I ++) {final string a = u UID. randomuuid (). tostring (); Jedis. set (A, A) ;}}/*** dbsize Total Database keys */Private Static long getdbsize (Jedis) {return Jedis. dbsize ();}/*** query persistence policy */Private Static list <string> getsaveconfig (Jedis) {return Jedis. configget ("save");}/*** set persistence policy */Private Static string setsaveconfig (Jedis) {string celue_1 = "800 1 "; string celue_2 = "400 2"; return Jedis. configset ("save", celue_1 +" "+ Celue_2);}/*** persistent data after Io blocking and then shutdown redis */Private Static string Shutdown (Jedis) {return Jedis. shutdown ();}/*** set this redis master database */Private Static string slaveofnoone (Jedis) {return Jedis. slaveofnoone ();}/*** set this redis instance to slaveof slave Database Based on host/port */Private Static string slaveof (Jedis) {return Jedis. slaveof (host, Port);}/*** query the info information of redis */Private Static string Info (Jedis Jedis) {return jedis.info ();}/*** select? */Private Static string select (Jedis) {return Jedis. Select (1 );}}
There is a way to reset the system parameters. After testing, it is useless, so it is not written.
The select method has not been used. If you have used it, you can follow the instructions to introduce it ~