daemonize
bind ip whitelist, 0.0.0.0.0 releases all
port 6379
databases 0-15 16
save persistent Frequency
ddbfilename Persistent file name
requirepass Password requirepass 123456
maxclient Maximum number of simultaneous connections
maxmemory Maximum memory
./redis-cli -h 193.168.0.1 -p 6379 -a 123456 // -h -p can be omitted
set username zs
get username
select 2 //Setting the library
set username zs //Different libraries can store the same key
set immoc:users:1 zs
get immoc:users:1 // Hierarchical storage
keys * //All keys
info
flushall //Clear all
package com.itheima.springbootradis.tools; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; import redis.clients.jedis.JedisPoolConfig; public class JedisConnectionPool { static Jedis j; static JedisPool pool; static { j = new Jedis("127.0.0.1", 6379); j.auth("123456"); String pong = j.ping(); System.out.println("pong = " + pong); JedisPoolConfig jedisPoolConfig = new JedisPoolConfig(); jedisPoolConfig.setMaxTotal(5); jedisPoolConfig.setMaxIdle(6); pool = new JedisPool(jedisPoolConfig, "192.168.10.101", 6379, 100, "123456"); } public static Jedis getJedis() { return pool.getResource(); } }rrree
The above is the detailed content of How to connect redis configuration file to java client. For more information, please follow other related articles on the PHP Chinese website!