Simple use of Redis

Source: Internet
Author: User
Tags redis
Operating on Linux: REDIS-CLI link redis-cli-a password
You can also enter the password individually: 127.0.0.1:6379>auth d3bcc7a988ad2d652276bca0ad8141a5
To view an existing key value pair: 127.0.0.1:6379> keys *

Configure master-Slave server:

Configuring the slave server is simple by adding the following configuration to the slave configuration file:

Slaveof Masterip Masterport

If the host is enabled for logon verification, then you need to add the following sentence: Masterauth Authpassword

Java link Redis cache: <!--redis-->       < Bean id = "Poolconfig" class = "Redis.clients.jedi S.jedispoolconfig ">           < property name =" Maxidle "value =" ${redis . Maxidle} "/>                 < Property name = "Maxwaitmillis" value = "${redis.maxwait}"/>           < P Roperty name = "Testonborrow" value = "${redis.testonborrow}"/>       </bean >      < Bean id = "Jedisconnectionfactory" class = " Org.springframework.data.redis.connection.jedis.JedisConnectionFactory "P:host-name =" ${redis.host} "P:port =" ${ Redis.port} ' P:use-pool = ' true ' P:password = ' ${redis.password} '/>     < Bean id = ' redistemplate ' class = "Org.springframework.data.redis.core.RedisTemplate" p:connection-factory-ref = "Jedisconnectionfactory"/&Gt     < Bean id = "CacheManager" class = "Org.springframework.data.redis.cache.RedisCacheManager" C: Redis-operations-ref = "Redistemplate" >       < property name = "Expires" >   &nbs P         < map >              <!--  <entry key= "Logformat" value= "${redis.logformat.timeout}"/>-->             < entry key = "Existtask" value = "${redis.existtask.timeout}"/>             </map >       </Property & Gt     </Bean > <!--redis end-->

${} This representation is a variable, configured in the Config.properties file.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.