How does Redis installation and the Java Web combine with Redis?

Source: Internet
Author: User
Tags install redis

</pre><pre name= "code" class= "Java" >java how does the Web combine with Redis? The first step: Install Redis to a Linux server. Because Redis relies on TCL, you need to install TCL first. Copy the tcl8.5.10-src.tar.gz to the/OPT/TCL directory to execute the following command:[email  protected]:~/tcl# TAR-ZXVF tcl8.5.10-src.tar.gz [email protected]:~/tcl# CD tcl8.5.10/unix/[email  protected]:~/tcl/tcl8.5.10/unix#./configure[email protected]:~/tcl/tcl8.5.10/unix# make[email  protected]:~/tcl/tcl8.5.10/unix# make install copies the redis-3.0.1.tar.gz to the/opt/redis directory to execute the following command: [email protected]:~/ redis# TAR-ZXVF redis-3.0.1.tar.gz [email protected]:~/redis# CD redis-3.0.1[email protected]:~/redis/ redis-3.0.1# make [email protected]:~/redis/redis-3.0.1# make test[email protected]:~/redis/redis-3.0.1# Make install********** the second step: Start Redis. Note: By default, Redis compiles commands such as Redis-server to the/usr/local/bin directory. Also, Redis boot defaults to the foreground, You can change the Redis boot mode to background by modifying the following configuration file. [email protected]:~/redis/redis-3.0.1# VI redis.conf daemonize No is modified to daemonize Yes to indicate that it is running in the background after start up. Redis requires a profile to be specified, as follows: [email protected]:/usr/local/bin#./redis-server/opt/redis/redis-3.0.1/redis.conf [email protected]:/usr/local/bin# Ps-ef |        grep redisroot 5968 1 0 10:41? 00:00:00./redis-server *:6379 root 5972 5820 0 10:41 pts/1 00:00:00 grep redis[email& nbsp;protected]:/usr/local/bin# ********** Step three: Stop Redis. [email protected]:/usr/local/bin# redis-cli-h 192.168.1.3-p 6379 shutdown[email protected]:/usr/local/ bin# Ps-ef | grep redisroot 4799 4658 0 19:53 pts/1 00:00:00 grep redis********** Fourth step: Connect to Redis. [email protected]:/usr/local/bin# redis-cli-h 192.168.1.3-p 6379192.168.1.3:6379> set username Isok192.168.1.3:6379> get username "is" 192.168.1.3:6379> ********** Fifth step: Create a Java project, Introduce Jedis2.7.2.jar. Start your Redis learning journey now! public class Test {private static Jedis Jedis = Null;public static void Main (string[] args) {Jedis = new Jedis ("192.168.1.  3 ");  Jedis.set ("username", "iluckysi"); System.out.println (Jedis.get ("username")); Iluckysi }} 


How does Redis installation and the Java Web combine with Redis?

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.