One, Redis relies on GCC and TCL environment, so first install GCC and TCL
1. Implementation
Yum Install gcc-c++
Install GCC, the installation process prompts whether to continue, directly enter Y can, until completed, as follows:
2. Implementation
Yum Install-y tcl
To install TCL, complete the following:
Second, download Redis, execute
wget http://download.redis.io/releases/redis-3.2.8.tar.gz
Unzip to the directory, go to the Redis unzip directory, execute the following command in turn, compile and install Redis:
Makemake Install
As shown below:
At this point, the Redis installation is complete and the SRC directory is executed redis-server
./src/redis-server
To start Redis:
Execute src directory under REDIS-CLI
./src/redis-cli
Start the Redis client as shown below, enter ping carriage return, the output pong is connected properly, and then you can enter Redis storage operations:
Third, modify the configuration file
Redis is in protected mode by default and can only be opened by 127.0.0.1 Local Area connection to redis.conf in the Redis installation directory
1) Note bind 127.0.0.1
Redis defaults to not run as a daemon thread, default in front-end mode, modify Daemonize to Yes, change to
2) Daemonize Yes
Modify Protected-model to No, that is, change to
3) Protected-model No
Specify the configuration file to start Redis:
./src/redis-server redis.conf
After startup, the following appears:
Iv. Java Connectivity Redis sample
To import a Redis jar package:
Import org.junit.Test; Import Redis.clients.jedis.Jedis; Import Redis.clients.jedis.JedisPoolConfig; Public class Redisdemo { @Test publicvoid demo1 () { Jedis Jedis= New Jedis ("192.168.123.129", 6379); Jedis.set ("name", "Jack"); String value=jedis.get ("name"); Jedis.close (); System.out.println (value);} }
The output is:
Jack
VMware Virtual Machine CENTOS7 installation Redis