Installation and phpredisadmin installation of Redis under Windows

Source: Internet
Author: User
Tags benchmark redis server

Redis's network disk under Windows: Http://pan.baidu.com/s/1c0yeIDM

    • Redis-server.exe: Service Program
    • Redis-check-dump.exe: Local Database check
    • Redis-check-aof.exe: Update log check
    • Redis-benchmark.exe: Performance test to simulate the simultaneous sending of M-Sets/gets queries by n clients

Run the configuration file redis.conf or redis.windows.conf that requires Redis, if not specified, use the default settings

Start running Redis:

Extract directory: \>redis-server.exe redis.conf

The Redis service shuts down automatically when this window is to be turned on and off

To run a client connection:

Extract directory: \>redis-cli.exe-h 127.0.0.1-p 6379

Test it:

$./REDIS-CLI Set MyKey somevalue
Ok
$./REDIS-CLI Get MyKey
Somevalue

Test the performance:

D:\redis>redis-benchmark.exe-h 127.0.0.1-p 6379-n 100000-c 50

Second, the Redis extension to install PHP

The Redis extension for installing PHP under Windows is very simple, download a. dll extension package into the PHP ext directory, and add a line of configuration to the php.ini.

The php5.3 version of Redis's PHP extension package (with a DLL in it) is available here: https://github.com/nicolasff/phpredis/downloads

After decompression, put the DLL into the PHP ext directory, open php.ini, add a line:

extension=php_redis.dll

Then, restart Apache or Nginx or IIS.

To detect if the installation was successful, you can open phpinfo to see:

C. Simple test of redis operation in PHP

Confirm that we have done the following steps:

    • We have Redis installed and started the Redis server with the ' redis-server.exe redis.conf ' command

    • We have downloaded the php_redis.dll copy to the PHP ext directory and added a line to the php.ini: "" and extension=php_redis.dll then restarted the Web server

Then we run the following code:





$redis->connect (' 127.0.0.1 ', 6379); The function of using Redis here is to set


echo "Gets the value of the key by the Get method:<br>". $redis->get (' name1 '). " <br> ". $redis->get (' name2 ');?>

Run:

In fact, with the $redis object, you can arbitrarily execute all of the Redis commands, including all the official Redis manual commands: Official manual

Iv. Redis+mysql A simple attempt to implement cache writes

Redis is for caching, which can resemble memory-to-disk write-Back relationships:

The following is a poll of the Redis test, when the number of votes to 50, it can be written to MySQL:

<?php/** * * Cache Utilization Test, here we get the voting data sent over, each add 1, if added to the set value, will vote * number of times to write back to MySQL, which greatly reduces the cost of the MySQL link, the use of Redis is evident * @var Unknown_ Type * @ From: www.crazyant.net and www.51projob.com *//Get polling information for ID $aid = isset ($_get[' aid '])? Ereg_replace ("[^0-9]", "" ", $_get[' aid ']): 0; The current number of votes refers to the data in Redis $this _click_num = 0; if ($aid >2) {//sets the maximum number of votes written back, this value is written back to MySQL $update _till_num = 50;//Create Redis Object $r = new Redis (); $r->connect (' 127.0.0.1 ', 6379); Get now is the first few data $this _click_num = $r->get (' count_xin_newgame: '. $aid); Number of clicks plus 1 $r->set (' count_xin_newgame: ' $aid, $this _click_num+1); if ($this _click_num>= $update _till_num) {//If the number of clicks exceeds the set number, write the data to MySQL if ($this _click_num> $update _till_num) Require_once (DirName (__file__). " /db.php "); Update Database $db->executenonequery ("Update ' addonnewgame ' SET ' game_num ' = Game_num + ' {$update _till_num} ' WHERE ' Dede_add Onnewgame '. ' Aid ' ={$aid}; "); Resets the number of votes to 0 $r->set (' count_xin_newgame: '. $aid, 0);} $r->settimeout (' count_xin_newgame: '. $aid, 7*24*60*60); Exit ($this _click_num);}?> 

There are no documents found for the Php-redis extension, the official document is a php_redis.php header file, address:

Https://github.com/ukko/phpredis-phpdoc

We just download the PHP and put it in our own project, so when we write the code, we can see the comments directly.

You can do this by setting up eclipse:

Setup in IDE
    • Right click your project, "Properties"
    • Select the "PHP Include Path" category
    • Click "Add Folder ..."
    • Select your checkout of Phpredis-phpdoc
    • Click "Open"
    • Click "OK"

Source: http://www.crazyant.net/2012/06/02/redis%E8%AF%A6%E7%BB%86%E5%AE%8C%E6%95%B4%E6%95%99%E7%A8%8B-windows%E4% B8%8b%e7%9a%84%e5%ae%89%e8%a3%85%e3%80%81%e6%b5%8b%e8%af%95phpredismy

Phpredisadmin https://github.com/ErikDubbelboer/phpRedisAdmin/releases/tag/v1.1.0

Download the downloaded file to the WWW folder for the Apache virtual directory configuration. Then, after running the Redis service, open the Phpredisadmin via the browser

Installation and Phpredisadmin installation of Redis under Windows

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.