Install and configure apsaradb for Redis in Linux

Source: Internet
Author: User
Tags php redis zts dotfiles redis cluster

Install and configure apsaradb for Redis in Linux

I. Redis Configuration

1. Download and install

$ Wget http://download.redis.io/releases/redis-2.8.17.tar.gz
$ Tar xzf redis-2.8.17.tar.gz
$ Redis-2.8.17 cd
$ Make
$ Make install

Redis executable files are stored in/usr/local/bin by default.

2. Download the configuration file and the init STARTUP script:

Wget https://github.com/ijonas/dotfiles/raw/master/etc/init.d/redis-server
Wget https://github.com/ijonas/dotfiles/raw/master/etc/redis.conf
Sudo mv redis-server/etc/init. d/redis-server
Sudo chmod + x/etc/init. d/redis-server
Sudo mv redis. conf/etc/redis. conf
3. initialize the user and Log Path

Before starting Redis for the first time, we recommend that you create a separate user for Redis and create a new data and log folder.

Sudo useradd redis
Sudo mkdir-p/var/lib/redis
Sudo mkdir-p/var/log/redis
Sudo chown redis. redis/var/lib/redis
Sudo chown redis. redis/var/log/redis
4. Set Automatic startup and automatic shutdown

Sudo update-rc.d redis-server defaults

5. Start Redis:

Sudo/etc/init. d/redis-server start

6. Start the client connection:

$ Redis-cli
Redis> set foo bar
OK
Redis> get foo

"Bar"

Reference: http://redis.io/download

If the redis service is not enabled, the following error may occur:

Uncaught exception 'redisexception' with message 'redis server went away

CentOS commands for starting the redis Service

Cd/usr/local/bin/

Sudo./redis-server

When php redis. php is executed, the following error occurs: calss redis not found.

You need to install a phpredis extension.

Download: phpredis-master.zip

------------------------------------------ Split line ------------------------------------------

Free in http://linux.bkjia.com/

The username and password are both www.bkjia.com

The specific download directory is available in/July 6,/July 5,/Linux database Redis installation and configuration.

For the download method, see

------------------------------------------ Split line ------------------------------------------

/Usr/local/php/bin/phpize

./Configure -- with-php-config =/usr/local/php/bin/php-config

Make & make install

Vi/etc/php. d/redis. ini

Extension =/usr/local/php/lib/php/extension/ no-debug-non-zts-20090626/redis. so

This step depends on your php compilation parameter -- with-config-file-scan-dir =/etc/php. d to decide where to add redis. so.

The most important step for phpredis extension installation:

Sudo vi/usr/local/php/lib/php. ini

Search for:/extension

Add extension = redis. so

Extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613"
Extension = memcache. so
Extension = memcached. so
Extension = pdo_mysql.so
Extension = censoring. so
Extension = curl. so
Extension = zlib. so
Extension = mysql. so
Extension = gd. so
Extension = TrieFind. so
Extension = KWordFilter. so
Extension = xhprof. so
Extension = pcntl. so
Extension = redis. so

Restart the redis service.

Cd/usr/local/bin/

Sudo./redis-server

PHP clears Redis Database


// Delete all keys in the current database $ redis-> flushdb (); // Delete keys in all databases $ redis-> flushall ();

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

This article permanently updates the link address:

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.