zoukankan      html  css  js  c++  java
  • nodejs redis

     0. install redis library for node

    npm install redis

    1.node command example

    > var _redis = require("redis")
    undefined
    > var redis = _redis.createClient({auth_pass :"123456"});  //auth to redis with password 1234
    undefined
    > redis.set("name","ydev")
    true
    > redis.get("name")
    true

    2. config and startup redis

    setup redis: config password, maxhead and maxmemory;note it the maxmemory must be larger than maxheap

    requirepass 123456

    maxheap 10240000
    maxmemory 20480000

    start up redis with configfile:

    redis-server redis.conf

    3. install redis as windows service

    redis-server --service-install redis.windows.conf --loglevel verbose
    net stop redis

    net start redis
    use --service-uninstall  to unstall the service
     

     4. using the redis-cli

     redis-cli

     auth "123456"

     set name "123456"

     get name 

    http://www.nodejs.net/a/20130128/105909.html

    https://www.npmjs.com/package/redis

  • 相关阅读:
    Python Day14
    Python Day13
    Python Day12
    Python Day11
    Python Day10
    Python Day9
    Python Day8
    Python Day7
    Python Day6
    Python Day5
  • 原文地址:https://www.cnblogs.com/zyip/p/4189786.html
Copyright © 2011-2022 走看看