VMware Virtual Machine CENTOS7 installation Redis

Source: Internet
Author: User
Tags download redis install redis

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

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.