Install and test Redis in CentOS 6.5

Source: Internet
Author: User
Tags download redis redis version redis cluster install redis

Install and test Redis in CentOS 6.5

Install and test apsaradb for Redis-CentOS 6.5 using NoSQL

1. Download redis

You can install or download redis online.

① Check whether the rpm package does not exist before online installation. If you check whether the rpm package does not exist in yum online, you can only download the package manually or in other ways.

[Root @ localhost ~] # Rpm-qa | grep redis

[Root @ localhost ~] # Yum list | grep redis

It indicates that it does not exist.

② Go to the official website or download it online

Wget http://redis.googlecode.com/files/redis-2.2.13.tar.gz

Redis downloaded from the official website already exists. Click to download redis.

2. Installation

Because it is in the tar.gz format, you need to decompress and install

Find the path of the downloaded file

[Root @ localhost ~] # Whereis redis

Redis:/etc/redis

[Root @ localhost ~] #

The gcc environment is required for decompressing and compiling the redis software package.

In short, what installation is missing.

Tar-zxvf reids-2.8.13.tar.gz

Cd redis-2.8.13

Make

Sudo make install

# Start configuration ---

After compilation, the Src directory contains four executable files: redis-server, redis-benchmark, redis-cli, and redis. conf. Then copy it to a directory.

Mkdir/usr/redis

Cp redis-server/usr/redis

Cp redis-benchmark/usr/redis

Cp redis-cli/usr/redis

Cp redis. conf/usr/redis

Cd/usr/redis

# End of configuration --


Or you can configure it like this
Mkdir/etc/redis
Cp redis. conf/etc/redis. conf
Mkdir/var/lib/redis

You can download the modified redis. conf from here.
Start redis
Redis-server/etc/redis. conf
# You can start the redis service in the background and check whether it is running. You can run the redis-benchmark command to test it. You can also use the redis-cli command to perform the following operations:
# When installing, The redis command will be copied to/usr/local/bin.

3. Test

Check whether the client is successfully started.

[Root @ localhost src] # ps-aux | grep redis
Warning: bad syntax, perhaps a bogu '-'? See/usr/share/doc/procps-3.2.8/FAQ
Root 23266 0.0 0.7 137356 7768? Sl redis-server *: 6379
Root 23982 0.0 0.5 19404 5100 pts/0 S + redis-cli
Root 24398 0.0 0.0 103244 876 pts/2 S + grep redis
[Root @ localhost src] # redis-cli
127.0.0.1: 6379> set w wang
OK
127.0.0.1: 6379> get w
"Wang"
Wagner. 0.0.1: 6379>

4. Close the service
Redis-cli shutdown
If the port changes, you can specify the Port:
Redis-cli-p 6379 shutdown
127.0.0.1: 6379> I + j
Cocould not connect to Redis at 127.0.0.1: 6379: Connection refused
Not connected> set w 3
Cocould not connect to Redis at 127.0.0.1: 6379: Connection refused
Not connected>

5. Start the service
[Root @ localhost src] # redis-server
[24502] 28 Oct 01:54:35. 784 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server/path/to/redis. conf
[24502] 28 Oct 01:54:35. 784 * Increased maximum number of open files to 10032 (it was originally set to 1024 ).
_._
_.-''__''-._
_.-'''. '_. ''-. _ Redis 2.8.13 (00000000/0) 64 bit
.-''.-'''.'''\/_.,_''-._
(',.-' | ',) Running in stand alone mode
| '-. _'-...-'_...-.'-. _ | ''_.-'| Port: 6379
| '-. _'. _/_.-'| PID: 24502
'-._'-._'-./_.-'_.-'
| '-. _.-' |
| '-. _'-. _.-'_.-' | Http://redis.io
'-._'-._'-.__.-'_.-'_.-'
| '-. _.-' |
| '-. _'-. _.-'_.-' |
'-._'-._'-.__.-'_.-'_.-'
'-._'-.__.-'_.-'
'-.__.-'
'-.__.-'
[24502] 28 Oct 01:54:35. 786 # Server started, Redis version 2.8.13
[24502] 28 Oct 01:54:35. 786 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. to fix this issue add'vm. overcommit_memory = 1' to/etc/sysctl. conf and then reboot or run the command 'sysctl vm. overcommit_memory = 1' for this to take effect.
[24502] 28 Oct 01:54:35. 786 * DB loaded from disk: 0.000 seconds
[24502] 28 Oct 01:54:35. 786 * The server is now ready to accept connections on port 6379

It is recommended that you re-open a window to run redsi-cli to enter the Console

Otherwise, a connection error may occur. Similar to running tomcat in windows cmd.
[Root @ localhost redis] # redis-cli
Cocould not connect to Redis at 127.0.0.1: 6379: Connection refused
Not connected> redis-cli
Cocould not connect to Redis at 127.0.0.1: 6379: Connection refused
Not connected>
[Root @ localhost redis] # redis-cli
127.0.0.1: 6379> set name = wangxin
(Error) ERR syntax error
127.0.0.1: 6379> set name wangxin
OK
127.0.0.1: 6379> set age 26
OK
127.0.0.1: 6379> get name age
(Error) ERR wrong number of arguments for 'get' command
127.0.0.1: 6379> get name
"Wangxin"
127.0.0.1: 6379> get age
"26"
Wagner. 0.0.1: 6379>

Install and test Redis in Ubuntu 14.04

Redis cluster details

Install Redis in Ubuntu 12.10 (graphic explanation) + Jedis to connect to Redis

Redis series-installation, deployment, and maintenance

Install Redis in CentOS 6.3

Learning notes on Redis installation and deployment

Redis. conf

Redis details: click here
Redis: click here

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.